<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:Arial;font-size:11pt;color:#0078D7;margin:5pt;" align="Left">
[AMD Official Use Only - Internal Distribution Only]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Acked-by: Alex Deucher <alexander.deucher@amd.com><br>
</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> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Xiaomeng Hou <Xiaomeng.Hou@amd.com><br>
<b>Sent:</b> Thursday, December 10, 2020 7:59 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Gao, Likun <Likun.Gao@amd.com>; Huang, Ray <Ray.Huang@amd.com>; Hou, Xiaomeng (Matthew) <Xiaomeng.Hou@amd.com><br>
<b>Subject:</b> [PATCH] drm/amdgpu/sdma5.2: soft reset sdma blocks before setup and start sdma</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Without doing the soft reset, register mmSDMA0_GFX_RB_WPTR's value could not be<br>
reset to 0 when sdma block resumes. That would cause the ring buffer's read and<br>
write pointers not equal and ring test fail. So add the soft reset step.<br>
<br>
Signed-off-by: Xiaomeng Hou <Xiaomeng.Hou@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 39 +++++++++++++++++++++-----<br>
1 file changed, 32 insertions(+), 7 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c<br>
index 39e17aae655f..5acc1e589672 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c<br>
@@ -807,6 +807,37 @@ static int sdma_v5_2_load_microcode(struct amdgpu_device *adev)<br>
return 0;<br>
}<br>
<br>
+static int sdma_v5_2_soft_reset(void *handle)<br>
+{<br>
+ struct amdgpu_device *adev = (struct amdgpu_device *)handle;<br>
+ u32 grbm_soft_reset = 0;<br>
+ u32 tmp;<br>
+ int i;<br>
+<br>
+ for (i = 0; i < adev->sdma.num_instances; i++) {<br>
+ grbm_soft_reset = REG_SET_FIELD(grbm_soft_reset,<br>
+ GRBM_SOFT_RESET, SOFT_RESET_SDMA0,<br>
+ 1);<br>
+ grbm_soft_reset <<= i;<br>
+<br>
+ tmp = RREG32_SOC15(GC, 0, mmGRBM_SOFT_RESET);<br>
+ tmp |= grbm_soft_reset;<br>
+ DRM_DEBUG("GRBM_SOFT_RESET=0x%08X\n", tmp);<br>
+ WREG32_SOC15(GC, 0, mmGRBM_SOFT_RESET, tmp);<br>
+ tmp = RREG32_SOC15(GC, 0, mmGRBM_SOFT_RESET);<br>
+<br>
+ udelay(50);<br>
+<br>
+ tmp &= ~grbm_soft_reset;<br>
+ WREG32_SOC15(GC, 0, mmGRBM_SOFT_RESET, tmp);<br>
+ tmp = RREG32_SOC15(GC, 0, mmGRBM_SOFT_RESET);<br>
+<br>
+ udelay(50);<br>
+ }<br>
+<br>
+ return 0;<br>
+}<br>
+<br>
/**<br>
* sdma_v5_2_start - setup and start the async dma engines<br>
*<br>
@@ -838,6 +869,7 @@ static int sdma_v5_2_start(struct amdgpu_device *adev)<br>
msleep(1000);<br>
}<br>
<br>
+ sdma_v5_2_soft_reset(adev);<br>
/* unhalt the MEs */<br>
sdma_v5_2_enable(adev, true);<br>
/* enable sdma ring preemption */<br>
@@ -1366,13 +1398,6 @@ static int sdma_v5_2_wait_for_idle(void *handle)<br>
return -ETIMEDOUT;<br>
}<br>
<br>
-static int sdma_v5_2_soft_reset(void *handle)<br>
-{<br>
- /* todo */<br>
-<br>
- return 0;<br>
-}<br>
-<br>
static int sdma_v5_2_ring_preempt_ib(struct amdgpu_ring *ring)<br>
{<br>
int i, r = 0;<br>
-- <br>
2.17.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Calexander.deucher%40amd.com%7Cc7ed271775544123bb2208d89d0b9af3%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637432020727843101%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=JueaOw9nYtG2XJj1se7uYlKZomuBTa8NnGeVVZzC9Tw%3D&reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Calexander.deucher%40amd.com%7Cc7ed271775544123bb2208d89d0b9af3%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637432020727843101%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=JueaOw9nYtG2XJj1se7uYlKZomuBTa8NnGeVVZzC9Tw%3D&reserved=0</a><br>
</div>
</span></font></div>
</div>
</body>
</html>