Manually disallow and then allow gfxoff in begin_use
and end_use to avoid any potential FW races when
ringing the doorbell.  There are no known issues
with gfxoff that this solves, but it shouldn't hurt anything
and shouldn't affect power usage since we are only
toggling it around the doorbell update.

Signed-off-by: Alex Deucher <alexander.deuc...@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c 
b/drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c
index 9b40ae67a92f7..53ca808fd1fd7 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c
@@ -1646,6 +1646,16 @@ static void sdma_v7_0_dump_ip_state(struct 
amdgpu_ip_block *ip_block)
        amdgpu_gfx_off_ctrl(adev, true);
 }
 
+static void sdma_v7_0_ring_begin_use(struct amdgpu_ring *ring)
+{
+       amdgpu_gfx_off_ctrl_immediate(ring->adev, false);
+}
+
+static void sdma_v7_0_ring_end_use(struct amdgpu_ring *ring)
+{
+       amdgpu_gfx_off_ctrl_immediate(ring->adev, true);
+}
+
 const struct amd_ip_funcs sdma_v7_0_ip_funcs = {
        .name = "sdma_v7_0",
        .early_init = sdma_v7_0_early_init,
@@ -1701,6 +1711,8 @@ static const struct amdgpu_ring_funcs 
sdma_v7_0_ring_funcs = {
        .init_cond_exec = sdma_v7_0_ring_init_cond_exec,
        .preempt_ib = sdma_v7_0_ring_preempt_ib,
        .reset = sdma_v7_0_reset_queue,
+       .begin_use = sdma_v7_0_ring_begin_use,
+       .end_use = sdma_v7_0_ring_end_use,
 };
 
 static void sdma_v7_0_set_ring_funcs(struct amdgpu_device *adev)
-- 
2.48.1

Reply via email to