<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">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Acked-by: Alex Deucher <alexander.deucher@amd.com><br>
</p>
</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> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Zhou, Tiecheng <Tiecheng.Zhou@amd.com><br>
<b>Sent:</b> Friday, December 28, 2018 12:36:17 AM<br>
<b>To:</b> Zhou, Tiecheng; amd-gfx@lists.freedesktop.org<br>
<b>Subject:</b> RE: [PATCH] drm/amdgpu/gfx_v8_0: Reorder the gfx, kiq and kcq rings test sequence</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Ping...<br>
<br>
-----Original Message-----<br>
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Tiecheng Zhou<br>
Sent: Thursday, December 27, 2018 4:15 PM<br>
To: amd-gfx@lists.freedesktop.org<br>
Cc: Zhou, Tiecheng <Tiecheng.Zhou@amd.com><br>
Subject: [PATCH] drm/amdgpu/gfx_v8_0: Reorder the gfx, kiq and kcq rings test sequence<br>
<br>
The kiq ring and the very first compute ring may fail occasionally if they are tested directly following kiq_kcq_enable.<br>
<br>
Insert the gfx ring test before kiq ring test to delay the kiq and kcq ring tests will fix the issue.<br>
<br>
Signed-off-by: Tiecheng Zhou <Tiecheng.Zhou@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 48 +++++++++++++++++++++++++----------<br>
 1 file changed, 35 insertions(+), 13 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c<br>
index 381f593b..164ffc9 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c<br>
@@ -4278,9 +4278,8 @@ static int gfx_v8_0_cp_gfx_resume(struct amdgpu_device *adev)<br>
         amdgpu_ring_clear_ring(ring);<br>
         gfx_v8_0_cp_gfx_start(adev);<br>
         ring->sched.ready = true;<br>
-       r = amdgpu_ring_test_helper(ring);<br>
 <br>
-       return r;<br>
+       return 0;<br>
 }<br>
 <br>
 static void gfx_v8_0_cp_compute_enable(struct amdgpu_device *adev, bool enable) @@ -4369,10 +4368,9 @@ static int gfx_v8_0_kiq_kcq_enable(struct amdgpu_device *adev)<br>
                 amdgpu_ring_write(kiq_ring, upper_32_bits(wptr_addr));<br>
         }<br>
 <br>
-       r = amdgpu_ring_test_helper(kiq_ring);<br>
-       if (r)<br>
-               DRM_ERROR("KCQ enable failed\n");<br>
-       return r;<br>
+       amdgpu_ring_commit(kiq_ring);<br>
+<br>
+       return 0;<br>
 }<br>
 <br>
 static int gfx_v8_0_deactivate_hqd(struct amdgpu_device *adev, u32 req) @@ -4709,16 +4707,32 @@ static int gfx_v8_0_kcq_resume(struct amdgpu_device *adev)<br>
         if (r)<br>
                 goto done;<br>
 <br>
-       /* Test KCQs - reversing the order of rings seems to fix ring test failure<br>
-        * after GPU reset<br>
-        */<br>
-       for (i = adev->gfx.num_compute_rings - 1; i >= 0; i--) {<br>
+done:<br>
+       return r;<br>
+}<br>
+<br>
+static int gfx_v8_0_cp_test_all_rings(struct amdgpu_device *adev) {<br>
+       int r, i;<br>
+       struct amdgpu_ring *ring;<br>
+<br>
+       /* collect all the ring_tests here, gfx, kiq, compute */<br>
+       ring = &adev->gfx.gfx_ring[0];<br>
+       r = amdgpu_ring_test_helper(ring);<br>
+       if (r)<br>
+               return r;<br>
+<br>
+       ring = &adev->gfx.kiq.ring;<br>
+       r = amdgpu_ring_test_helper(ring);<br>
+       if (r)<br>
+               return r;<br>
+<br>
+       for (i = 0; i < adev->gfx.num_compute_rings; i++) {<br>
                 ring = &adev->gfx.compute_ring[i];<br>
-               r = amdgpu_ring_test_helper(ring);<br>
+               amdgpu_ring_test_helper(ring);<br>
         }<br>
 <br>
-done:<br>
-       return r;<br>
+       return 0;<br>
 }<br>
 <br>
 static int gfx_v8_0_cp_resume(struct amdgpu_device *adev) @@ -4739,6 +4753,11 @@ static int gfx_v8_0_cp_resume(struct amdgpu_device *adev)<br>
         r = gfx_v8_0_kcq_resume(adev);<br>
         if (r)<br>
                 return r;<br>
+<br>
+       r = gfx_v8_0_cp_test_all_rings(adev);<br>
+       if (r)<br>
+               return r;<br>
+<br>
         gfx_v8_0_enable_gui_idle_interrupt(adev, true);<br>
 <br>
         return 0;<br>
@@ -5056,6 +5075,7 @@ static int gfx_v8_0_post_soft_reset(void *handle)  {<br>
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;<br>
         u32 grbm_soft_reset = 0;<br>
+       struct amdgpu_ring *ring;<br>
 <br>
         if ((!adev->gfx.grbm_soft_reset) &&<br>
             (!adev->gfx.srbm_soft_reset))<br>
@@ -5086,6 +5106,8 @@ static int gfx_v8_0_post_soft_reset(void *handle)<br>
             REG_GET_FIELD(grbm_soft_reset, GRBM_SOFT_RESET, SOFT_RESET_GFX))<br>
                 gfx_v8_0_cp_gfx_resume(adev);<br>
 <br>
+       gfx_v8_0_cp_test_all_rings(adev);<br>
+<br>
         adev->gfx.rlc.funcs->start(adev);<br>
 <br>
         return 0;<br>
--<br>
2.7.4<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</body>
</html>