Skip to content

Commit a03ebf1

Browse files
committed
drm/amdgpu/sdma5.2: Update wptr registers as well as doorbell
We seem to have a case where SDMA will sometimes miss a doorbell if GFX is entering the powergating state when the doorbell comes in. To workaround this, we can update the wptr via MMIO, however, this is only safe because we disallow gfxoff in begin_ring() for SDMA 5.2 and then allow it again in end_ring(). Enable this workaround while we are root causing the issue with the HW team. Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/3440 Tested-by: Friedrich Vock <friedrich.vock@gmx.de> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org (cherry picked from commit f2ac526)
1 parent 627a24f commit a03ebf1

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,14 @@ static void sdma_v5_2_ring_set_wptr(struct amdgpu_ring *ring)
176176
DRM_DEBUG("calling WDOORBELL64(0x%08x, 0x%016llx)\n",
177177
ring->doorbell_index, ring->wptr << 2);
178178
WDOORBELL64(ring->doorbell_index, ring->wptr << 2);
179+
/* SDMA seems to miss doorbells sometimes when powergating kicks in.
180+
* Updating the wptr directly will wake it. This is only safe because
181+
* we disallow gfxoff in begin_use() and then allow it again in end_use().
182+
*/
183+
WREG32(sdma_v5_2_get_reg_offset(adev, ring->me, mmSDMA0_GFX_RB_WPTR),
184+
lower_32_bits(ring->wptr << 2));
185+
WREG32(sdma_v5_2_get_reg_offset(adev, ring->me, mmSDMA0_GFX_RB_WPTR_HI),
186+
upper_32_bits(ring->wptr << 2));
179187
} else {
180188
DRM_DEBUG("Not using doorbell -- "
181189
"mmSDMA%i_GFX_RB_WPTR == 0x%08x "
@@ -1647,6 +1655,10 @@ static void sdma_v5_2_ring_begin_use(struct amdgpu_ring *ring)
16471655
* but it shouldn't hurt for other parts since
16481656
* this GFXOFF will be disallowed anyway when SDMA is
16491657
* active, this just makes it explicit.
1658+
* sdma_v5_2_ring_set_wptr() takes advantage of this
1659+
* to update the wptr because sometimes SDMA seems to miss
1660+
* doorbells when entering PG. If you remove this, update
1661+
* sdma_v5_2_ring_set_wptr() as well!
16501662
*/
16511663
amdgpu_gfx_off_ctrl(adev, false);
16521664
}

0 commit comments

Comments
 (0)