drm/amdkfd: convert misc checks to IP version checking
Switch to IP version checking instead of asic_type on various KFD version checks. Signed-off-by: Graham Sider <Graham.Sider@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
e4804a39ba
commit
046e674b96
|
@ -1603,7 +1603,7 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file *filep,
|
|||
}
|
||||
mutex_unlock(&p->mutex);
|
||||
|
||||
if (dev->device_info->asic_family == CHIP_ALDEBARAN) {
|
||||
if (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2)) {
|
||||
err = amdgpu_amdkfd_gpuvm_sync_memory(dev->adev,
|
||||
(struct kgd_mem *) mem, true);
|
||||
if (err) {
|
||||
|
|
|
@ -1992,7 +1992,7 @@ static int kfd_fill_gpu_direct_io_link_to_cpu(int *avail_size,
|
|||
sub_type_hdr->flags |= CRAT_IOLINK_FLAGS_BI_DIRECTIONAL;
|
||||
sub_type_hdr->io_interface_type = CRAT_IOLINK_TYPE_XGMI;
|
||||
sub_type_hdr->num_hops_xgmi = 1;
|
||||
if (kdev->adev->asic_type == CHIP_ALDEBARAN) {
|
||||
if (KFD_GC_VERSION(kdev) == IP_VERSION(9, 4, 2)) {
|
||||
sub_type_hdr->minimum_bandwidth_mbs =
|
||||
amdgpu_amdkfd_get_xgmi_bandwidth_mbytes(
|
||||
kdev->adev, NULL, true);
|
||||
|
|
|
@ -848,23 +848,23 @@ struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev, bool vf)
|
|||
static void kfd_cwsr_init(struct kfd_dev *kfd)
|
||||
{
|
||||
if (cwsr_enable && kfd->device_info->supports_cwsr) {
|
||||
if (kfd->device_info->asic_family < CHIP_VEGA10) {
|
||||
if (KFD_GC_VERSION(kfd) < IP_VERSION(9, 0, 1)) {
|
||||
BUILD_BUG_ON(sizeof(cwsr_trap_gfx8_hex) > PAGE_SIZE);
|
||||
kfd->cwsr_isa = cwsr_trap_gfx8_hex;
|
||||
kfd->cwsr_isa_size = sizeof(cwsr_trap_gfx8_hex);
|
||||
} else if (kfd->device_info->asic_family == CHIP_ARCTURUS) {
|
||||
} else if (KFD_GC_VERSION(kfd) == IP_VERSION(9, 4, 1)) {
|
||||
BUILD_BUG_ON(sizeof(cwsr_trap_arcturus_hex) > PAGE_SIZE);
|
||||
kfd->cwsr_isa = cwsr_trap_arcturus_hex;
|
||||
kfd->cwsr_isa_size = sizeof(cwsr_trap_arcturus_hex);
|
||||
} else if (kfd->device_info->asic_family == CHIP_ALDEBARAN) {
|
||||
} else if (KFD_GC_VERSION(kfd) == IP_VERSION(9, 4, 2)) {
|
||||
BUILD_BUG_ON(sizeof(cwsr_trap_aldebaran_hex) > PAGE_SIZE);
|
||||
kfd->cwsr_isa = cwsr_trap_aldebaran_hex;
|
||||
kfd->cwsr_isa_size = sizeof(cwsr_trap_aldebaran_hex);
|
||||
} else if (kfd->device_info->asic_family < CHIP_NAVI10) {
|
||||
} else if (KFD_GC_VERSION(kfd) < IP_VERSION(10, 1, 1)) {
|
||||
BUILD_BUG_ON(sizeof(cwsr_trap_gfx9_hex) > PAGE_SIZE);
|
||||
kfd->cwsr_isa = cwsr_trap_gfx9_hex;
|
||||
kfd->cwsr_isa_size = sizeof(cwsr_trap_gfx9_hex);
|
||||
} else if (kfd->device_info->asic_family < CHIP_SIENNA_CICHLID) {
|
||||
} else if (KFD_GC_VERSION(kfd) < IP_VERSION(10, 3, 0)) {
|
||||
BUILD_BUG_ON(sizeof(cwsr_trap_nv1x_hex) > PAGE_SIZE);
|
||||
kfd->cwsr_isa = cwsr_trap_nv1x_hex;
|
||||
kfd->cwsr_isa_size = sizeof(cwsr_trap_nv1x_hex);
|
||||
|
@ -885,16 +885,15 @@ static int kfd_gws_init(struct kfd_dev *kfd)
|
|||
if (kfd->dqm->sched_policy == KFD_SCHED_POLICY_NO_HWS)
|
||||
return 0;
|
||||
|
||||
if (hws_gws_support
|
||||
|| (kfd->device_info->asic_family == CHIP_VEGA10
|
||||
&& kfd->mec2_fw_version >= 0x81b3)
|
||||
|| (kfd->device_info->asic_family >= CHIP_VEGA12
|
||||
&& kfd->device_info->asic_family <= CHIP_RAVEN
|
||||
&& kfd->mec2_fw_version >= 0x1b3)
|
||||
|| (kfd->device_info->asic_family == CHIP_ARCTURUS
|
||||
&& kfd->mec2_fw_version >= 0x30)
|
||||
|| (kfd->device_info->asic_family == CHIP_ALDEBARAN
|
||||
&& kfd->mec2_fw_version >= 0x28))
|
||||
if (hws_gws_support || (KFD_IS_SOC15(kfd) &&
|
||||
((KFD_GC_VERSION(kfd) == IP_VERSION(9, 0, 1)
|
||||
&& kfd->mec2_fw_version >= 0x81b3) ||
|
||||
(KFD_GC_VERSION(kfd) <= IP_VERSION(9, 4, 0)
|
||||
&& kfd->mec2_fw_version >= 0x1b3) ||
|
||||
(KFD_GC_VERSION(kfd) == IP_VERSION(9, 4, 1)
|
||||
&& kfd->mec2_fw_version >= 0x30) ||
|
||||
(KFD_GC_VERSION(kfd) == IP_VERSION(9, 4, 2)
|
||||
&& kfd->mec2_fw_version >= 0x28))))
|
||||
ret = amdgpu_amdkfd_alloc_gws(kfd->adev,
|
||||
kfd->adev->gds.gws_size, &kfd->gws);
|
||||
|
||||
|
@ -962,10 +961,9 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
|
|||
* calculate max size of runlist packet.
|
||||
* There can be only 2 packets at once
|
||||
*/
|
||||
map_process_packet_size =
|
||||
kfd->device_info->asic_family == CHIP_ALDEBARAN ?
|
||||
map_process_packet_size = KFD_GC_VERSION(kfd) == IP_VERSION(9, 4, 2) ?
|
||||
sizeof(struct pm4_mes_map_process_aldebaran) :
|
||||
sizeof(struct pm4_mes_map_process);
|
||||
sizeof(struct pm4_mes_map_process);
|
||||
size += (KFD_MAX_NUM_OF_PROCESSES * map_process_packet_size +
|
||||
max_num_of_queues_per_device * sizeof(struct pm4_mes_map_queues)
|
||||
+ sizeof(struct pm4_mes_runlist)) * 2;
|
||||
|
|
|
@ -250,8 +250,7 @@ static int allocate_vmid(struct device_queue_manager *dqm,
|
|||
|
||||
program_sh_mem_settings(dqm, qpd);
|
||||
|
||||
if (dqm->dev->device_info->asic_family >= CHIP_VEGA10 &&
|
||||
dqm->dev->cwsr_enabled)
|
||||
if (KFD_IS_SOC15(dqm->dev) && dqm->dev->cwsr_enabled)
|
||||
program_trap_handler_settings(dqm, qpd);
|
||||
|
||||
/* qpd->page_table_base is set earlier when register_process()
|
||||
|
|
|
@ -62,7 +62,7 @@ static int update_qpd_v9(struct device_queue_manager *dqm,
|
|||
SH_MEM_ALIGNMENT_MODE_UNALIGNED <<
|
||||
SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT;
|
||||
|
||||
if (dqm->dev->device_info->asic_family == CHIP_ALDEBARAN) {
|
||||
if (KFD_GC_VERSION(dqm->dev) == IP_VERSION(9, 4, 2)) {
|
||||
/* Aldebaran can safely support different XNACK modes
|
||||
* per process
|
||||
*/
|
||||
|
|
|
@ -935,8 +935,10 @@ void kfd_signal_iommu_event(struct kfd_dev *dev, u32 pasid,
|
|||
/* Workaround on Raven to not kill the process when memory is freed
|
||||
* before IOMMU is able to finish processing all the excessive PPRs
|
||||
*/
|
||||
if (dev->device_info->asic_family != CHIP_RAVEN &&
|
||||
dev->device_info->asic_family != CHIP_RENOIR) {
|
||||
|
||||
if (KFD_GC_VERSION(dev) != IP_VERSION(9, 1, 0) &&
|
||||
KFD_GC_VERSION(dev) != IP_VERSION(9, 2, 2) &&
|
||||
KFD_GC_VERSION(dev) != IP_VERSION(9, 3, 0)) {
|
||||
mutex_lock(&p->event_mutex);
|
||||
|
||||
/* Lookup events by type and signal them */
|
||||
|
|
|
@ -938,7 +938,7 @@ int svm_migrate_init(struct amdgpu_device *adev)
|
|||
void *r;
|
||||
|
||||
/* Page migration works on Vega10 or newer */
|
||||
if (kfddev->device_info->asic_family < CHIP_VEGA10)
|
||||
if (!KFD_IS_SOC15(kfddev))
|
||||
return -EINVAL;
|
||||
|
||||
pgmap = &kfddev->pgmap;
|
||||
|
|
|
@ -1317,14 +1317,13 @@ bool kfd_process_xnack_mode(struct kfd_process *p, bool supported)
|
|||
* support the SVM APIs and don't need to be considered
|
||||
* for the XNACK mode selection.
|
||||
*/
|
||||
if (dev->device_info->asic_family < CHIP_VEGA10)
|
||||
if (!KFD_IS_SOC15(dev))
|
||||
continue;
|
||||
/* Aldebaran can always support XNACK because it can support
|
||||
* per-process XNACK mode selection. But let the dev->noretry
|
||||
* setting still influence the default XNACK mode.
|
||||
*/
|
||||
if (supported &&
|
||||
dev->device_info->asic_family == CHIP_ALDEBARAN)
|
||||
if (supported && KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2))
|
||||
continue;
|
||||
|
||||
/* GFXv10 and later GPUs do not support shader preemption
|
||||
|
@ -1332,7 +1331,7 @@ bool kfd_process_xnack_mode(struct kfd_process *p, bool supported)
|
|||
* management and memory-manager-related preemptions or
|
||||
* even deadlocks.
|
||||
*/
|
||||
if (dev->device_info->asic_family >= CHIP_NAVI10)
|
||||
if (KFD_GC_VERSION(dev) >= IP_VERSION(10, 1, 1))
|
||||
return false;
|
||||
|
||||
if (dev->noretry)
|
||||
|
|
|
@ -1051,8 +1051,8 @@ svm_range_get_pte_flags(struct amdgpu_device *adev, struct svm_range *prange,
|
|||
if (domain == SVM_RANGE_VRAM_DOMAIN)
|
||||
bo_adev = amdgpu_ttm_adev(prange->svm_bo->bo->tbo.bdev);
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_ARCTURUS:
|
||||
switch (KFD_GC_VERSION(adev->kfd.dev)) {
|
||||
case IP_VERSION(9, 4, 1):
|
||||
if (domain == SVM_RANGE_VRAM_DOMAIN) {
|
||||
if (bo_adev == adev) {
|
||||
mapping_flags |= coherent ?
|
||||
|
@ -1068,7 +1068,7 @@ svm_range_get_pte_flags(struct amdgpu_device *adev, struct svm_range *prange,
|
|||
AMDGPU_VM_MTYPE_UC : AMDGPU_VM_MTYPE_NC;
|
||||
}
|
||||
break;
|
||||
case CHIP_ALDEBARAN:
|
||||
case IP_VERSION(9, 4, 2):
|
||||
if (domain == SVM_RANGE_VRAM_DOMAIN) {
|
||||
if (bo_adev == adev) {
|
||||
mapping_flags |= coherent ?
|
||||
|
|
|
@ -1239,7 +1239,7 @@ static void kfd_set_iolink_non_coherent(struct kfd_topology_device *to_dev,
|
|||
*/
|
||||
if (inbound_link->iolink_type == CRAT_IOLINK_TYPE_PCIEXPRESS ||
|
||||
(inbound_link->iolink_type == CRAT_IOLINK_TYPE_XGMI &&
|
||||
to_dev->gpu->device_info->asic_family == CHIP_VEGA20)) {
|
||||
KFD_GC_VERSION(to_dev->gpu) == IP_VERSION(9, 4, 0))) {
|
||||
outbound_link->flags |= CRAT_IOLINK_FLAGS_NON_COHERENT;
|
||||
inbound_link->flags |= CRAT_IOLINK_FLAGS_NON_COHERENT;
|
||||
}
|
||||
|
@ -1463,7 +1463,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu)
|
|||
((dev->gpu->adev->ras_enabled & BIT(AMDGPU_RAS_BLOCK__UMC)) != 0) ?
|
||||
HSA_CAP_MEM_EDCSUPPORTED : 0;
|
||||
|
||||
if (dev->gpu->adev->asic_type != CHIP_VEGA10)
|
||||
if (KFD_GC_VERSION(dev->gpu) != IP_VERSION(9, 0, 1))
|
||||
dev->node_props.capability |= (dev->gpu->adev->ras_enabled != 0) ?
|
||||
HSA_CAP_RASEVENTNOTIFY : 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue