Skip to contentSkip to conversation

drm/amdkfd: fix boot failure when iommu is disabled in Picasso.

PATCH Superseded Yifan Zhang 2 participants 3 messages Oct 11, 2021 – Oct 12, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/amdkfd: fix boot failure when iommu is disabled in Picasso.

When IOMMU disabled in sbios and kfd in iommuv2 path, iommuv2 init will fail. But this failure should not block amdgpu driver init.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ----
 drivers/gpu/drm/amd/amdkfd/kfd_device.c    | 3 +++
 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -4
index af9bdf16eefd..9dfcef2015c8 100644
@@ -2432,10 +2432,6 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
 	if (!adev->gmc.xgmi.pending_reset)
 		amdgpu_amdkfd_device_init(adev);
 
-	r = amdgpu_amdkfd_resume_iommu(adev);
-	if (r)
-		goto init_failed;
-
 	amdgpu_fru_get_product_info(adev);
 
 init_failed:
drivers/gpu/drm/amd/amdkfd/kfd_device.c +3 -0
index 4a416231b24c..bb652ee35c25 100644
@@ -920,6 +920,9 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
 		goto device_iommu_error;
 	}
 
+	if(kgd2kfd_resume_iommu(kfd))
+		goto device_iommu_error;
+
 	kfd_cwsr_init(kfd);
 
 	svm_migrate_init((struct amdgpu_device *)kfd->kgd);
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 drm/amdkfd: fix resume error when iommu disabled in Picasso

When IOMMU disabled in sbios and kfd in iommuv2 path, IOMMU resume failure blocks system resume. Don't allow kfd to use iommu v2 when iommu is disabled.

---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +1 -0
index bb652ee35c25..1fadc9fb168d 100644
@@ -916,6 +916,7 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
 	kfd_double_confirm_iommu_support(kfd);
 
 	if (kfd_iommu_device_init(kfd)) {
+		kfd->use_iommu_v2 = false;
 		dev_err(kfd_device, "Error initializing iommuv2\n");
 		goto device_iommu_error;
 	}
Signature · 1 line
2.25.1
Tested-by youling on v1 1/2
#2 lore raw
In reply to Yifan Zhang

[AMD Official Use Only]

________________________________
From: Zhang, Yifan <[email protected]>
Sent: Monday, October 11, 2021 8:57 AM
To: [email protected] <[email protected]>
Cc: Kuehling, Felix <[email protected]>; Zhu, James <[email protected]>; [email protected] <[email protected]>; Zhang, Yifan <[email protected]>
Subject: [PATCH 1/2] drm/amdkfd: fix boot failure when iommu is disabled in Picasso.

When IOMMU disabled in sbios and kfd in iommuv2 path, iommuv2 init will fail. But this failure should not block amdgpu driver init.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ----
 drivers/gpu/drm/amd/amdkfd/kfd_device.c    | 3 +++
 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -4
index af9bdf16eefd..9dfcef2015c8 100644
@@ -2432,10 +2432,6 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
         if (!adev->gmc.xgmi.pending_reset)
                 amdgpu_amdkfd_device_init(adev);
 
-       r = amdgpu_amdkfd_resume_iommu(adev);
-       if (r)
-               goto init_failed;
-
         amdgpu_fru_get_product_info(adev);
 
 init_failed:
drivers/gpu/drm/amd/amdkfd/kfd_device.c +3 -0
index 4a416231b24c..bb652ee35c25 100644
@@ -920,6 +920,9 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
                 goto device_iommu_error;
         }
 
+       if(kgd2kfd_resume_iommu(kfd))
+               goto device_iommu_error;
+
         kfd_cwsr_init(kfd);
 
         svm_migrate_init((struct amdgpu_device *)kfd->kgd);

[JZ] Move the above change to here, the device init sequence will be closer to initial design. --
2.25.1