drm/amkfd: bail out early if no get_atc_vmid_pasid_mapping_info
Subsystems (3)
PATCH v2 1/1 drm/amkfd: bail out early if no get_atc_vmid_pasid_mapping_info
it makes no sense to continue with an undefined vmid.
Fixes d21bcfc01eb1 (drm/amdkfd: judge get_atc_vmid_pasid_mapping_info before call)
Signed-off-by Yifan Zhang <[email protected]>
Reported-by Nathan Chancellor <[email protected]>
--- .../drm/amd/amdkfd/kfd_device_queue_manager.c | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +12 -9
@@ -500,21 +500,24 @@ static int dbgdev_wave_reset_wavefronts(struct kfd_dev *dev, struct kfd_processpr_debug ("Killing all process wavefronts\n" ); +if (!dev->kfd2kgd->get_atc_vmid_pasid_mapping_info) { +pr_err ("no vmid pasid mapping supported \n" ); +return -EOPNOTSUPP ; + } +/* Scan all registers in the range ATC_VMID8_PASID_MAPPING .. * ATC_VMID15_PASID_MAPPING * to check which VMID the current process is mapped to. */ -if (dev->kfd2kgd->get_atc_vmid_pasid_mapping_info) { -for (vmid = first_vmid_to_scan; vmid <= last_vmid_to_scan; vmid++) { - status = dev->kfd2kgd->get_atc_vmid_pasid_mapping_info - (dev->adev, vmid, &queried_pasid); +for (vmid = first_vmid_to_scan; vmid <= last_vmid_to_scan; vmid++) { + status = dev->kfd2kgd->get_atc_vmid_pasid_mapping_info + (dev->adev, vmid, &queried_pasid); -if (status && queried_pasid == p->pasid) { -pr_debug ("Killing wave fronts of vmid %d and pasid 0x%x\n" , - vmid, p->pasid); -break ; - } +if (status && queried_pasid == p->pasid) { +pr_debug ("Killing wave fronts of vmid %d and pasid 0x%x\n" , + vmid, p->pasid); +break ; } }
Signature · 1 line
2.25.1
Am 2022-03-08 um 21:22 schrieb Yifan Zhang:
Quoted 6 lines
it makes no sense to continue with an undefined vmid.
Fixes d21bcfc01eb1 (drm/amdkfd: judge get_atc_vmid_pasid_mapping_info before call)Signed-off-by Yifan Zhang <[email protected]>Reported-by Nathan Chancellor <[email protected]>
Reviewed-by Felix Kuehling <[email protected]>
Quoted 42 lines
--- .../drm/amd/amdkfd/kfd_device_queue_manager.c | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +12
-9@@ -500,21 +500,24 @@ static int dbgdev_wave_reset_wavefronts(struct kfd_dev *dev, struct kfd_processpr_debug ("Killing all process wavefronts\n" ); +if (!dev->kfd2kgd->get_atc_vmid_pasid_mapping_info) { +pr_err ("no vmid pasid mapping supported \n" ); +return -EOPNOTSUPP ; + } +/* Scan all registers in the range ATC_VMID8_PASID_MAPPING .. * ATC_VMID15_PASID_MAPPING * to check which VMID the current process is mapped to. */ -if (dev->kfd2kgd->get_atc_vmid_pasid_mapping_info) { -for (vmid = first_vmid_to_scan; vmid <= last_vmid_to_scan; vmid++) { - status = dev->kfd2kgd->get_atc_vmid_pasid_mapping_info - (dev->adev, vmid, &queried_pasid); +for (vmid = first_vmid_to_scan; vmid <= last_vmid_to_scan; vmid++) { + status = dev->kfd2kgd->get_atc_vmid_pasid_mapping_info + (dev->adev, vmid, &queried_pasid); -if (status && queried_pasid == p->pasid) { -pr_debug ("Killing wave fronts of vmid %d and pasid 0x%x\n" , - vmid, p->pasid); -break ; - } +if (status && queried_pasid == p->pasid) { +pr_debug ("Killing wave fronts of vmid %d and pasid 0x%x\n" , + vmid, p->pasid); +break ; } }
Quoted 6 lines · Yifan Zhang
it makes no sense to continue with an undefined vmid.
Fixes d21bcfc01eb1 (drm/amdkfd: judge get_atc_vmid_pasid_mapping_info before call)Signed-off-by Yifan Zhang <[email protected]>Reported-by Nathan Chancellor <[email protected]>
Thank you for the quick fix!
Reviewed-by Nathan Chancellor <[email protected]>
Quoted 45 lines
--- .../drm/amd/amdkfd/kfd_device_queue_manager.c | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +12
-9@@ -500,21 +500,24 @@ static int dbgdev_wave_reset_wavefronts(struct kfd_dev *dev, struct kfd_processpr_debug ("Killing all process wavefronts\n" ); +if (!dev->kfd2kgd->get_atc_vmid_pasid_mapping_info) { +pr_err ("no vmid pasid mapping supported \n" ); +return -EOPNOTSUPP ; + } +/* Scan all registers in the range ATC_VMID8_PASID_MAPPING .. * ATC_VMID15_PASID_MAPPING * to check which VMID the current process is mapped to. */ -if (dev->kfd2kgd->get_atc_vmid_pasid_mapping_info) { -for (vmid = first_vmid_to_scan; vmid <= last_vmid_to_scan; vmid++) { - status = dev->kfd2kgd->get_atc_vmid_pasid_mapping_info - (dev->adev, vmid, &queried_pasid); +for (vmid = first_vmid_to_scan; vmid <= last_vmid_to_scan; vmid++) { + status = dev->kfd2kgd->get_atc_vmid_pasid_mapping_info + (dev->adev, vmid, &queried_pasid); -if (status && queried_pasid == p->pasid) { -pr_debug ("Killing wave fronts of vmid %d and pasid 0x%x\n" , - vmid, p->pasid); -break ; - } +if (status && queried_pasid == p->pasid) { +pr_debug ("Killing wave fronts of vmid %d and pasid 0x%x\n" , + vmid, p->pasid); +break ; } }Signature · 1 line
2.25.1