Skip to contentSkip to conversation

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

PATCH In review Yifan Zha 2 participants 2 messages Jun 28, 2024

Subsystems (2)
lore
Share & tools
lore

Yifan Zha

author
#0 lore raw

PATCH 1/1 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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +3 -1
index ccb3d041c2b2..111c380f929b 100644
@@ -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;
 	}
Signature · 1 line
2.25.1
maintainer Acked-by on v1 1/1
#1 lore raw

[Public]

________________________________
From: Yifan Zha <[email protected]>
Sent: Friday, June 28, 2024 4:42 AM
To: [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>
Cc: Chen, Horace <[email protected]>; Chang, HaiJun <[email protected]>; Zha, YiFan(Even) <[email protected]>
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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +3 -1
index ccb3d041c2b2..111c380f929b 100644
@@ -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