[PATCH v2 1/4] drm/amdkfd: replace asic_name with amdgpu_asic_name

Felix Kuehling felix.kuehling at amd.com
Fri Nov 19 21:11:19 UTC 2021


On 2021-11-19 2:52 p.m., Graham Sider wrote:
> device_info->asic_name and amdgpu_asic_name[adev->asic_type] both
> provide asic name strings, with the only difference being casing.

That could still break compatibility since this name gets exposed to 
user mode. You could convert the name in dev->node_props to lower case 
to fix that.

Regards,
   Felix


> Propose to remove asic_name from device_info and replace sysfs entry
> with amdgpu_asic_name[].
>
> Signed-off-by: Graham Sider <Graham.Sider at amd.com>
> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_device.c   | 29 -----------------------
>   drivers/gpu/drm/amd/amdkfd/kfd_priv.h     |  1 -
>   drivers/gpu/drm/amd/amdkfd/kfd_topology.c |  2 +-
>   3 files changed, 1 insertion(+), 31 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> index e1294fba0c26..e11fc4e20c32 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> @@ -55,7 +55,6 @@ extern const struct kfd2kgd_calls gfx_v10_3_kfd2kgd;
>   
>   #ifdef KFD_SUPPORT_IOMMU_V2
>   static const struct kfd_device_info kaveri_device_info = {
> -	.asic_name = "kaveri",
>   	.gfx_target_version = 70000,
>   	.max_pasid_bits = 16,
>   	/* max num of queues for KV.TODO should be a dynamic value */
> @@ -72,7 +71,6 @@ static const struct kfd_device_info kaveri_device_info = {
>   };
>   
>   static const struct kfd_device_info carrizo_device_info = {
> -	.asic_name = "carrizo",
>   	.gfx_target_version = 80001,
>   	.max_pasid_bits = 16,
>   	/* max num of queues for CZ.TODO should be a dynamic value */
> @@ -89,7 +87,6 @@ static const struct kfd_device_info carrizo_device_info = {
>   };
>   
>   static const struct kfd_device_info raven_device_info = {
> -	.asic_name = "raven",
>   	.gfx_target_version = 90002,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd  = 24,
> @@ -107,7 +104,6 @@ static const struct kfd_device_info raven_device_info = {
>   
>   #ifdef CONFIG_DRM_AMDGPU_CIK
>   static const struct kfd_device_info hawaii_device_info = {
> -	.asic_name = "hawaii",
>   	.gfx_target_version = 70001,
>   	.max_pasid_bits = 16,
>   	/* max num of queues for KV.TODO should be a dynamic value */
> @@ -125,7 +121,6 @@ static const struct kfd_device_info hawaii_device_info = {
>   #endif
>   
>   static const struct kfd_device_info tonga_device_info = {
> -	.asic_name = "tonga",
>   	.gfx_target_version = 80002,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd  = 24,
> @@ -141,7 +136,6 @@ static const struct kfd_device_info tonga_device_info = {
>   };
>   
>   static const struct kfd_device_info fiji_device_info = {
> -	.asic_name = "fiji",
>   	.gfx_target_version = 80003,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd  = 24,
> @@ -157,7 +151,6 @@ static const struct kfd_device_info fiji_device_info = {
>   };
>   
>   static const struct kfd_device_info fiji_vf_device_info = {
> -	.asic_name = "fiji",
>   	.gfx_target_version = 80003,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd  = 24,
> @@ -174,7 +167,6 @@ static const struct kfd_device_info fiji_vf_device_info = {
>   
>   
>   static const struct kfd_device_info polaris10_device_info = {
> -	.asic_name = "polaris10",
>   	.gfx_target_version = 80003,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd  = 24,
> @@ -190,7 +182,6 @@ static const struct kfd_device_info polaris10_device_info = {
>   };
>   
>   static const struct kfd_device_info polaris10_vf_device_info = {
> -	.asic_name = "polaris10",
>   	.gfx_target_version = 80003,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd  = 24,
> @@ -206,7 +197,6 @@ static const struct kfd_device_info polaris10_vf_device_info = {
>   };
>   
>   static const struct kfd_device_info polaris11_device_info = {
> -	.asic_name = "polaris11",
>   	.gfx_target_version = 80003,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd  = 24,
> @@ -222,7 +212,6 @@ static const struct kfd_device_info polaris11_device_info = {
>   };
>   
>   static const struct kfd_device_info polaris12_device_info = {
> -	.asic_name = "polaris12",
>   	.gfx_target_version = 80003,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd  = 24,
> @@ -238,7 +227,6 @@ static const struct kfd_device_info polaris12_device_info = {
>   };
>   
>   static const struct kfd_device_info vegam_device_info = {
> -	.asic_name = "vegam",
>   	.gfx_target_version = 80003,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd  = 24,
> @@ -254,7 +242,6 @@ static const struct kfd_device_info vegam_device_info = {
>   };
>   
>   static const struct kfd_device_info vega10_device_info = {
> -	.asic_name = "vega10",
>   	.gfx_target_version = 90000,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd  = 24,
> @@ -270,7 +257,6 @@ static const struct kfd_device_info vega10_device_info = {
>   };
>   
>   static const struct kfd_device_info vega10_vf_device_info = {
> -	.asic_name = "vega10",
>   	.gfx_target_version = 90000,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd  = 24,
> @@ -286,7 +272,6 @@ static const struct kfd_device_info vega10_vf_device_info = {
>   };
>   
>   static const struct kfd_device_info vega12_device_info = {
> -	.asic_name = "vega12",
>   	.gfx_target_version = 90004,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd  = 24,
> @@ -302,7 +287,6 @@ static const struct kfd_device_info vega12_device_info = {
>   };
>   
>   static const struct kfd_device_info vega20_device_info = {
> -	.asic_name = "vega20",
>   	.gfx_target_version = 90006,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd	= 24,
> @@ -318,7 +302,6 @@ static const struct kfd_device_info vega20_device_info = {
>   };
>   
>   static const struct kfd_device_info arcturus_device_info = {
> -	.asic_name = "arcturus",
>   	.gfx_target_version = 90008,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd	= 24,
> @@ -334,7 +317,6 @@ static const struct kfd_device_info arcturus_device_info = {
>   };
>   
>   static const struct kfd_device_info aldebaran_device_info = {
> -	.asic_name = "aldebaran",
>   	.gfx_target_version = 90010,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd	= 24,
> @@ -350,7 +332,6 @@ static const struct kfd_device_info aldebaran_device_info = {
>   };
>   
>   static const struct kfd_device_info renoir_device_info = {
> -	.asic_name = "renoir",
>   	.gfx_target_version = 90012,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd  = 24,
> @@ -366,7 +347,6 @@ static const struct kfd_device_info renoir_device_info = {
>   };
>   
>   static const struct kfd_device_info navi10_device_info = {
> -	.asic_name = "navi10",
>   	.gfx_target_version = 100100,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd  = 24,
> @@ -383,7 +363,6 @@ static const struct kfd_device_info navi10_device_info = {
>   };
>   
>   static const struct kfd_device_info navi12_device_info = {
> -	.asic_name = "navi12",
>   	.gfx_target_version = 100101,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd  = 24,
> @@ -400,7 +379,6 @@ static const struct kfd_device_info navi12_device_info = {
>   };
>   
>   static const struct kfd_device_info navi14_device_info = {
> -	.asic_name = "navi14",
>   	.gfx_target_version = 100102,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd  = 24,
> @@ -417,7 +395,6 @@ static const struct kfd_device_info navi14_device_info = {
>   };
>   
>   static const struct kfd_device_info sienna_cichlid_device_info = {
> -	.asic_name = "sienna_cichlid",
>   	.gfx_target_version = 100300,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd  = 24,
> @@ -434,7 +411,6 @@ static const struct kfd_device_info sienna_cichlid_device_info = {
>   };
>   
>   static const struct kfd_device_info navy_flounder_device_info = {
> -	.asic_name = "navy_flounder",
>   	.gfx_target_version = 100301,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd  = 24,
> @@ -451,7 +427,6 @@ static const struct kfd_device_info navy_flounder_device_info = {
>   };
>   
>   static const struct kfd_device_info vangogh_device_info = {
> -	.asic_name = "vangogh",
>   	.gfx_target_version = 100303,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd  = 24,
> @@ -468,7 +443,6 @@ static const struct kfd_device_info vangogh_device_info = {
>   };
>   
>   static const struct kfd_device_info dimgrey_cavefish_device_info = {
> -	.asic_name = "dimgrey_cavefish",
>   	.gfx_target_version = 100302,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd  = 24,
> @@ -485,7 +459,6 @@ static const struct kfd_device_info dimgrey_cavefish_device_info = {
>   };
>   
>   static const struct kfd_device_info beige_goby_device_info = {
> -	.asic_name = "beige_goby",
>   	.gfx_target_version = 100304,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd  = 24,
> @@ -502,7 +475,6 @@ static const struct kfd_device_info beige_goby_device_info = {
>   };
>   
>   static const struct kfd_device_info yellow_carp_device_info = {
> -	.asic_name = "yellow_carp",
>   	.gfx_target_version = 100305,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd  = 24,
> @@ -519,7 +491,6 @@ static const struct kfd_device_info yellow_carp_device_info = {
>   };
>   
>   static const struct kfd_device_info cyan_skillfish_device_info = {
> -	.asic_name = "cyan_skillfish",
>   	.gfx_target_version = 100103,
>   	.max_pasid_bits = 16,
>   	.max_no_of_hqd  = 24,
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> index 1054fedd7b3c..3e11febee7c6 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> @@ -195,7 +195,6 @@ struct kfd_event_interrupt_class {
>   };
>   
>   struct kfd_device_info {
> -	const char *asic_name;
>   	uint32_t gfx_target_version;
>   	const struct kfd_event_interrupt_class *event_interrupt_class;
>   	unsigned int max_pasid_bits;
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
> index 2d44b26b6657..d2bb35f1c58f 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
> @@ -1370,7 +1370,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu)
>   
>   	amdgpu_amdkfd_get_cu_info(dev->gpu->adev, &cu_info);
>   
> -	strncpy(dev->node_props.name, gpu->device_info->asic_name,
> +	strncpy(dev->node_props.name, amdgpu_asic_name[gpu->adev->asic_type],
>   			KFD_TOPOLOGY_PUBLIC_NAME_SIZE);
>   
>   	dev->node_props.simd_arrays_per_engine =


More information about the amd-gfx mailing list