<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 style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Please use udelay directly rather than DRM_UDELAY() those old macros are deprecated and going away.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Alex<br>
</div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<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 Zhu, James <James.Zhu@amd.com><br>
<b>Sent:</b> Wednesday, June 12, 2019 8:59 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Shamis, Leonid; ckoenig.leichtzumerken@gmail.com; Zhu, James<br>
<b>Subject:</b> [PATCH v2] drm/amdgpu: explicitly set mmGDS_VMID0_BASE to 0</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">Explicitly set mmGDS_VMID0_BASE to 0. Also update<br>
GDS_VMID0_BASE/_SIZE with direct register writes.<br>
<br>
Signed-off-by: James Zhu <James.Zhu@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 35 +++++++++++++++++------------------<br>
 1 file changed, 17 insertions(+), 18 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<br>
index ba36a28..2e058bf 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<br>
@@ -305,6 +305,7 @@ static int gfx_v9_0_get_cu_info(struct amdgpu_device *adev,<br>
 static uint64_t gfx_v9_0_get_gpu_clock_counter(struct amdgpu_device *adev);<br>
 static void gfx_v9_0_select_se_sh(struct amdgpu_device *adev, u32 se_num, u32 sh_num, u32 instance);<br>
 static void gfx_v9_0_ring_emit_de_meta(struct amdgpu_ring *ring);<br>
+static u64 gfx_v9_0_ring_get_rptr_compute(struct amdgpu_ring *ring);<br>
 <br>
 static void gfx_v9_0_init_golden_registers(struct amdgpu_device *adev)<br>
 {<br>
@@ -3630,25 +3631,20 @@ static const struct soc15_reg_entry sec_ded_counter_registers[] = {<br>
    { SOC15_REG_ENTRY(GC, 0, mmSQC_EDC_CNT3), 0, 4, 6},<br>
 };<br>
 <br>
-<br>
 static int gfx_v9_0_do_edc_gds_workarounds(struct amdgpu_device *adev)<br>
 {<br>
         struct amdgpu_ring *ring = &adev->gfx.compute_ring[0];<br>
-       int r;<br>
+       int i, r;<br>
 <br>
-       r = amdgpu_ring_alloc(ring, 17);<br>
+       r = amdgpu_ring_alloc(ring, 7);<br>
         if (r) {<br>
                 DRM_ERROR("amdgpu: GDS workarounds failed to lock ring %s (%d).\n",<br>
                         ring->name, r);<br>
                 return r;<br>
         }<br>
 <br>
-       amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));<br>
-       amdgpu_ring_write(ring, WRITE_DATA_ENGINE_SEL(0) |<br>
-                               WRITE_DATA_DST_SEL(0));<br>
-       amdgpu_ring_write(ring, SOC15_REG_OFFSET(GC, 0, mmGDS_VMID0_SIZE));<br>
-       amdgpu_ring_write(ring, 0);<br>
-       amdgpu_ring_write(ring, adev->gds.gds_size);<br>
+       WREG32_SOC15(GC, 0, mmGDS_VMID0_BASE, 0x00000000);<br>
+       WREG32_SOC15(GC, 0, mmGDS_VMID0_SIZE, adev->gds.gds_size);<br>
 <br>
         amdgpu_ring_write(ring, PACKET3(PACKET3_DMA_DATA, 5));<br>
         amdgpu_ring_write(ring, (PACKET3_DMA_DATA_CP_SYNC |<br>
@@ -3662,18 +3658,21 @@ static int gfx_v9_0_do_edc_gds_workarounds(struct amdgpu_device *adev)<br>
         amdgpu_ring_write(ring, PACKET3_DMA_DATA_CMD_RAW_WAIT |<br>
                                 adev->gds.gds_size);<br>
 <br>
-       amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));<br>
-       amdgpu_ring_write(ring, WRITE_DATA_ENGINE_SEL(0) |<br>
-                               WRITE_DATA_DST_SEL(0));<br>
-       amdgpu_ring_write(ring, SOC15_REG_OFFSET(GC, 0, mmGDS_VMID0_SIZE));<br>
-       amdgpu_ring_write(ring, 0);<br>
-       amdgpu_ring_write(ring, 0x0);<br>
-<br>
         amdgpu_ring_commit(ring);<br>
 <br>
-       return 0;<br>
-}<br>
+       for (i = 0; i < adev->usec_timeout; i++) {<br>
+               if (ring->wptr == gfx_v9_0_ring_get_rptr_compute(ring))<br>
+                       break;<br>
+               DRM_UDELAY(1);<br>
+       }<br>
+<br>
+       if (i >= adev->usec_timeout)<br>
+               r = -ETIMEDOUT;<br>
+<br>
+       WREG32_SOC15(GC, 0, mmGDS_VMID0_SIZE, 0x00000000);<br>
 <br>
+       return r;<br>
+}<br>
 <br>
 static int gfx_v9_0_do_edc_gpr_workarounds(struct amdgpu_device *adev)<br>
 {<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></div>
</span></font></div>
</body>
</html>