Skip to contentSkip to conversation

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

PATCH Superseded Emily Deng 4 participants 5 messages Mar 6, 2018 2 messages not in the archive

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Emily Deng

author
#0 lore raw

PATCH 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.

---
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +3 -2
index 521978c..2a27928 100644
@@ -719,11 +719,12 @@ 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) {
+			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);
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): 1520330398-23639-1-git-send-email-Emily.Deng-5C7GfCeVMHo@public.gmane.org

#2 lore raw

How about other sdma version? like sdma v4 etc.

Regards,

David Zhou

Quoted 19 lines · Emily Deng

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.

---
  drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -1
index 521978c..2a27928 100644
@@ -719,11 +719,12 @@ 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)

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c static int sdma_v3_0_gfx_resume(struct amdgpu_device *adev) · line 730

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +3 -1
+		if (ring->use_pollmem) {
+			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);

_______________________________________________
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): c67969e5-465f-6cf6-f463-35ed70df7124-5C7GfCeVMHo@public.gmane.org

#4 lore raw

looks we didn't hit similar issues during vega10 testing ...
________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of zhoucm1 <[email protected]>
Sent: Tuesday, March 6, 2018 6:02:35 PM
To: Deng, Emily; [email protected]
Subject: Re: [PATCH] drm/amdgpu: Clean sdma wptr register when only enable wptr polling

How about other sdma version? like sdma v4 etc.

Regards,

David Zhou

Quoted 19 lines · Emily Deng

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.

---
  drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -1
index 521978c..2a27928 100644
@@ -719,11 +719,12 @@ 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)

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c static int sdma_v3_0_gfx_resume(struct amdgpu_device *adev) · line 730

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +3 -1
+             if (ring->use_pollmem) {
+                     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);

_______________________________________________
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

#5 lore raw
In reply to a message not in the archive

The sdma v4 doesn't have the issue about the conflict between doorbell and sdma wptr polling.

Best Wishes,
Emily Deng

Quoted 52 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of zhoucm1
Sent: Tuesday, March 06, 2018 6:03 PM
To: Deng, Emily <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: Clean sdma wptr register when only enable wptr polling

How about other sdma version? like sdma v4 etc.

Regards,

David Zhou

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c static int sdma_v3_0_gfx_resume(struct

Quoted 16 lines · Emily Deng

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.

---
  drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -0
index 521978c..2a27928 100644
@@ -719,11 +719,12 @@ static int sdma_v3_0_gfx_resume(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c static int sdma_v3_0_gfx_resume(struct · line 719

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -0
  		WREG32(mmSDMA0_GFX_RB_WPTR_POLL_ADDR_HI +

sdma_offsets[i],

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c static int sdma_v3_0_gfx_resume(struct · line 721

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -0
  		       upper_32_bits(wptr_gpu_addr));
  		wptr_poll_cntl =

RREG32(mmSDMA0_GFX_RB_WPTR_POLL_CNTL + sdma_offsets[i]);

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c static int sdma_v3_0_gfx_resume(struct amdgpu_device *adev)

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -1
-		if (ring->use_pollmem)
+		if (ring->use_pollmem) {
+			WREG32(mmSDMA0_GFX_RB_WPTR +

sdma_offsets[i], 0);

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c static int sdma_v3_0_gfx_resume(struct · line 725

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -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 static int sdma_v3_0_gfx_resume(struct amdgpu_device *adev)

Quoted 5 lines
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,

Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c static int sdma_v3_0_gfx_resume(struct amdgpu_device *adev) · line 730

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -0
  						       ENABLE, 0);

_______________________________________________
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

#6 lore raw
In reply to a message not in the archive

Am 06.03.2018 um 10:59 schrieb Emily Deng:

Quoted 16 lines

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.

---
  drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -0
index 521978c..2a27928 100644
@@ -719,11 +719,12 @@ static int sdma_v3_0_gfx_resume(struct amdgpu_device *adev)
  		WREG32(mmSDMA0_GFX_RB_WPTR_POLL_ADDR_HI + sdma_offsets[i],

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c static int sdma_v3_0_gfx_resume(struct amdgpu_device *adev) · line 727

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +3 -2
  		       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) {
+			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

According to the coding style you should use "} else {" here.

Apart from that the patch looks good to me,
Christian.

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c static int sdma_v3_0_gfx_resume(struct amdgpu_device *adev) · line 730

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -0
  			wptr_poll_cntl = REG_SET_FIELD(wptr_poll_cntl,
  						       SDMA0_GFX_RB_WPTR_POLL_CNTL,
  						       ENABLE, 0);

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