]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/amdkfd: replace asic_name with amdgpu_asic_name
authorGraham Sider <Graham.Sider@amd.com>
Thu, 11 Nov 2021 16:28:45 +0000 (11:28 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 1 Dec 2021 21:15:29 +0000 (16:15 -0500)
device_info->asic_name and amdgpu_asic_name[adev->asic_type] both
provide asic name strings, with the only difference being casing.
Remove asic_name from device_info and replace sysfs entry with lowercase
amdgpu_asic_name[]. Ensures string is null-terminated so that this
doesn't break if dev->node_props.name ever gets set anywhere else.

Signed-off-by: Graham Sider <Graham.Sider@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_device.c
drivers/gpu/drm/amd/amdkfd/kfd_priv.h
drivers/gpu/drm/amd/amdkfd/kfd_topology.c

index e1294fba0c265917fbbd189d5a6fa4b6996e64cb..e11fc4e20c324d4eb2dc19831ab2961e8c0cd494 100644 (file)
@@ -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,
index 7ea5289419510a16bcd01ae27d7ed161ce6535d1..0d6d1fe1481bd0edab91193698854e70cfcce756 100644 (file)
@@ -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;
index 2d44b26b66576fbbc83dfd3f5d0b386a089e6819..d6aa27b1ae3314d80d39064543dc1c9f13934362 100644 (file)
@@ -1285,6 +1285,8 @@ int kfd_topology_add_device(struct kfd_dev *gpu)
        void *crat_image = NULL;
        size_t image_size = 0;
        int proximity_domain;
+       int i;
+       const char *asic_name = amdgpu_asic_name[gpu->adev->asic_type];
 
        INIT_LIST_HEAD(&temp_topology_device_list);
 
@@ -1370,8 +1372,12 @@ 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,
-                       KFD_TOPOLOGY_PUBLIC_NAME_SIZE);
+       for (i = 0; i < KFD_TOPOLOGY_PUBLIC_NAME_SIZE-1; i++) {
+               dev->node_props.name[i] = __tolower(asic_name[i]);
+               if (asic_name[i] == '\0')
+                       break;
+       }
+       dev->node_props.name[i] = '\0';
 
        dev->node_props.simd_arrays_per_engine =
                cu_info.num_shader_arrays_per_engine;