drm/amdgpu/sdma5.2: add begin/end_use ring callbacks
Subsystems (2)
Alex Deucher
maintainerPATCH v2 1/1 drm/amdgpu/sdma5.2: add begin/end_use ring callbacks
Add begin/end_use ring callbacks to disallow GFXOFF when SDMA work is submitted and allow it again afterward.
This should avoid corner cases where GFXOFF is erroneously entered when SDMA is still active. For now just allow/disallow GFXOFF in the begin and end helpers until we root cause the issue. This should not impact power as SDMA usage is pretty minimal and GFXOSS should not be active when SDMA is active anyway, this just makes it explicit.
v2: move everything into sdma5.2 code. No reason for this to be generic at this point.
--- drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +16 -0
@@ -1643,6 +1643,20 @@ static void sdma_v5_2_get_clockgating_state(void *handle, u64 *flags) *flags |=AMD_CG_SUPPORT_SDMA_LS ; } +static void sdma_v5_2_ring_begin_use (struct amdgpu_ring *ring) +{ +struct amdgpu_device *adev = ring->adev; + +amdgpu_gfx_off_ctrl (adev, false); +} + +static void sdma_v5_2_ring_end_use (struct amdgpu_ring *ring) +{ +struct amdgpu_device *adev = ring->adev; + +amdgpu_gfx_off_ctrl (adev, true); +} +const struct amd_ip_funcs sdma_v5_2_ip_funcs = { .name ="sdma_v5_2" , .early_init = sdma_v5_2_early_init,
@@ -1690,6 +1704,8 @@ static const struct amdgpu_ring_funcs sdma_v5_2_ring_funcs = { .test_ib = sdma_v5_2_ring_test_ib, .insert_nop = sdma_v5_2_ring_insert_nop, .pad_ib = sdma_v5_2_ring_pad_ib, + .begin_use = sdma_v5_2_ring_begin_use, + .end_use = sdma_v5_2_ring_end_use, .emit_wreg = sdma_v5_2_ring_emit_wreg, .emit_reg_wait = sdma_v5_2_ring_emit_reg_wait, .emit_reg_write_reg_wait = sdma_v5_2_ring_emit_reg_write_reg_wait,
Signature · 1 line
2.42.0
Quoted 10 lines · Alex Deucher
Add begin/end_use ring callbacks to disallow GFXOFF when SDMA work is submitted and allow it again afterward.
This should avoid corner cases where GFXOFF is erroneously entered when SDMA is still active. For now just allow/disallow GFXOFF in the begin and end helpers until we root cause the issue. This should not impact power as SDMA usage is pretty minimal and GFXOSS should not be active when SDMA is active anyway, this just makes it explicit.
Quoted 7 lines
v2: move everything into sdma5.2 code. No reason for this to be generic at this point.
As SDMA5.2 is supported back to LTS ~5.15 I suggest also:
Quoted 38 lines
--- drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +16
-0@@ -1643,6 +1643,20 @@ static void sdma_v5_2_get_clockgating_state(void *handle, u64 *flags) *flags |=AMD_CG_SUPPORT_SDMA_LS ; } +static void sdma_v5_2_ring_begin_use (struct amdgpu_ring *ring) +{ +struct amdgpu_device *adev = ring->adev; + +amdgpu_gfx_off_ctrl (adev, false); +} + +static void sdma_v5_2_ring_end_use (struct amdgpu_ring *ring) +{ +struct amdgpu_device *adev = ring->adev; + +amdgpu_gfx_off_ctrl (adev, true); +} +const struct amd_ip_funcs sdma_v5_2_ip_funcs = { .name ="sdma_v5_2" , .early_init = sdma_v5_2_early_init,@@ -1690,6 +1704,8 @@ static const struct amdgpu_ring_funcs sdma_v5_2_ring_funcs = { .test_ib = sdma_v5_2_ring_test_ib, .insert_nop = sdma_v5_2_ring_insert_nop, .pad_ib = sdma_v5_2_ring_pad_ib, + .begin_use = sdma_v5_2_ring_begin_use, + .end_use = sdma_v5_2_ring_end_use, .emit_wreg = sdma_v5_2_ring_emit_wreg, .emit_reg_wait = sdma_v5_2_ring_emit_reg_wait, .emit_reg_write_reg_wait = sdma_v5_2_ring_emit_reg_write_reg_wait,
Am 08.12.23 um 23:53 schrieb Alex Deucher:
Quoted 10 lines
Add begin/end_use ring callbacks to disallow GFXOFF when SDMA work is submitted and allow it again afterward.
This should avoid corner cases where GFXOFF is erroneously entered when SDMA is still active. For now just allow/disallow GFXOFF in the begin and end helpers until we root cause the issue. This should not impact power as SDMA usage is pretty minimal and GFXOSS should not be active when SDMA is active anyway, this just makes it explicit.
Quoted 7 lines
v2: move everything into sdma5.2 code. No reason for this to be generic at this point.
Maybe add a one line code comment explaining why we do this, with that done Reviewed-by: Christian König <[email protected]>
Christian.
Quoted 38 lines
--- drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +16
-0@@ -1643,6 +1643,20 @@ static void sdma_v5_2_get_clockgating_state(void *handle, u64 *flags) *flags |=AMD_CG_SUPPORT_SDMA_LS ; } +static void sdma_v5_2_ring_begin_use (struct amdgpu_ring *ring) +{ +struct amdgpu_device *adev = ring->adev; + +amdgpu_gfx_off_ctrl (adev, false); +} + +static void sdma_v5_2_ring_end_use (struct amdgpu_ring *ring) +{ +struct amdgpu_device *adev = ring->adev; + +amdgpu_gfx_off_ctrl (adev, true); +} +const struct amd_ip_funcs sdma_v5_2_ip_funcs = { .name ="sdma_v5_2" , .early_init = sdma_v5_2_early_init,@@ -1690,6 +1704,8 @@ static const struct amdgpu_ring_funcs sdma_v5_2_ring_funcs = { .test_ib = sdma_v5_2_ring_test_ib, .insert_nop = sdma_v5_2_ring_insert_nop, .pad_ib = sdma_v5_2_ring_pad_ib, + .begin_use = sdma_v5_2_ring_begin_use, + .end_use = sdma_v5_2_ring_end_use, .emit_wreg = sdma_v5_2_ring_emit_wreg, .emit_reg_wait = sdma_v5_2_ring_emit_reg_wait, .emit_reg_write_reg_wait = sdma_v5_2_ring_emit_reg_write_reg_wait,