[PATCH] drm/amdgpu: Set no_hw_access when VF request full GPU fails

Deucher, Alexander Alexander.Deucher at amd.com
Fri Jun 28 13:07:08 UTC 2024


[Public]

Acked-by: Alex Deucher <alexander.deucher at amd.com>
________________________________
From: Yifan Zha <Yifan.Zha at amd.com>
Sent: Friday, June 28, 2024 4:42 AM
To: amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>; Deucher, Alexander <Alexander.Deucher at amd.com>; Zhang, Hawking <Hawking.Zhang at amd.com>
Cc: Chen, Horace <Horace.Chen at amd.com>; Chang, HaiJun <HaiJun.Chang at amd.com>; Zha, YiFan(Even) <Yifan.Zha at amd.com>
Subject: [PATCH] drm/amdgpu: Set no_hw_access when VF request full GPU fails

[Why]
If VF request full GPU access and the request failed,
the VF driver can get stuck accessing registers for an extended period during
the unload of KMS.

[How]
Set no_hw_access flag when VF request for full GPU access fails
This prevents further hardware access attempts, avoiding the prolonged
stuck state.

Signed-off-by: Yifan Zha <Yifan.Zha at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index ccb3d041c2b2..111c380f929b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
@@ -86,8 +86,10 @@ int amdgpu_virt_request_full_gpu(struct amdgpu_device *adev, bool init)

         if (virt->ops && virt->ops->req_full_gpu) {
                 r = virt->ops->req_full_gpu(adev, init);
-               if (r)
+               if (r) {
+                       adev->no_hw_access = true;
                         return r;
+               }

                 adev->virt.caps &= ~AMDGPU_SRIOV_CAPS_RUNTIME;
         }
--
2.25.1

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20240628/c8f3dcde/attachment.htm>


More information about the amd-gfx mailing list