drm/amdgpu/sdma: add begin_use/end_use helpers
Subsystems (2)
Alex Deucher
maintainerPATCH 1/3 drm/amdgpu/sdma: add begin_use/end_use helpers
Add helper functions to disallow GFXOFF while SDMA has work. 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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 14 ++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h | 3 +++ 2 files changed, 17 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +14 -0
@@ -326,3 +326,17 @@ int amdgpu_sdma_ras_sw_init(struct amdgpu_device *adev)return 0 ; } + +void amdgpu_sdma_ring_begin_use (struct amdgpu_ring *ring) +{ +struct amdgpu_device *adev = ring->adev; + +amdgpu_gfx_off_ctrl (adev, false); +} + +void amdgpu_sdma_ring_end_use (struct amdgpu_ring *ring) +{ +struct amdgpu_device *adev = ring->adev; + +amdgpu_gfx_off_ctrl (adev, true); +}
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h +3 -0
@@ -171,4 +171,7 @@ void amdgpu_sdma_destroy_inst_ctx(struct amdgpu_device *adev, bool duplicate);int amdgpu_sdma_ras_sw_init (struct amdgpu_device *adev); +void amdgpu_sdma_ring_begin_use (struct amdgpu_ring *ring); +void amdgpu_sdma_ring_end_use (struct amdgpu_ring *ring); +#endif
Signature · 1 line
2.42.0
Alex Deucher
maintainerPATCH 2/3 drm/amdgpu/sdma5.0: 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.
--- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +2 -0
@@ -1790,6 +1790,8 @@ static const struct amdgpu_ring_funcs sdma_v5_0_ring_funcs = { .test_ib = sdma_v5_0_ring_test_ib, .insert_nop = sdma_v5_0_ring_insert_nop, .pad_ib = sdma_v5_0_ring_pad_ib, + .begin_use = amdgpu_sdma_ring_begin_use, + .end_use = amdgpu_sdma_ring_end_use, .emit_wreg = sdma_v5_0_ring_emit_wreg, .emit_reg_wait = sdma_v5_0_ring_emit_reg_wait, .emit_reg_write_reg_wait = sdma_v5_0_ring_emit_reg_write_reg_wait,
Signature · 1 line
2.42.0
Deucher, Alexander
maintainerRE: [PATCH 2/3] drm/amdgpu/sdma5.0: add begin/end_use ring callbacks
[Public]
Quoted 8 lines
-----Original Message-----
From: Deucher, Alexander <[email protected]>
Sent: Friday, December 8, 2023 5:19 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 2/3] drm/amdgpu/sdma5.0: add begin/end_use ring callbacks
Quoted 4 lines
Add begin/end_use ring callbacks to disallow GFXOFF when SDMA work is submitted and allow it again afterward.
Signed-off-by Alex Deucher <[email protected]>
This one can probably be dropped. It's only needed if anyone on navi1x is experiencing a similar issue.
Alex
Quoted 22 lines
--- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +2
-0@@ -1790,6 +1790,8 @@ static const struct amdgpu_ring_funcs sdma_v5_0_ring_funcs = { .test_ib = sdma_v5_0_ring_test_ib, .insert_nop = sdma_v5_0_ring_insert_nop, .pad_ib = sdma_v5_0_ring_pad_ib, + .begin_use = amdgpu_sdma_ring_begin_use, + .end_use = amdgpu_sdma_ring_end_use, .emit_wreg = sdma_v5_0_ring_emit_wreg, .emit_reg_wait = sdma_v5_0_ring_emit_reg_wait,.emit_reg_write_reg_wait =
sdma_v5_0_ring_emit_reg_write_reg_wait,
--
2.42.0
Alex Deucher
maintainerPATCH 3/3 drm/amdgpu/sdma5.2: add begin/end_use ring callbacks
In reply to Alex DeucherAdd begin/end_use ring callbacks to disallow GFXOFF when SDMA work is submitted and allow it again afterward.
--- drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +2 -0
@@ -1690,6 +1690,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 = amdgpu_sdma_ring_begin_use, + .end_use = amdgpu_sdma_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 helper functions to disallow GFXOFF while SDMA has work. 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.
Signed-off-by Alex Deucher <[email protected]>---
For the series:
Quoted 38 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 14 ++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h | 3 +++ 2 files changed, 17 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +14
-0@@ -326,3 +326,17 @@ int amdgpu_sdma_ras_sw_init(struct amdgpu_device *adev)return 0 ; } + +void amdgpu_sdma_ring_begin_use (struct amdgpu_ring *ring) +{ +struct amdgpu_device *adev = ring->adev; + +amdgpu_gfx_off_ctrl (adev, false); +} + +void amdgpu_sdma_ring_end_use (struct amdgpu_ring *ring) +{ +struct amdgpu_device *adev = ring->adev; + +amdgpu_gfx_off_ctrl (adev, true); +}drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h +3
-0@@ -171,4 +171,7 @@ void amdgpu_sdma_destroy_inst_ctx(struct amdgpu_device *adev, bool duplicate);int amdgpu_sdma_ras_sw_init (struct amdgpu_device *adev); +void amdgpu_sdma_ring_begin_use (struct amdgpu_ring *ring); +void amdgpu_sdma_ring_end_use (struct amdgpu_ring *ring); +#endif
Quoted 10 lines · Alex Deucher
Add helper functions to disallow GFXOFF while SDMA has work. 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.
Signed-off-by Alex Deucher <[email protected]>
Since sdma5.2 is the only version that currently needs this I think we can just squash this all into sdma5.2. There may even be 5.2.x variants that don't need this. Better to keep it all in that code. Will send out a v2.
Alex
Quoted 42 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 14 ++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h | 3 +++ 2 files changed, 17 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +14
-0@@ -326,3 +326,17 @@ int amdgpu_sdma_ras_sw_init(struct amdgpu_device *adev)return 0 ; } + +void amdgpu_sdma_ring_begin_use (struct amdgpu_ring *ring) +{ +struct amdgpu_device *adev = ring->adev; + +amdgpu_gfx_off_ctrl (adev, false); +} + +void amdgpu_sdma_ring_end_use (struct amdgpu_ring *ring) +{ +struct amdgpu_device *adev = ring->adev; + +amdgpu_gfx_off_ctrl (adev, true); +}drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h +3
-1@@ -171,4 +171,7 @@ void amdgpu_sdma_destroy_inst_ctx(struct amdgpu_device *adev, bool duplicate);int amdgpu_sdma_ras_sw_init (struct amdgpu_device *adev); +void amdgpu_sdma_ring_begin_use (struct amdgpu_ring *ring); +void amdgpu_sdma_ring_end_use (struct amdgpu_ring *ring); +#endif --2.42.0