<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">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Pushed. Will work on the market name later.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Yong</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> Kuehling, Felix <Felix.Kuehling@amd.com><br>
<b>Sent:</b> Thursday, August 15, 2019 8:45 PM<br>
<b>To:</b> Zhao, Yong <Yong.Zhao@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Subject:</b> Re: [PATCH] drm/amdkfd: Fill the name field in node topology with asic name v2</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On 2019-08-13 17:21, Zhao, Yong wrote:<br>
> The name field in node topology has not been used. We re-purpose it to<br>
> hold the asic name, which can be queried by user space applications<br>
> through sysfs.<br>
><br>
> Change-Id: I74f4f5487db169004a9d27ea15abe99261c86220<br>
> Signed-off-by: Yong Zhao <Yong.Zhao@amd.com><br>
<br>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com><br>
<br>
As a follow-up, I think you could also remove the marketing name field <br>
from struct kfd_node_properties. As far as I can tell this is never <br>
populated and now it's also no longer reported in sysfs.<br>
<br>
Regards,<br>
Felix<br>
<br>
> ---<br>
> drivers/gpu/drm/amd/amdkfd/kfd_device.c | 18 ++++++++++++++++++<br>
> drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 1 +<br>
> drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 16 ++++++----------<br>
> drivers/gpu/drm/amd/amdkfd/kfd_topology.h | 4 ++--<br>
> 4 files changed, 27 insertions(+), 12 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c<br>
> index 3b9fe629a126..24bfdf583820 100644<br>
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c<br>
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c<br>
> @@ -42,6 +42,7 @@ static atomic_t kfd_locked = ATOMIC_INIT(0);<br>
> #ifdef KFD_SUPPORT_IOMMU_V2<br>
> static const struct kfd_device_info kaveri_device_info = {<br>
> .asic_family = CHIP_KAVERI,<br>
> + .asic_name = "kaveri",<br>
> .max_pasid_bits = 16,<br>
> /* max num of queues for KV.TODO should be a dynamic value */<br>
> .max_no_of_hqd = 24,<br>
> @@ -60,6 +61,7 @@ static const struct kfd_device_info kaveri_device_info = {<br>
> <br>
> static const struct kfd_device_info carrizo_device_info = {<br>
> .asic_family = CHIP_CARRIZO,<br>
> + .asic_name = "carrizo",<br>
> .max_pasid_bits = 16,<br>
> /* max num of queues for CZ.TODO should be a dynamic value */<br>
> .max_no_of_hqd = 24,<br>
> @@ -78,6 +80,7 @@ static const struct kfd_device_info carrizo_device_info = {<br>
> <br>
> static const struct kfd_device_info raven_device_info = {<br>
> .asic_family = CHIP_RAVEN,<br>
> + .asic_name = "raven",<br>
> .max_pasid_bits = 16,<br>
> .max_no_of_hqd = 24,<br>
> .doorbell_size = 8,<br>
> @@ -96,6 +99,7 @@ static const struct kfd_device_info raven_device_info = {<br>
> <br>
> static const struct kfd_device_info hawaii_device_info = {<br>
> .asic_family = CHIP_HAWAII,<br>
> + .asic_name = "hawaii",<br>
> .max_pasid_bits = 16,<br>
> /* max num of queues for KV.TODO should be a dynamic value */<br>
> .max_no_of_hqd = 24,<br>
> @@ -114,6 +118,7 @@ static const struct kfd_device_info hawaii_device_info = {<br>
> <br>
> static const struct kfd_device_info tonga_device_info = {<br>
> .asic_family = CHIP_TONGA,<br>
> + .asic_name = "tonga",<br>
> .max_pasid_bits = 16,<br>
> .max_no_of_hqd = 24,<br>
> .doorbell_size = 4,<br>
> @@ -131,6 +136,7 @@ static const struct kfd_device_info tonga_device_info = {<br>
> <br>
> static const struct kfd_device_info fiji_device_info = {<br>
> .asic_family = CHIP_FIJI,<br>
> + .asic_name = "fiji",<br>
> .max_pasid_bits = 16,<br>
> .max_no_of_hqd = 24,<br>
> .doorbell_size = 4,<br>
> @@ -148,6 +154,7 @@ static const struct kfd_device_info fiji_device_info = {<br>
> <br>
> static const struct kfd_device_info fiji_vf_device_info = {<br>
> .asic_family = CHIP_FIJI,<br>
> + .asic_name = "fiji",<br>
> .max_pasid_bits = 16,<br>
> .max_no_of_hqd = 24,<br>
> .doorbell_size = 4,<br>
> @@ -166,6 +173,7 @@ static const struct kfd_device_info fiji_vf_device_info = {<br>
> <br>
> static const struct kfd_device_info polaris10_device_info = {<br>
> .asic_family = CHIP_POLARIS10,<br>
> + .asic_name = "polaris10",<br>
> .max_pasid_bits = 16,<br>
> .max_no_of_hqd = 24,<br>
> .doorbell_size = 4,<br>
> @@ -183,6 +191,7 @@ static const struct kfd_device_info polaris10_device_info = {<br>
> <br>
> static const struct kfd_device_info polaris10_vf_device_info = {<br>
> .asic_family = CHIP_POLARIS10,<br>
> + .asic_name = "polaris10",<br>
> .max_pasid_bits = 16,<br>
> .max_no_of_hqd = 24,<br>
> .doorbell_size = 4,<br>
> @@ -200,6 +209,7 @@ static const struct kfd_device_info polaris10_vf_device_info = {<br>
> <br>
> static const struct kfd_device_info polaris11_device_info = {<br>
> .asic_family = CHIP_POLARIS11,<br>
> + .asic_name = "polaris11",<br>
> .max_pasid_bits = 16,<br>
> .max_no_of_hqd = 24,<br>
> .doorbell_size = 4,<br>
> @@ -217,6 +227,7 @@ static const struct kfd_device_info polaris11_device_info = {<br>
> <br>
> static const struct kfd_device_info polaris12_device_info = {<br>
> .asic_family = CHIP_POLARIS12,<br>
> + .asic_name = "polaris12",<br>
> .max_pasid_bits = 16,<br>
> .max_no_of_hqd = 24,<br>
> .doorbell_size = 4,<br>
> @@ -234,6 +245,7 @@ static const struct kfd_device_info polaris12_device_info = {<br>
> <br>
> static const struct kfd_device_info vegam_device_info = {<br>
> .asic_family = CHIP_VEGAM,<br>
> + .asic_name = "vegam",<br>
> .max_pasid_bits = 16,<br>
> .max_no_of_hqd = 24,<br>
> .doorbell_size = 4,<br>
> @@ -251,6 +263,7 @@ static const struct kfd_device_info vegam_device_info = {<br>
> <br>
> static const struct kfd_device_info vega10_device_info = {<br>
> .asic_family = CHIP_VEGA10,<br>
> + .asic_name = "vega10",<br>
> .max_pasid_bits = 16,<br>
> .max_no_of_hqd = 24,<br>
> .doorbell_size = 8,<br>
> @@ -268,6 +281,7 @@ static const struct kfd_device_info vega10_device_info = {<br>
> <br>
> static const struct kfd_device_info vega10_vf_device_info = {<br>
> .asic_family = CHIP_VEGA10,<br>
> + .asic_name = "vega10",<br>
> .max_pasid_bits = 16,<br>
> .max_no_of_hqd = 24,<br>
> .doorbell_size = 8,<br>
> @@ -285,6 +299,7 @@ static const struct kfd_device_info vega10_vf_device_info = {<br>
> <br>
> static const struct kfd_device_info vega12_device_info = {<br>
> .asic_family = CHIP_VEGA12,<br>
> + .asic_name = "vega12",<br>
> .max_pasid_bits = 16,<br>
> .max_no_of_hqd = 24,<br>
> .doorbell_size = 8,<br>
> @@ -302,6 +317,7 @@ static const struct kfd_device_info vega12_device_info = {<br>
> <br>
> static const struct kfd_device_info vega20_device_info = {<br>
> .asic_family = CHIP_VEGA20,<br>
> + .asic_name = "vega20",<br>
> .max_pasid_bits = 16,<br>
> .max_no_of_hqd = 24,<br>
> .doorbell_size = 8,<br>
> @@ -319,6 +335,7 @@ static const struct kfd_device_info vega20_device_info = {<br>
> <br>
> static const struct kfd_device_info arcturus_device_info = {<br>
> .asic_family = CHIP_ARCTURUS,<br>
> + .asic_name = "arcturus",<br>
> .max_pasid_bits = 16,<br>
> .max_no_of_hqd = 24,<br>
> .doorbell_size = 8,<br>
> @@ -336,6 +353,7 @@ static const struct kfd_device_info arcturus_device_info = {<br>
> <br>
> static const struct kfd_device_info navi10_device_info = {<br>
> .asic_family = CHIP_NAVI10,<br>
> + .asic_name = "navi10",<br>
> .max_pasid_bits = 16,<br>
> .max_no_of_hqd = 24,<br>
> .doorbell_size = 8,<br>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h<br>
> index 9b9a8da187c8..06bb2d7a9b39 100644<br>
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h<br>
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h<br>
> @@ -195,6 +195,7 @@ struct kfd_event_interrupt_class {<br>
> <br>
> struct kfd_device_info {<br>
> enum amd_asic_type asic_family;<br>
> + const char *asic_name;<br>
> const struct kfd_event_interrupt_class *event_interrupt_class;<br>
> unsigned int max_pasid_bits;<br>
> unsigned int max_no_of_hqd;<br>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c<br>
> index 36fa98fe858b..7551761f2aa9 100644<br>
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c<br>
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c<br>
> @@ -406,8 +406,6 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr,<br>
> char *buffer)<br>
> {<br>
> struct kfd_topology_device *dev;<br>
> - char public_name[KFD_TOPOLOGY_PUBLIC_NAME_SIZE];<br>
> - uint32_t i;<br>
> uint32_t log_max_watch_addr;<br>
> <br>
> /* Making sure that the buffer is an empty string */<br>
> @@ -422,14 +420,8 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr,<br>
> if (strcmp(attr->name, "name") == 0) {<br>
> dev = container_of(attr, struct kfd_topology_device,<br>
> attr_name);<br>
> - for (i = 0; i < KFD_TOPOLOGY_PUBLIC_NAME_SIZE; i++) {<br>
> - public_name[i] =<br>
> - (char)dev->node_props.marketing_name[i];<br>
> - if (dev->node_props.marketing_name[i] == 0)<br>
> - break;<br>
> - }<br>
> - public_name[KFD_TOPOLOGY_PUBLIC_NAME_SIZE-1] = 0x0;<br>
> - return sysfs_show_str_val(buffer, public_name);<br>
> +<br>
> + return sysfs_show_str_val(buffer, dev->node_props.name);<br>
> }<br>
> <br>
> dev = container_of(attr, struct kfd_topology_device,<br>
> @@ -1274,6 +1266,10 @@ int kfd_topology_add_device(struct kfd_dev *gpu)<br>
> */<br>
> <br>
> amdgpu_amdkfd_get_cu_info(dev->gpu->kgd, &cu_info);<br>
> +<br>
> + strncpy(dev->node_props.name, gpu->device_info->asic_name,<br>
> + KFD_TOPOLOGY_PUBLIC_NAME_SIZE);<br>
> +<br>
> dev->node_props.simd_arrays_per_engine =<br>
> cu_info.num_shader_arrays_per_engine;<br>
> <br>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h<br>
> index 276354aa0fcc..d4718d58d0f2 100644<br>
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h<br>
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h<br>
> @@ -27,7 +27,7 @@<br>
> #include <linux/list.h><br>
> #include "kfd_crat.h"<br>
> <br>
> -#define KFD_TOPOLOGY_PUBLIC_NAME_SIZE 128<br>
> +#define KFD_TOPOLOGY_PUBLIC_NAME_SIZE 32<br>
> <br>
> #define HSA_CAP_HOT_PLUGGABLE 0x00000001<br>
> #define HSA_CAP_ATS_PRESENT 0x00000002<br>
> @@ -81,7 +81,7 @@ struct kfd_node_properties {<br>
> int32_t drm_render_minor;<br>
> uint32_t num_sdma_engines;<br>
> uint32_t num_sdma_xgmi_engines;<br>
> - uint16_t marketing_name[KFD_TOPOLOGY_PUBLIC_NAME_SIZE];<br>
> + char name[KFD_TOPOLOGY_PUBLIC_NAME_SIZE];<br>
> };<br>
> <br>
> #define HSA_MEM_HEAP_TYPE_SYSTEM 0<br>
</div>
</span></font></div>
</body>
</html>