Skip to content

Commit b35a2a1

Browse files
Prike Liangalexdeucher
authored andcommitted
drm/amdgpu/sdma_v4_0: turn off SDMA ring buffer in the s2idle suspend
In the SDMA s0ix save process requires to turn off SDMA ring buffer for avoiding the SDMA in-flight request, otherwise will suffer from SDMA page fault which causes by page request from in-flight SDMA ring accessing at SDMA restore phase. Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2248 Cc: [email protected] # 6.0,5.15+ Fixes: f8f4e2a ("drm/amdgpu: skipping SDMA hw_init and hw_fini for S0ix.") Signed-off-by: Prike Liang <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Tested-by: Mario Limonciello <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 3f4c175 commit b35a2a1

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

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

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -907,13 +907,13 @@ static void sdma_v4_0_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64 se
907907

908908

909909
/**
910-
* sdma_v4_0_gfx_stop - stop the gfx async dma engines
910+
* sdma_v4_0_gfx_enable - enable the gfx async dma engines
911911
*
912912
* @adev: amdgpu_device pointer
913-
*
914-
* Stop the gfx async dma ring buffers (VEGA10).
913+
* @enable: enable SDMA RB/IB
914+
* control the gfx async dma ring buffers (VEGA10).
915915
*/
916-
static void sdma_v4_0_gfx_stop(struct amdgpu_device *adev)
916+
static void sdma_v4_0_gfx_enable(struct amdgpu_device *adev, bool enable)
917917
{
918918
u32 rb_cntl, ib_cntl;
919919
int i;
@@ -922,10 +922,10 @@ static void sdma_v4_0_gfx_stop(struct amdgpu_device *adev)
922922

923923
for (i = 0; i < adev->sdma.num_instances; i++) {
924924
rb_cntl = RREG32_SDMA(i, mmSDMA0_GFX_RB_CNTL);
925-
rb_cntl = REG_SET_FIELD(rb_cntl, SDMA0_GFX_RB_CNTL, RB_ENABLE, 0);
925+
rb_cntl = REG_SET_FIELD(rb_cntl, SDMA0_GFX_RB_CNTL, RB_ENABLE, enable ? 1 : 0);
926926
WREG32_SDMA(i, mmSDMA0_GFX_RB_CNTL, rb_cntl);
927927
ib_cntl = RREG32_SDMA(i, mmSDMA0_GFX_IB_CNTL);
928-
ib_cntl = REG_SET_FIELD(ib_cntl, SDMA0_GFX_IB_CNTL, IB_ENABLE, 0);
928+
ib_cntl = REG_SET_FIELD(ib_cntl, SDMA0_GFX_IB_CNTL, IB_ENABLE, enable ? 1 : 0);
929929
WREG32_SDMA(i, mmSDMA0_GFX_IB_CNTL, ib_cntl);
930930
}
931931
}
@@ -1044,7 +1044,7 @@ static void sdma_v4_0_enable(struct amdgpu_device *adev, bool enable)
10441044
int i;
10451045

10461046
if (!enable) {
1047-
sdma_v4_0_gfx_stop(adev);
1047+
sdma_v4_0_gfx_enable(adev, enable);
10481048
sdma_v4_0_rlc_stop(adev);
10491049
if (adev->sdma.has_page_queue)
10501050
sdma_v4_0_page_stop(adev);
@@ -1960,8 +1960,10 @@ static int sdma_v4_0_suspend(void *handle)
19601960
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
19611961

19621962
/* SMU saves SDMA state for us */
1963-
if (adev->in_s0ix)
1963+
if (adev->in_s0ix) {
1964+
sdma_v4_0_gfx_enable(adev, false);
19641965
return 0;
1966+
}
19651967

19661968
return sdma_v4_0_hw_fini(adev);
19671969
}
@@ -1971,8 +1973,12 @@ static int sdma_v4_0_resume(void *handle)
19711973
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
19721974

19731975
/* SMU restores SDMA state for us */
1974-
if (adev->in_s0ix)
1976+
if (adev->in_s0ix) {
1977+
sdma_v4_0_enable(adev, true);
1978+
sdma_v4_0_gfx_enable(adev, true);
1979+
amdgpu_ttm_set_buffer_funcs_status(adev, true);
19751980
return 0;
1981+
}
19761982

19771983
return sdma_v4_0_hw_init(adev);
19781984
}

0 commit comments

Comments
 (0)