aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorHawking Zhang <[email protected]>2023-05-11 17:01:03 +0800
committerAlex Deucher <[email protected]>2023-06-09 10:37:21 -0400
commit0409022c15623d91c112e51f38cb62633becd432 (patch)
treee3d2ba7ba46886adec135dfec5fc4644989aaaa7 /drivers/gpu
parentf464c5dd4d918d4dd84eda7e68d4a0b6d41fe37f (diff)
drm/amdkfd: Fix null ptr access
Avoid access null xcp_mgr pointer. Signed-off-by: Hawking Zhang <[email protected]> Reviewed-by: Lijo Lazar <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_device.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
index bf32e547182c..2cfef3f9456f 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
@@ -644,12 +644,14 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
* If the VMID range changes for GFX9.4.3, then this code MUST be
* revisited.
*/
- partition_mode = amdgpu_xcp_query_partition_mode(kfd->adev->xcp_mgr, AMDGPU_XCP_FL_LOCKED);
- if (KFD_GC_VERSION(kfd) == IP_VERSION(9, 4, 3) &&
- partition_mode == AMDGPU_CPX_PARTITION_MODE &&
- kfd->num_nodes != 1) {
- vmid_num_kfd /= 2;
- first_vmid_kfd = last_vmid_kfd + 1 - vmid_num_kfd*2;
+ if (kfd->adev->xcp_mgr) {
+ partition_mode = amdgpu_xcp_query_partition_mode(kfd->adev->xcp_mgr,
+ AMDGPU_XCP_FL_LOCKED);
+ if (partition_mode == AMDGPU_CPX_PARTITION_MODE &&
+ kfd->num_nodes != 1) {
+ vmid_num_kfd /= 2;
+ first_vmid_kfd = last_vmid_kfd + 1 - vmid_num_kfd*2;
+ }
}
/* Verify module parameters regarding mapped process number*/