<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<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: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, "EmojiFont", "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Acked-by: Alex Deucher <alexander.deucher@amd.com><br>
</p>
<div style="color: rgb(0, 0, 0);">
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Emily Deng <Emily.Deng@amd.com><br>
<b>Sent:</b> Thursday, March 1, 2018 10:31 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Deng, Emily<br>
<b>Subject:</b> [PATCH] Revert "drm/amdgpu: use polling mem to set SDMA3 wptr for VF"</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">This reverts commit 2ffe31deb27579e2f2c9444e01f4d8abf385d145.<br>
The sdma wptr poll memomy doesn't have the same efficiency as<br>
doorbell, and it will make sdma hang when running tests.<br>
<br>
Change-Id: I6e334430b309b0c21aa18a08764320c7ff51e353<br>
Signed-off-by: Emily Deng <Emily.Deng@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h |  1 -<br>
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c   | 27 ++++++++-------------------<br>
 2 files changed, 8 insertions(+), 20 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h<br>
index 102dad3..5dcf98b 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h<br>
@@ -186,7 +186,6 @@ struct amdgpu_ring {<br>
         uint64_t                eop_gpu_addr;<br>
         u32                     doorbell_index;<br>
         bool                    use_doorbell;<br>
-       bool                    use_pollmem;<br>
         unsigned                wptr_offs;<br>
         unsigned                fence_offs;<br>
         uint64_t                current_ctx;<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c<br>
index 521978c..d3fb3ca 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c<br>
@@ -355,7 +355,7 @@ static uint64_t sdma_v3_0_ring_get_wptr(struct amdgpu_ring *ring)<br>
         struct amdgpu_device *adev = ring->adev;<br>
         u32 wptr;<br>
 <br>
-       if (ring->use_doorbell || ring->use_pollmem) {<br>
+       if (ring->use_doorbell) {<br>
                 /* XXX check if swapping is necessary on BE */<br>
                 wptr = ring->adev->wb.wb[ring->wptr_offs] >> 2;<br>
         } else {<br>
@@ -380,13 +380,10 @@ static void sdma_v3_0_ring_set_wptr(struct amdgpu_ring *ring)<br>
 <br>
         if (ring->use_doorbell) {<br>
                 u32 *wb = (u32 *)&adev->wb.wb[ring->wptr_offs];<br>
+<br>
                 /* XXX check if swapping is necessary on BE */<br>
                 WRITE_ONCE(*wb, (lower_32_bits(ring->wptr) << 2));<br>
                 WDOORBELL32(ring->doorbell_index, lower_32_bits(ring->wptr) << 2);<br>
-       } else if (ring->use_pollmem) {<br>
-               u32 *wb = (u32 *)&adev->wb.wb[ring->wptr_offs];<br>
-<br>
-               WRITE_ONCE(*wb, (lower_32_bits(ring->wptr) << 2));<br>
         } else {<br>
                 int me = (ring == &ring->adev->sdma.instance[0].ring) ? 0 : 1;<br>
 <br>
@@ -719,14 +716,10 @@ static int sdma_v3_0_gfx_resume(struct amdgpu_device *adev)<br>
                 WREG32(mmSDMA0_GFX_RB_WPTR_POLL_ADDR_HI + sdma_offsets[i],<br>
                        upper_32_bits(wptr_gpu_addr));<br>
                 wptr_poll_cntl = RREG32(mmSDMA0_GFX_RB_WPTR_POLL_CNTL + sdma_offsets[i]);<br>
-               if (ring->use_pollmem)<br>
-                       wptr_poll_cntl = REG_SET_FIELD(wptr_poll_cntl,<br>
-                                                      SDMA0_GFX_RB_WPTR_POLL_CNTL,<br>
-                                                      ENABLE, 1);<br>
+               if (amdgpu_sriov_vf(adev))<br>
+                       wptr_poll_cntl = REG_SET_FIELD(wptr_poll_cntl, SDMA0_GFX_RB_WPTR_POLL_CNTL, F32_POLL_ENABLE, 1);<br>
                 else<br>
-                       wptr_poll_cntl = REG_SET_FIELD(wptr_poll_cntl,<br>
-                                                      SDMA0_GFX_RB_WPTR_POLL_CNTL,<br>
-                                                      ENABLE, 0);<br>
+                       wptr_poll_cntl = REG_SET_FIELD(wptr_poll_cntl, SDMA0_GFX_RB_WPTR_POLL_CNTL, F32_POLL_ENABLE, 0);<br>
                 WREG32(mmSDMA0_GFX_RB_WPTR_POLL_CNTL + sdma_offsets[i], wptr_poll_cntl);<br>
 <br>
                 /* enable DMA RB */<br>
@@ -1208,13 +1201,9 @@ static int sdma_v3_0_sw_init(void *handle)<br>
         for (i = 0; i < adev->sdma.num_instances; i++) {<br>
                 ring = &adev->sdma.instance[i].ring;<br>
                 ring->ring_obj = NULL;<br>
-               if (!amdgpu_sriov_vf(adev)) {<br>
-                       ring->use_doorbell = true;<br>
-                       ring->doorbell_index = (i == 0) ?<br>
-                               AMDGPU_DOORBELL_sDMA_ENGINE0 : AMDGPU_DOORBELL_sDMA_ENGINE1;<br>
-               } else {<br>
-                       ring->use_pollmem = true;<br>
-               }<br>
+               ring->use_doorbell = true;<br>
+               ring->doorbell_index = (i == 0) ?<br>
+                       AMDGPU_DOORBELL_sDMA_ENGINE0 : AMDGPU_DOORBELL_sDMA_ENGINE1;<br>
 <br>
                 sprintf(ring->name, "sdma%d", i);<br>
                 r = amdgpu_ring_init(adev, ring, 1024,<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" id="LPlnk52948" previewremoved="true">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</div>
</div>
</body>
</html>