On a queue MODIFY (prop->modify) sdma6 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 sdma6 update_mqd callback, per review.
Signed-off-by: Jesse Zhang <[email protected]>
Suggested-by: Alexander Deucher <[email protected]>
---
drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c | 9 +++++++++
1 file changed, 9 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..d859e89289d0 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c
@@ -881,6 +881,15 @@ 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: 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_QUEUE0_IB_CNTL__IB_ENABLE_MASK;
+ }
+
return 0;
}
--
2.49.0