On a queue MODIFY (prop->modify) sdma6 init_mqd keeps the ring rptr/wptr
that firmware context-saved into the MQD, so a re-enabled queue resumes
at the first un-consumed packet. It also forces IB_ENABLE back on, since
ib_cntl reads back IB_ENABLE=0 on a stopped queue.
v3: consume the mqd_prop modify flag inside init_mqd instead of adding a
separate sdma6 update_mqd callback, per review.
v4: also keep the context-saved wptr instead of programming a user_wptr,
per review.
Signed-off-by: Jesse Zhang <[email protected]>
Suggested-by: Alexander Deucher <[email protected]>
---
drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c
b/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c
index 3fd3e530c76b..a7dac93386db 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c
@@ -881,6 +881,14 @@ static int sdma_v6_0_mqd_init(struct amdgpu_device *adev,
void *mqd,
m->sdmax_rlcx_f32_dbg0 = lower_32_bits(prop->fence_address);
m->sdmax_rlcx_f32_dbg1 = upper_32_bits(prop->fence_address);
+ if (prop->modify) {
+ /*
+ * MODIFY keeps the firmware-saved rptr/wptr (left untouched
above);
+ * ib_cntl read back IB_ENABLE=0 on the stopped queue, so force
it on.
+ */
+ m->sdmax_rlcx_ib_cntl |= SDMA0_QUEUE0_IB_CNTL__IB_ENABLE_MASK;
+ }
+
return 0;
}
--
2.49.0