Commit e4804a39 authored by Graham Sider's avatar Graham Sider Committed by Alex Deucher

drm/amdkfd: convert switches to IP version checking

Converts KFD switch statements to use IP version checking instead
of asic_type.
Signed-off-by: default avatarGraham Sider <Graham.Sider@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent dd0ae064
...@@ -1377,68 +1377,72 @@ static int kfd_fill_gpu_cache_info(struct kfd_dev *kdev, ...@@ -1377,68 +1377,72 @@ static int kfd_fill_gpu_cache_info(struct kfd_dev *kdev,
pcache_info = vegam_cache_info; pcache_info = vegam_cache_info;
num_of_cache_types = ARRAY_SIZE(vegam_cache_info); num_of_cache_types = ARRAY_SIZE(vegam_cache_info);
break; break;
case CHIP_VEGA10: default:
switch(KFD_GC_VERSION(kdev)) {
case IP_VERSION(9, 0, 1):
pcache_info = vega10_cache_info; pcache_info = vega10_cache_info;
num_of_cache_types = ARRAY_SIZE(vega10_cache_info); num_of_cache_types = ARRAY_SIZE(vega10_cache_info);
break; break;
case CHIP_VEGA12: case IP_VERSION(9, 2, 1):
pcache_info = vega12_cache_info; pcache_info = vega12_cache_info;
num_of_cache_types = ARRAY_SIZE(vega12_cache_info); num_of_cache_types = ARRAY_SIZE(vega12_cache_info);
break; break;
case CHIP_VEGA20: case IP_VERSION(9, 4, 0):
case CHIP_ARCTURUS: case IP_VERSION(9, 4, 1):
pcache_info = vega20_cache_info; pcache_info = vega20_cache_info;
num_of_cache_types = ARRAY_SIZE(vega20_cache_info); num_of_cache_types = ARRAY_SIZE(vega20_cache_info);
break; break;
case CHIP_ALDEBARAN: case IP_VERSION(9, 4, 2):
pcache_info = aldebaran_cache_info; pcache_info = aldebaran_cache_info;
num_of_cache_types = ARRAY_SIZE(aldebaran_cache_info); num_of_cache_types = ARRAY_SIZE(aldebaran_cache_info);
break; break;
case CHIP_RAVEN: case IP_VERSION(9, 1, 0):
case IP_VERSION(9, 2, 2):
pcache_info = raven_cache_info; pcache_info = raven_cache_info;
num_of_cache_types = ARRAY_SIZE(raven_cache_info); num_of_cache_types = ARRAY_SIZE(raven_cache_info);
break; break;
case CHIP_RENOIR: case IP_VERSION(9, 3, 0):
pcache_info = renoir_cache_info; pcache_info = renoir_cache_info;
num_of_cache_types = ARRAY_SIZE(renoir_cache_info); num_of_cache_types = ARRAY_SIZE(renoir_cache_info);
break; break;
case CHIP_NAVI10: case IP_VERSION(10, 1, 10):
case CHIP_NAVI12: case IP_VERSION(10, 1, 2):
case CHIP_CYAN_SKILLFISH: case IP_VERSION(10, 1, 3):
pcache_info = navi10_cache_info; pcache_info = navi10_cache_info;
num_of_cache_types = ARRAY_SIZE(navi10_cache_info); num_of_cache_types = ARRAY_SIZE(navi10_cache_info);
break; break;
case CHIP_NAVI14: case IP_VERSION(10, 1, 1):
pcache_info = navi14_cache_info; pcache_info = navi14_cache_info;
num_of_cache_types = ARRAY_SIZE(navi14_cache_info); num_of_cache_types = ARRAY_SIZE(navi14_cache_info);
break; break;
case CHIP_SIENNA_CICHLID: case IP_VERSION(10, 3, 0):
pcache_info = sienna_cichlid_cache_info; pcache_info = sienna_cichlid_cache_info;
num_of_cache_types = ARRAY_SIZE(sienna_cichlid_cache_info); num_of_cache_types = ARRAY_SIZE(sienna_cichlid_cache_info);
break; break;
case CHIP_NAVY_FLOUNDER: case IP_VERSION(10, 3, 2):
pcache_info = navy_flounder_cache_info; pcache_info = navy_flounder_cache_info;
num_of_cache_types = ARRAY_SIZE(navy_flounder_cache_info); num_of_cache_types = ARRAY_SIZE(navy_flounder_cache_info);
break; break;
case CHIP_DIMGREY_CAVEFISH: case IP_VERSION(10, 3, 4):
pcache_info = dimgrey_cavefish_cache_info; pcache_info = dimgrey_cavefish_cache_info;
num_of_cache_types = ARRAY_SIZE(dimgrey_cavefish_cache_info); num_of_cache_types = ARRAY_SIZE(dimgrey_cavefish_cache_info);
break; break;
case CHIP_VANGOGH: case IP_VERSION(10, 3, 1):
pcache_info = vangogh_cache_info; pcache_info = vangogh_cache_info;
num_of_cache_types = ARRAY_SIZE(vangogh_cache_info); num_of_cache_types = ARRAY_SIZE(vangogh_cache_info);
break; break;
case CHIP_BEIGE_GOBY: case IP_VERSION(10, 3, 5):
pcache_info = beige_goby_cache_info; pcache_info = beige_goby_cache_info;
num_of_cache_types = ARRAY_SIZE(beige_goby_cache_info); num_of_cache_types = ARRAY_SIZE(beige_goby_cache_info);
break; break;
case CHIP_YELLOW_CARP: case IP_VERSION(10, 3, 3):
pcache_info = yellow_carp_cache_info; pcache_info = yellow_carp_cache_info;
num_of_cache_types = ARRAY_SIZE(yellow_carp_cache_info); num_of_cache_types = ARRAY_SIZE(yellow_carp_cache_info);
break; break;
default: default:
return -EINVAL; return -EINVAL;
} }
}
*size_filled = 0; *size_filled = 0;
*num_of_entries = 0; *num_of_entries = 0;
......
...@@ -814,6 +814,10 @@ struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev, bool vf) ...@@ -814,6 +814,10 @@ struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev, bool vf)
} }
if (!device_info || !f2g) { if (!device_info || !f2g) {
if (adev->ip_versions[GC_HWIP][0])
dev_err(kfd_device, "GC IP %06x %s not supported in kfd\n",
adev->ip_versions[GC_HWIP][0], vf ? "VF" : "");
else
dev_err(kfd_device, "%s %s not supported in kfd\n", dev_err(kfd_device, "%s %s not supported in kfd\n",
amdgpu_asic_name[adev->asic_type], vf ? "VF" : ""); amdgpu_asic_name[adev->asic_type], vf ? "VF" : "");
return NULL; return NULL;
......
...@@ -1947,32 +1947,17 @@ struct device_queue_manager *device_queue_manager_init(struct kfd_dev *dev) ...@@ -1947,32 +1947,17 @@ struct device_queue_manager *device_queue_manager_init(struct kfd_dev *dev)
device_queue_manager_init_vi_tonga(&dqm->asic_ops); device_queue_manager_init_vi_tonga(&dqm->asic_ops);
break; break;
case CHIP_VEGA10:
case CHIP_VEGA12:
case CHIP_VEGA20:
case CHIP_RAVEN:
case CHIP_RENOIR:
case CHIP_ARCTURUS:
case CHIP_ALDEBARAN:
device_queue_manager_init_v9(&dqm->asic_ops);
break;
case CHIP_NAVI10:
case CHIP_NAVI12:
case CHIP_NAVI14:
case CHIP_SIENNA_CICHLID:
case CHIP_NAVY_FLOUNDER:
case CHIP_VANGOGH:
case CHIP_DIMGREY_CAVEFISH:
case CHIP_BEIGE_GOBY:
case CHIP_YELLOW_CARP:
case CHIP_CYAN_SKILLFISH:
device_queue_manager_init_v10_navi10(&dqm->asic_ops);
break;
default: default:
if (KFD_GC_VERSION(dev) >= IP_VERSION(10, 1, 1))
device_queue_manager_init_v10_navi10(&dqm->asic_ops);
else if (KFD_GC_VERSION(dev) >= IP_VERSION(9, 0, 1))
device_queue_manager_init_v9(&dqm->asic_ops);
else {
WARN(1, "Unexpected ASIC family %u", WARN(1, "Unexpected ASIC family %u",
dev->device_info->asic_family); dev->device_info->asic_family);
goto out_free; goto out_free;
} }
}
if (init_mqd_managers(dqm)) if (init_mqd_managers(dqm))
goto out_free; goto out_free;
......
...@@ -406,30 +406,15 @@ int kfd_init_apertures(struct kfd_process *process) ...@@ -406,30 +406,15 @@ int kfd_init_apertures(struct kfd_process *process)
case CHIP_VEGAM: case CHIP_VEGAM:
kfd_init_apertures_vi(pdd, id); kfd_init_apertures_vi(pdd, id);
break; break;
case CHIP_VEGA10:
case CHIP_VEGA12:
case CHIP_VEGA20:
case CHIP_RAVEN:
case CHIP_RENOIR:
case CHIP_ARCTURUS:
case CHIP_ALDEBARAN:
case CHIP_NAVI10:
case CHIP_NAVI12:
case CHIP_NAVI14:
case CHIP_SIENNA_CICHLID:
case CHIP_NAVY_FLOUNDER:
case CHIP_VANGOGH:
case CHIP_DIMGREY_CAVEFISH:
case CHIP_BEIGE_GOBY:
case CHIP_YELLOW_CARP:
case CHIP_CYAN_SKILLFISH:
kfd_init_apertures_v9(pdd, id);
break;
default: default:
if (KFD_GC_VERSION(dev) >= IP_VERSION(9, 0, 1))
kfd_init_apertures_v9(pdd, id);
else {
WARN(1, "Unexpected ASIC family %u", WARN(1, "Unexpected ASIC family %u",
dev->device_info->asic_family); dev->device_info->asic_family);
return -EINVAL; return -EINVAL;
} }
}
if (!dev->use_iommu_v2) { if (!dev->use_iommu_v2) {
/* dGPUs: the reserved space for kernel /* dGPUs: the reserved space for kernel
......
...@@ -236,32 +236,17 @@ int pm_init(struct packet_manager *pm, struct device_queue_manager *dqm) ...@@ -236,32 +236,17 @@ int pm_init(struct packet_manager *pm, struct device_queue_manager *dqm)
case CHIP_VEGAM: case CHIP_VEGAM:
pm->pmf = &kfd_vi_pm_funcs; pm->pmf = &kfd_vi_pm_funcs;
break; break;
case CHIP_VEGA10:
case CHIP_VEGA12:
case CHIP_VEGA20:
case CHIP_RAVEN:
case CHIP_RENOIR:
case CHIP_ARCTURUS:
case CHIP_NAVI10:
case CHIP_NAVI12:
case CHIP_NAVI14:
case CHIP_SIENNA_CICHLID:
case CHIP_NAVY_FLOUNDER:
case CHIP_VANGOGH:
case CHIP_DIMGREY_CAVEFISH:
case CHIP_BEIGE_GOBY:
case CHIP_YELLOW_CARP:
case CHIP_CYAN_SKILLFISH:
pm->pmf = &kfd_v9_pm_funcs;
break;
case CHIP_ALDEBARAN:
pm->pmf = &kfd_aldebaran_pm_funcs;
break;
default: default:
if (KFD_GC_VERSION(dqm->dev) == IP_VERSION(9, 4, 2))
pm->pmf = &kfd_aldebaran_pm_funcs;
else if (KFD_GC_VERSION(dqm->dev) >= IP_VERSION(9, 0, 1))
pm->pmf = &kfd_v9_pm_funcs;
else {
WARN(1, "Unexpected ASIC family %u", WARN(1, "Unexpected ASIC family %u",
dqm->dev->device_info->asic_family); dqm->dev->device_info->asic_family);
return -EINVAL; return -EINVAL;
} }
}
pm->dqm = dqm; pm->dqm = dqm;
mutex_init(&pm->lock); mutex_init(&pm->lock);
......
...@@ -1425,28 +1425,12 @@ int kfd_topology_add_device(struct kfd_dev *gpu) ...@@ -1425,28 +1425,12 @@ int kfd_topology_add_device(struct kfd_dev *gpu)
HSA_CAP_DOORBELL_TYPE_TOTALBITS_SHIFT) & HSA_CAP_DOORBELL_TYPE_TOTALBITS_SHIFT) &
HSA_CAP_DOORBELL_TYPE_TOTALBITS_MASK); HSA_CAP_DOORBELL_TYPE_TOTALBITS_MASK);
break; break;
case CHIP_VEGA10: default:
case CHIP_VEGA12: if (KFD_GC_VERSION(dev->gpu) >= IP_VERSION(9, 0, 1))
case CHIP_VEGA20:
case CHIP_RAVEN:
case CHIP_RENOIR:
case CHIP_ARCTURUS:
case CHIP_ALDEBARAN:
case CHIP_NAVI10:
case CHIP_NAVI12:
case CHIP_NAVI14:
case CHIP_SIENNA_CICHLID:
case CHIP_NAVY_FLOUNDER:
case CHIP_VANGOGH:
case CHIP_DIMGREY_CAVEFISH:
case CHIP_BEIGE_GOBY:
case CHIP_YELLOW_CARP:
case CHIP_CYAN_SKILLFISH:
dev->node_props.capability |= ((HSA_CAP_DOORBELL_TYPE_2_0 << dev->node_props.capability |= ((HSA_CAP_DOORBELL_TYPE_2_0 <<
HSA_CAP_DOORBELL_TYPE_TOTALBITS_SHIFT) & HSA_CAP_DOORBELL_TYPE_TOTALBITS_SHIFT) &
HSA_CAP_DOORBELL_TYPE_TOTALBITS_MASK); HSA_CAP_DOORBELL_TYPE_TOTALBITS_MASK);
break; else
default:
WARN(1, "Unexpected ASIC family %u", WARN(1, "Unexpected ASIC family %u",
dev->gpu->device_info->asic_family); dev->gpu->device_info->asic_family);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment