Skip to contentSkip to conversation

drm/amdgpu: Clean sdma wptr register when only enable wptr polling

PATCH In review Emily Deng 3 participants 3 messages Mar 7, 2018 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Emily Deng

author
#0 lore raw

PATCH v2 1/1 drm/amdgpu: Clean sdma wptr register when only enable wptr polling

The sdma wptr polling memory is not fast enough, then the sdma wptr register will be random, and not equal to sdma rptr, which will cause sdma engine hang when load driver, so clean up the sdma wptr directly to fix this issue.

v2:add comment above the code and correct coding style

---
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +5 -2
index 521978c..89ec17c 100644
@@ -719,14 +719,17 @@ static int sdma_v3_0_gfx_resume(struct amdgpu_device *adev)
 		WREG32(mmSDMA0_GFX_RB_WPTR_POLL_ADDR_HI + sdma_offsets[i],
 		       upper_32_bits(wptr_gpu_addr));
 		wptr_poll_cntl = RREG32(mmSDMA0_GFX_RB_WPTR_POLL_CNTL + sdma_offsets[i]);
-		if (ring->use_pollmem)
+		if (ring->use_pollmem) {
+			/*wptr polling is not enogh fast, directly clean the wptr register */
+			WREG32(mmSDMA0_GFX_RB_WPTR + sdma_offsets[i], 0);
 			wptr_poll_cntl = REG_SET_FIELD(wptr_poll_cntl,
 						       SDMA0_GFX_RB_WPTR_POLL_CNTL,
 						       ENABLE, 1);
-		else
+		} else {
 			wptr_poll_cntl = REG_SET_FIELD(wptr_poll_cntl,
 						       SDMA0_GFX_RB_WPTR_POLL_CNTL,
 						       ENABLE, 0);
+		}
 		WREG32(mmSDMA0_GFX_RB_WPTR_POLL_CNTL + sdma_offsets[i], wptr_poll_cntl);
 
 		/* enable DMA RB */
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1520387502-25123-1-git-send-email-Emily.Deng-5C7GfCeVMHo@public.gmane.org

Reviewed-by Xiangliang Yu
#2 lore raw
Quoted 52 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Emily Deng
Sent: Wednesday, March 07, 2018 9:52 AM
To: [email protected]
Cc: Deng, Emily <[email protected]>
Subject: [PATCH v2] drm/amdgpu: Clean sdma wptr register when only enable wptr polling

The sdma wptr polling memory is not fast enough, then the sdma wptr register will be random, and not equal to sdma rptr, which will cause sdma engine hang when load driver, so clean up the sdma wptr directly to fix this issue.

v2:add comment above the code and correct coding style

---
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -1
index 521978c..89ec17c 100644
@@ -719,14 +719,17 @@ static int sdma_v3_0_gfx_resume(struct
 amdgpu_device *adev)
 		WREG32(mmSDMA0_GFX_RB_WPTR_POLL_ADDR_HI +
 sdma_offsets[i],
 		       upper_32_bits(wptr_gpu_addr));
 		wptr_poll_cntl =
 RREG32(mmSDMA0_GFX_RB_WPTR_POLL_CNTL + sdma_offsets[i]);
-		if (ring->use_pollmem)
+		if (ring->use_pollmem) {
+			/*wptr polling is not enogh fast, directly clean the

wptr register */

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +1 -0
+			WREG32(mmSDMA0_GFX_RB_WPTR +

sdma_offsets[i], 0);
wptr_poll_cntl = REG_SET_FIELD(wptr_poll_cntl,

SDMA0_GFX_RB_WPTR_POLL_CNTL,

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +1 -1
 						       ENABLE, 1);
-		else
+		} else {
 			wptr_poll_cntl = REG_SET_FIELD(wptr_poll_cntl,

SDMA0_GFX_RB_WPTR_POLL_CNTL,

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +1 -0
 						       ENABLE, 0);
+		}
 		WREG32(mmSDMA0_GFX_RB_WPTR_POLL_CNTL +

sdma_offsets[i], wptr_poll_cntl);

Quoted 8 lines

/* enable DMA RB */
--
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): BY2PR1201MB0935794841BBE34EE0552F1EEBD80-O28G1zQ8oGkaqtME6NEo1mrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/[email protected]

Reviewed-by
#4 lore raw

Am 07.03.2018 um 07:17 schrieb Yu, Xiangliang:

Quoted 59 lines
Quoted 56 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Emily Deng
Sent: Wednesday, March 07, 2018 9:52 AM
To: [email protected]
Cc: Deng, Emily <[email protected]>
Subject: [PATCH v2] drm/amdgpu: Clean sdma wptr register when only enable wptr polling

The sdma wptr polling memory is not fast enough, then the sdma wptr register will be random, and not equal to sdma rptr, which will cause sdma engine hang when load driver, so clean up the sdma wptr directly to fix this issue.

v2:add comment above the code and correct coding style

---
  drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -1
index 521978c..89ec17c 100644
@@ -719,14 +719,17 @@ static int sdma_v3_0_gfx_resume(struct
 amdgpu_device *adev)
  		WREG32(mmSDMA0_GFX_RB_WPTR_POLL_ADDR_HI +
 sdma_offsets[i],
  		       upper_32_bits(wptr_gpu_addr));
  		wptr_poll_cntl =
 RREG32(mmSDMA0_GFX_RB_WPTR_POLL_CNTL + sdma_offsets[i]);
-		if (ring->use_pollmem)
+		if (ring->use_pollmem) {
+			/*wptr polling is not enogh fast, directly clean the

wptr register */

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +1 -0
+			WREG32(mmSDMA0_GFX_RB_WPTR +

sdma_offsets[i], 0);
wptr_poll_cntl = REG_SET_FIELD(wptr_poll_cntl,

SDMA0_GFX_RB_WPTR_POLL_CNTL,
ENABLE, 1);

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +1 -1
-		else
+		} else {
  			wptr_poll_cntl = REG_SET_FIELD(wptr_poll_cntl,

SDMA0_GFX_RB_WPTR_POLL_CNTL,
ENABLE, 0);

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +1 -0
+		}
  		WREG32(mmSDMA0_GFX_RB_WPTR_POLL_CNTL +

sdma_offsets[i], wptr_poll_cntl);

/* enable DMA RB */
--
2.7.4

Quoted 8 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx