<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">Reviewed-by: Ken Wang<ken.wang@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> Junwei Zhang <Jerry.Zhang@amd.com><br>
<b>Sent:</b> Wednesday, January 10, 2018 4:18:30 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Wang, Ken; Zhang, Jerry<br>
<b>Subject:</b> [PATCH] drm/amdgpu/gfx9: fix ngg enablement to clear gds reserved memory</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 8 +++++---<br>
 1 file changed, 5 insertions(+), 3 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 ae976e3..5f2ae77 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<br>
@@ -1069,7 +1069,7 @@ static int gfx_v9_0_ngg_init(struct amdgpu_device *adev)<br>
         adev->gds.mem.total_size -= adev->gfx.ngg.gds_reserve_size;<br>
         adev->gds.mem.gfx_partition_size -= adev->gfx.ngg.gds_reserve_size;<br>
         adev->gfx.ngg.gds_reserve_addr = SOC15_REG_OFFSET(GC, 0, mmGDS_VMID0_BASE);<br>
-       adev->gfx.ngg.gds_reserve_addr += adev->gds.mem.gfx_partition_size;<br>
+       adev->gfx.ngg.gds_reserve_addr += SOC15_REG_OFFSET(GC, 0, mmGDS_VMID0_SIZE);<br>
 <br>
         /* Primitive Buffer */<br>
         r = gfx_v9_0_ngg_create_buf(adev, &adev->gfx.ngg.buf[NGG_PRIM],<br>
@@ -1181,13 +1181,15 @@ static int gfx_v9_0_ngg_en(struct amdgpu_device *adev)<br>
 <br>
         amdgpu_ring_write(ring, PACKET3(PACKET3_DMA_DATA, 5));<br>
         amdgpu_ring_write(ring, (PACKET3_DMA_DATA_CP_SYNC |<br>
+                               PACKET3_DMA_DATA_DST_SEL(0) |<br>
                                 PACKET3_DMA_DATA_SRC_SEL(2)));<br>
         amdgpu_ring_write(ring, 0);<br>
         amdgpu_ring_write(ring, 0);<br>
         amdgpu_ring_write(ring, adev->gfx.ngg.gds_reserve_addr);<br>
         amdgpu_ring_write(ring, 0);<br>
-       amdgpu_ring_write(ring, adev->gfx.ngg.gds_reserve_size);<br>
-<br>
+       amdgpu_ring_write(ring, PACKET3_DMA_DATA_CMD_DAS |<br>
+                               PACKET3_DMA_DATA_CMD_RAW_WAIT |<br>
+                               adev->gfx.ngg.gds_reserve_size);<br>
 <br>
         gfx_v9_0_write_data_to_reg(ring, 0, false,<br>
                                    SOC15_REG_OFFSET(GC, 0, mmGDS_VMID0_SIZE), 0);<br>
-- <br>
1.9.1<br>
<br>
</div>
</span></font></div>
</body>
</html>