<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Calibri;font-size:10pt;color:#008000;margin:5pt;font-style:normal;font-weight:normal;text-decoration:none;" align="Left">
[Public]<br>
</p>
<br>
<div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Acked-by: Alex Deucher <alexander.deucher@amd.com></div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Yifan Zha <Yifan.Zha@amd.com><br>
<b>Sent:</b> Friday, June 28, 2024 4:42 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Deucher, Alexander <Alexander.Deucher@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com><br>
<b>Cc:</b> Chen, Horace <Horace.Chen@amd.com>; Chang, HaiJun <HaiJun.Chang@amd.com>; Zha, YiFan(Even) <Yifan.Zha@amd.com><br>
<b>Subject:</b> [PATCH] drm/amdgpu: Set no_hw_access when VF request full GPU fails</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">[Why]<br>
If VF request full GPU access and the request failed,<br>
the VF driver can get stuck accessing registers for an extended period during<br>
the unload of KMS.<br>
<br>
[How]<br>
Set no_hw_access flag when VF request for full GPU access fails<br>
This prevents further hardware access attempts, avoiding the prolonged<br>
stuck state.<br>
<br>
Signed-off-by: Yifan Zha <Yifan.Zha@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 4 +++-<br>
 1 file changed, 3 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c<br>
index ccb3d041c2b2..111c380f929b 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c<br>
@@ -86,8 +86,10 @@ int amdgpu_virt_request_full_gpu(struct amdgpu_device *adev, bool init)<br>
 <br>
         if (virt->ops && virt->ops->req_full_gpu) {<br>
                 r = virt->ops->req_full_gpu(adev, init);<br>
-               if (r)<br>
+               if (r) {<br>
+                       adev->no_hw_access = true;<br>
                         return r;<br>
+               }<br>
 <br>
                 adev->virt.caps &= ~AMDGPU_SRIOV_CAPS_RUNTIME;<br>
         }<br>
-- <br>
2.25.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>