On a queue MODIFY (prop->modify) sdma7_1 init_mqd keeps the context-saved
rptr and uses prop->user_wptr as the wptr, 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 sdma7_1 update_mqd callback, per review.
Signed-off-by: Jesse Zhang <[email protected]>
Suggested-by: Alexander Deucher <[email protected]>
---
drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c
b/drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c
index e9a3bcfd7775..5a66aa8bfa0e 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c
@@ -886,6 +886,15 @@ static int sdma_v7_1_mqd_init(struct amdgpu_device *adev,
void *mqd,
m->sdmax_rlcx_csa_addr_lo = lower_32_bits(prop->csa_addr);
m->sdmax_rlcx_csa_addr_hi = upper_32_bits(prop->csa_addr);
+ if (prop->modify) {
+ /* MODIFY: keep the context-saved rptr, use the live user wptr
*/
+ m->sdmax_rlcx_rb_wptr = lower_32_bits(prop->user_wptr);
+ m->sdmax_rlcx_rb_wptr_hi = upper_32_bits(prop->user_wptr);
+
+ /* ib_cntl read back IB_ENABLE=0 on the stopped queue; force it
on */
+ m->sdmax_rlcx_ib_cntl |=
SDMA0_SDMA_QUEUE0_IB_CNTL__IB_ENABLE_MASK;
+ }
+
return 0;
}
--
2.49.0