<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#0078D7;margin:15pt;" align="Left">
[AMD Official Use Only - Internal Distribution Only]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Series is:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Yong Zhao <Yong.Zhao@amd.com><br>
<b>Sent:</b> Wednesday, February 26, 2020 12:58 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Zhao, Yong <Yong.Zhao@amd.com><br>
<b>Subject:</b> [PATCH 2/2] drm/amdkfd: Make get_tile_config() generic</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Given we can query all the asic specific information from amdgpu_gfx_config,<br>
we can make get_tile_config() generic.<br>
<br>
Change-Id: I1080fec4d50c51bc84bb49b0145f8fec50081fce<br>
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 3 ++<br>
.../drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c | 1 -<br>
.../drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c | 33 -------------------<br>
.../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c | 26 ---------------<br>
.../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c | 26 ---------------<br>
.../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 23 -------------<br>
.../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.h | 2 --<br>
.../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 22 +++++++++++++<br>
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 2 +-<br>
.../gpu/drm/amd/include/kgd_kfd_interface.h | 4 ---<br>
10 files changed, 26 insertions(+), 116 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h<br>
index b0ad3be0b03f..13feb313e9b3 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h<br>
@@ -242,6 +242,9 @@ int amdgpu_amdkfd_gpuvm_import_dmabuf(struct kgd_dev *kgd,<br>
void amdgpu_amdkfd_gpuvm_init_mem_limits(void);<br>
void amdgpu_amdkfd_unreserve_memory_limit(struct amdgpu_bo *bo);<br>
<br>
+int amdgpu_amdkfd_get_tile_config(struct kgd_dev *kgd,<br>
+ struct tile_config *config);<br>
+<br>
/* KGD2KFD callbacks */<br>
int kgd2kfd_init(void);<br>
void kgd2kfd_exit(void);<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c<br>
index 4bcc175a149d..d6549e5ea7e3 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c<br>
@@ -319,7 +319,6 @@ const struct kfd2kgd_calls arcturus_kfd2kgd = {<br>
.address_watch_get_offset = kgd_gfx_v9_address_watch_get_offset,<br>
.get_atc_vmid_pasid_mapping_info =<br>
kgd_gfx_v9_get_atc_vmid_pasid_mapping_info,<br>
- .get_tile_config = kgd_gfx_v9_get_tile_config,<br>
.set_vm_context_page_table_base = kgd_set_vm_context_page_table_base,<br>
.get_hive_id = amdgpu_amdkfd_get_hive_id,<br>
};<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c<br>
index ca91fffb8a36..4ec6d0c03201 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c<br>
@@ -42,38 +42,6 @@ enum hqd_dequeue_request_type {<br>
SAVE_WAVES<br>
};<br>
<br>
-/* Because of REG_GET_FIELD() being used, we put this function in the<br>
- * asic specific file.<br>
- */<br>
-static int amdgpu_amdkfd_get_tile_config(struct kgd_dev *kgd,<br>
- struct tile_config *config)<br>
-{<br>
- struct amdgpu_device *adev = (struct amdgpu_device *)kgd;<br>
-<br>
- config->gb_addr_config = adev->gfx.config.gb_addr_config;<br>
-#if 0<br>
-/* TODO - confirm REG_GET_FIELD x2, should be OK as is... but<br>
- * MC_ARB_RAMCFG register doesn't exist on Vega10 - initial amdgpu<br>
- * changes commented out related code, doing the same here for now but<br>
- * need to sync with Ken et al<br>
- */<br>
- config->num_banks = REG_GET_FIELD(adev->gfx.config.mc_arb_ramcfg,<br>
- MC_ARB_RAMCFG, NOOFBANK);<br>
- config->num_ranks = REG_GET_FIELD(adev->gfx.config.mc_arb_ramcfg,<br>
- MC_ARB_RAMCFG, NOOFRANKS);<br>
-#endif<br>
-<br>
- config->tile_config_ptr = adev->gfx.config.tile_mode_array;<br>
- config->num_tile_configs =<br>
- ARRAY_SIZE(adev->gfx.config.tile_mode_array);<br>
- config->macro_tile_config_ptr =<br>
- adev->gfx.config.macrotile_mode_array;<br>
- config->num_macro_tile_configs =<br>
- ARRAY_SIZE(adev->gfx.config.macrotile_mode_array);<br>
-<br>
- return 0;<br>
-}<br>
-<br>
static inline struct amdgpu_device *get_amdgpu_device(struct kgd_dev *kgd)<br>
{<br>
return (struct amdgpu_device *)kgd;<br>
@@ -805,7 +773,6 @@ const struct kfd2kgd_calls gfx_v10_kfd2kgd = {<br>
.address_watch_get_offset = kgd_address_watch_get_offset,<br>
.get_atc_vmid_pasid_mapping_info =<br>
get_atc_vmid_pasid_mapping_info,<br>
- .get_tile_config = amdgpu_amdkfd_get_tile_config,<br>
.set_vm_context_page_table_base = set_vm_context_page_table_base,<br>
.get_hive_id = amdgpu_amdkfd_get_hive_id,<br>
.get_unique_id = amdgpu_amdkfd_get_unique_id,<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c<br>
index 8f052e98a3c6..0b7e78748540 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c<br>
@@ -84,31 +84,6 @@ union TCP_WATCH_CNTL_BITS {<br>
float f32All;<br>
};<br>
<br>
-/* Because of REG_GET_FIELD() being used, we put this function in the<br>
- * asic specific file.<br>
- */<br>
-static int get_tile_config(struct kgd_dev *kgd,<br>
- struct tile_config *config)<br>
-{<br>
- struct amdgpu_device *adev = (struct amdgpu_device *)kgd;<br>
-<br>
- config->gb_addr_config = adev->gfx.config.gb_addr_config;<br>
- config->num_banks = REG_GET_FIELD(adev->gfx.config.mc_arb_ramcfg,<br>
- MC_ARB_RAMCFG, NOOFBANK);<br>
- config->num_ranks = REG_GET_FIELD(adev->gfx.config.mc_arb_ramcfg,<br>
- MC_ARB_RAMCFG, NOOFRANKS);<br>
-<br>
- config->tile_config_ptr = adev->gfx.config.tile_mode_array;<br>
- config->num_tile_configs =<br>
- ARRAY_SIZE(adev->gfx.config.tile_mode_array);<br>
- config->macro_tile_config_ptr =<br>
- adev->gfx.config.macrotile_mode_array;<br>
- config->num_macro_tile_configs =<br>
- ARRAY_SIZE(adev->gfx.config.macrotile_mode_array);<br>
-<br>
- return 0;<br>
-}<br>
-<br>
static inline struct amdgpu_device *get_amdgpu_device(struct kgd_dev *kgd)<br>
{<br>
return (struct amdgpu_device *)kgd;<br>
@@ -730,7 +705,6 @@ const struct kfd2kgd_calls gfx_v7_kfd2kgd = {<br>
.address_watch_get_offset = kgd_address_watch_get_offset,<br>
.get_atc_vmid_pasid_mapping_info = get_atc_vmid_pasid_mapping_info,<br>
.set_scratch_backing_va = set_scratch_backing_va,<br>
- .get_tile_config = get_tile_config,<br>
.set_vm_context_page_table_base = set_vm_context_page_table_base,<br>
.read_vmid_from_vmfault_reg = read_vmid_from_vmfault_reg,<br>
};<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c<br>
index 19a10db93d68..ccd635b812b5 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c<br>
@@ -41,31 +41,6 @@ enum hqd_dequeue_request_type {<br>
RESET_WAVES<br>
};<br>
<br>
-/* Because of REG_GET_FIELD() being used, we put this function in the<br>
- * asic specific file.<br>
- */<br>
-static int get_tile_config(struct kgd_dev *kgd,<br>
- struct tile_config *config)<br>
-{<br>
- struct amdgpu_device *adev = (struct amdgpu_device *)kgd;<br>
-<br>
- config->gb_addr_config = adev->gfx.config.gb_addr_config;<br>
- config->num_banks = REG_GET_FIELD(adev->gfx.config.mc_arb_ramcfg,<br>
- MC_ARB_RAMCFG, NOOFBANK);<br>
- config->num_ranks = REG_GET_FIELD(adev->gfx.config.mc_arb_ramcfg,<br>
- MC_ARB_RAMCFG, NOOFRANKS);<br>
-<br>
- config->tile_config_ptr = adev->gfx.config.tile_mode_array;<br>
- config->num_tile_configs =<br>
- ARRAY_SIZE(adev->gfx.config.tile_mode_array);<br>
- config->macro_tile_config_ptr =<br>
- adev->gfx.config.macrotile_mode_array;<br>
- config->num_macro_tile_configs =<br>
- ARRAY_SIZE(adev->gfx.config.macrotile_mode_array);<br>
-<br>
- return 0;<br>
-}<br>
-<br>
static inline struct amdgpu_device *get_amdgpu_device(struct kgd_dev *kgd)<br>
{<br>
return (struct amdgpu_device *)kgd;<br>
@@ -676,6 +651,5 @@ const struct kfd2kgd_calls gfx_v8_kfd2kgd = {<br>
.get_atc_vmid_pasid_mapping_info =<br>
get_atc_vmid_pasid_mapping_info,<br>
.set_scratch_backing_va = set_scratch_backing_va,<br>
- .get_tile_config = get_tile_config,<br>
.set_vm_context_page_table_base = set_vm_context_page_table_base,<br>
};<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c<br>
index 7f91feff7c4f..df841c2ac5e7 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c<br>
@@ -48,28 +48,6 @@ enum hqd_dequeue_request_type {<br>
RESET_WAVES<br>
};<br>
<br>
-<br>
-/* Because of REG_GET_FIELD() being used, we put this function in the<br>
- * asic specific file.<br>
- */<br>
-int kgd_gfx_v9_get_tile_config(struct kgd_dev *kgd,<br>
- struct tile_config *config)<br>
-{<br>
- struct amdgpu_device *adev = (struct amdgpu_device *)kgd;<br>
-<br>
- config->gb_addr_config = adev->gfx.config.gb_addr_config;<br>
-<br>
- config->tile_config_ptr = adev->gfx.config.tile_mode_array;<br>
- config->num_tile_configs =<br>
- ARRAY_SIZE(adev->gfx.config.tile_mode_array);<br>
- config->macro_tile_config_ptr =<br>
- adev->gfx.config.macrotile_mode_array;<br>
- config->num_macro_tile_configs =<br>
- ARRAY_SIZE(adev->gfx.config.macrotile_mode_array);<br>
-<br>
- return 0;<br>
-}<br>
-<br>
static inline struct amdgpu_device *get_amdgpu_device(struct kgd_dev *kgd)<br>
{<br>
return (struct amdgpu_device *)kgd;<br>
@@ -736,7 +714,6 @@ const struct kfd2kgd_calls gfx_v9_kfd2kgd = {<br>
.address_watch_get_offset = kgd_gfx_v9_address_watch_get_offset,<br>
.get_atc_vmid_pasid_mapping_info =<br>
kgd_gfx_v9_get_atc_vmid_pasid_mapping_info,<br>
- .get_tile_config = kgd_gfx_v9_get_tile_config,<br>
.set_vm_context_page_table_base = kgd_gfx_v9_set_vm_context_page_table_base,<br>
.get_hive_id = amdgpu_amdkfd_get_hive_id,<br>
.get_unique_id = amdgpu_amdkfd_get_unique_id,<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.h<br>
index 63d3e6683dfe..aedf67d57449 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.h<br>
@@ -60,5 +60,3 @@ uint32_t kgd_gfx_v9_address_watch_get_offset(struct kgd_dev *kgd,<br>
<br>
bool kgd_gfx_v9_get_atc_vmid_pasid_mapping_info(struct kgd_dev *kgd,<br>
uint8_t vmid, uint16_t *p_pasid);<br>
-int kgd_gfx_v9_get_tile_config(struct kgd_dev *kgd,<br>
- struct tile_config *config);<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c<br>
index e1d1eed7a25f..e4481caed648 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c<br>
@@ -2242,3 +2242,25 @@ int amdgpu_amdkfd_remove_gws_from_process(void *info, void *mem)<br>
kfree(mem);<br>
return 0;<br>
}<br>
+<br>
+/* Returns GPU-specific tiling mode information */<br>
+int amdgpu_amdkfd_get_tile_config(struct kgd_dev *kgd,<br>
+ struct tile_config *config)<br>
+{<br>
+ struct amdgpu_device *adev = (struct amdgpu_device *)kgd;<br>
+<br>
+ config->gb_addr_config = adev->gfx.config.gb_addr_config;<br>
+ config->tile_config_ptr = adev->gfx.config.tile_mode_array;<br>
+ config->num_tile_configs =<br>
+ ARRAY_SIZE(adev->gfx.config.tile_mode_array);<br>
+ config->macro_tile_config_ptr =<br>
+ adev->gfx.config.macrotile_mode_array;<br>
+ config->num_macro_tile_configs =<br>
+ ARRAY_SIZE(adev->gfx.config.macrotile_mode_array);<br>
+<br>
+ /* Those values are not set from GFX9 onwards */<br>
+ config->num_banks = adev->gfx.config.num_banks;<br>
+ config->num_ranks = adev->gfx.config.num_ranks;<br>
+<br>
+ return 0;<br>
+}<br>
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c<br>
index 675735b8243a..f8fa03a12add 100644<br>
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c<br>
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c<br>
@@ -1169,7 +1169,7 @@ static int kfd_ioctl_get_tile_config(struct file *filep,<br>
if (!dev)<br>
return -EINVAL;<br>
<br>
- dev->kfd2kgd->get_tile_config(dev->kgd, &config);<br>
+ amdgpu_amdkfd_get_tile_config(dev->kgd, &config);<br>
<br>
args->gb_addr_config = config.gb_addr_config;<br>
args->num_banks = config.num_banks;<br>
diff --git a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h<br>
index abc0eb4ac493..0cee79d56075 100644<br>
--- a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h<br>
+++ b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h<br>
@@ -223,8 +223,6 @@ struct tile_config {<br>
* @set_scratch_backing_va: Sets VA for scratch backing memory of a VMID.<br>
* Only used for no cp scheduling mode<br>
*<br>
- * @get_tile_config: Returns GPU-specific tiling mode information<br>
- *<br>
* @set_vm_context_page_table_base: Program page table base for a VMID<br>
*<br>
* @invalidate_tlbs: Invalidate TLBs for a specific PASID<br>
@@ -310,8 +308,6 @@ struct kfd2kgd_calls {<br>
void (*set_scratch_backing_va)(struct kgd_dev *kgd,<br>
uint64_t va, uint32_t vmid);<br>
<br>
- int (*get_tile_config)(struct kgd_dev *kgd, struct tile_config *config);<br>
-<br>
void (*set_vm_context_page_table_base)(struct kgd_dev *kgd,<br>
uint32_t vmid, uint64_t page_table_base);<br>
uint32_t (*read_vmid_from_vmfault_reg)(struct kgd_dev *kgd);<br>
-- <br>
2.17.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Calexander.deucher%40amd.com%7C8f3b7599907940152a9908d7bae57d15%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637183367446481070&sdata=8SNAbkJvgXicyXsv%2B0jUbnLgvWM5M%2FR9uEChJrwHrxY%3D&reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Calexander.deucher%40amd.com%7C8f3b7599907940152a9908d7bae57d15%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637183367446481070&sdata=8SNAbkJvgXicyXsv%2B0jUbnLgvWM5M%2FR9uEChJrwHrxY%3D&reserved=0</a><br>
</div>
</span></font></div>
</div>
</body>
</html>