<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);">
Series is:</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-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> Jesse.zhang@amd.com <jesse.zhang@amd.com><br>
<b>Sent:</b> Tuesday, December 10, 2024 2:54 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Zhu, Jiadong <Jiadong.Zhu@amd.com>; Liang, Prike <Prike.Liang@amd.com>; Huang, Tim <Tim.Huang@amd.com>; Zhang, Jesse(Jie) <Jesse.Zhang@amd.com><br>
<b>Subject:</b> [PATCH 7/7 v2] drm/amdgpu/gfx11: clean up kcq reset code</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Replace kcq queue reset with existing function amdgpu_mes_reset_legacy_queue.<br>
<br>
Signed-off-by: Jesse Zhang <jesse.zhang@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 22 +++-------------------<br>
 1 file changed, 3 insertions(+), 19 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c<br>
index 67cd42031571..b741dcb0a5a3 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c<br>
@@ -6675,30 +6675,14 @@ static int gfx_v11_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid)<br>
 static int gfx_v11_0_reset_kcq(struct amdgpu_ring *ring, unsigned int vmid)<br>
 {<br>
         struct amdgpu_device *adev = ring->adev;<br>
-       int i, r = 0;<br>
+       int r = 0;<br>
 <br>
         if (amdgpu_sriov_vf(adev))<br>
                 return -EINVAL;<br>
 <br>
-       amdgpu_gfx_rlc_enter_safe_mode(adev, 0);<br>
-       mutex_lock(&adev->srbm_mutex);<br>
-       soc21_grbm_select(adev, ring->me, ring->pipe, ring->queue, 0);<br>
-       WREG32_SOC15(GC, 0, regCP_HQD_DEQUEUE_REQUEST, 0x2);<br>
-       WREG32_SOC15(GC, 0, regSPI_COMPUTE_QUEUE_RESET, 0x1);<br>
-<br>
-       /* make sure dequeue is complete*/<br>
-       for (i = 0; i < adev->usec_timeout; i++) {<br>
-               if (!(RREG32_SOC15(GC, 0, regCP_HQD_ACTIVE) & 1))<br>
-                       break;<br>
-               udelay(1);<br>
-       }<br>
-       if (i >= adev->usec_timeout)<br>
-               r = -ETIMEDOUT;<br>
-       soc21_grbm_select(adev, 0, 0, 0, 0);<br>
-       mutex_unlock(&adev->srbm_mutex);<br>
-       amdgpu_gfx_rlc_exit_safe_mode(adev, 0);<br>
+       r = amdgpu_mes_reset_legacy_queue(ring->adev, ring, vmid, true);<br>
         if (r) {<br>
-               dev_err(adev->dev, "fail to wait on hqd deactivate\n");<br>
+               dev_err(adev->dev, "reset via MMIO failed %d\n", r);<br>
                 return r;<br>
         }<br>
 <br>
-- <br>
2.25.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>