Skip to contentSkip to conversation

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

PATCH In review James Zhu 5 participants 8 messages Nov 2, 2021 – Nov 3, 2021

Subsystems (3)
lore
Share & tools
lore

James Zhu

author
#0 lore raw

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

To revert wrong merge during rebase.
This reverts commit afd18180c07026f94a80ff024acef5f4159084a4.

---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -3
index 7677ced16a27..be26c4016ade 100644
@@ -1031,9 +1031,6 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
 
 	svm_migrate_init(kfd->adev);
 
-	if(kgd2kfd_resume_iommu(kfd))
-		goto device_iommu_error;
-
 	if (kfd_resume(kfd))
 		goto kfd_resume_error;
 
Signature · 1 line
2.25.1
author
#1 lore raw

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

From: Yifan Zhang <[email protected]>

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 e56bc925afcf..f77823ce7ae8 100644
@@ -2398,10 +2398,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 be26c4016ade..7677ced16a27 100644
@@ -1031,6 +1031,9 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
 
 	svm_migrate_init(kfd->adev);
 
+	if(kgd2kfd_resume_iommu(kfd))
+		goto device_iommu_error;
+
 	if (kfd_resume(kfd))
 		goto kfd_resume_error;
 
Signature · 1 line
2.25.1
#2 lore raw

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

Quoted 34 lines · James Zhu

From: Yifan Zhang <[email protected]>

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 e56bc925afcf..f77823ce7ae8 100644
@@ -2398,10 +2398,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 +0 -0
index be26c4016ade..7677ced16a27 100644

drivers/gpu/drm/amd/amdkfd/kfd_device.c bool kgd2kfd_device_init(struct kfd_dev *kfd, · line 1036

Quoted 6 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +3 -0
@@ -1031,6 +1031,9 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
 
  	svm_migrate_init(kfd->adev);
 
+	if(kgd2kfd_resume_iommu(kfd))
+		goto device_iommu_error;
+

This also brings a duplicate iommu resume in the reset path -
https://elixir.bootlin.com/linux/v5.15/source/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c#L4612

Thanks,
Lijo

Quoted 4 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -0
  	if (kfd_resume(kfd))
  		goto kfd_resume_error;
 
#3 lore raw

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

Quoted 35 lines · Lijo
Quoted 32 lines · James Zhu

From: Yifan Zhang <[email protected]>

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 -3
index e56bc925afcf..f77823ce7ae8 100644
@@ -2398,10 +2398,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 +0 -0
index be26c4016ade..7677ced16a27 100644
Quoted 9 lines

drivers/gpu/drm/amd/amdkfd/kfd_device.c bool kgd2kfd_device_init(struct kfd_dev *kfd, · line 1034

Quoted 5 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +2 -0
@@ -1031,6 +1031,9 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
         svm_migrate_init(kfd->adev);
   +    if(kgd2kfd_resume_iommu(kfd))
+        goto device_iommu_error;
+

This also brings a duplicate iommu resume in the reset path -
https://elixir.bootlin.com/linux/v5.15/source/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c#L4612

[JZ] Hi Lijo, please help clarify this duplicate case.

Thanks!

James

Quoted 6 lines

Thanks,
Lijo

Quoted 3 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -0
       if (kfd_resume(kfd))
           goto kfd_resume_error;
 
#5 lore raw
In reply to James Zhu
Quoted 3 lines · James Zhu

To revert wrong merge during rebase.
This reverts commit afd18180c07026f94a80ff024acef5f4159084a4.

Missing your signed-off-by. Might be better to just merge these two patches into one unless they are individually applicable to different kernels (e.g., 5.15 vs drm-next). Also these will probably fix the following:

Alex

Quoted 21 lines
---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -4
index 7677ced16a27..be26c4016ade 100644
@@ -1031,9 +1031,6 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
 
        svm_migrate_init(kfd->adev);
 
-       if(kgd2kfd_resume_iommu(kfd))
-               goto device_iommu_error;
-
        if (kfd_resume(kfd))
                goto kfd_resume_error;
 
--

2.25.1

author
#6 lore raw

[AMD Official Use Only]

Hi Alex

Sure, Let me check it can be merged into one patch.

Thanks & Best Regards!

James Zhu

________________________________
From: Alex Deucher <[email protected]>
Sent: Tuesday, November 2, 2021 4:34 PM
To: Zhu, James <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>; Zhang, Yifan <[email protected]>; Zhu, James <[email protected]>; Ken Moffat <[email protected]>
Subject: Re: [PATCH 1/2] Revert "drm/amdkfd: fix boot failure when iommu is disabled in Picasso."

Quoted 3 lines · James Zhu

To revert wrong merge during rebase.
This reverts commit afd18180c07026f94a80ff024acef5f4159084a4.

Missing your signed-off-by. Might be better to just merge these two patches into one unless they are individually applicable to different kernels (e.g., 5.15 vs drm-next). Also these will probably fix the following:

Alex

Quoted 21 lines
---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -4
index 7677ced16a27..be26c4016ade 100644
@@ -1031,9 +1031,6 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
 
        svm_migrate_init(kfd->adev);
 
-       if(kgd2kfd_resume_iommu(kfd))
-               goto device_iommu_error;
-
        if (kfd_resume(kfd))
                goto kfd_resume_error;
 
--

2.25.1

#7 lore raw
Quoted 5 lines · James

[AMD Official Use Only]

Hi Alex

Quoted 8 lines

Sure, Let me check it can be merged into one patch.

Thanks & Best Regards!

James Zhu

Hi James,

I'm trying to apply these to 5.15.0 (using the dry-run option of traditional patch, kernel source is from the tarball).

the first one fails:

Reversed (or previously applied) patch detected! Assume -R? [n]

it will revert:
Hunk #1 succeeded at 924 with fuzz 2 (offset -107 lines).

In anything connected to the kernel, fuzz on a patch worries me. Should I apply this with patch -p1 -R ?

For the second patch:

checking file drivers/gpu/drm/amd/amdgpu/amdgpu_device.c Hunk #1 succeeded at 2432 (offset 34 lines). checking file drivers/gpu/drm/amd/amdkfd/kfd_device.c Hunk #1 succeeded at 924 with fuzz 2 (offset -107 lines).

Again, note the fuzz in kfd_device.c.

Using 'git apply --check' instead of 'patch' both patches report the same failure for kfd_device.c:

error: patch failed: drivers/gpu/drm/amd/amdkfd/kfd_device.c:1031
error: drivers/gpu/drm/amd/amdkfd/kfd_device.c: patch does not apply

ĸen

Signature · 3 lines
Vetinari smiled. "Can you keep a secret, Mister Lipwig?"
"Oh, yes, sir. I've kept lots."
"Capital. And the point is, so can I. You do not need to know.”