summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2026-06-03 12:07:41 +0300
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2026-06-14 17:21:33 +0200
commite251e7c9fd30f494526757b3dc731ed056f23e12 (patch)
tree7a5f6d94997c70dccb437d56e9518b69a1702cab
parentc9b57ad97872eff9f4ce1fa1374c932cab579285 (diff)
downloadlinux-next-e251e7c9fd30f494526757b3dc731ed056f23e12.tar.gz
linux-next-e251e7c9fd30f494526757b3dc731ed056f23e12.zip
i3c: mipi-i3c-hci: Wait for DMA ring restart to complete
Although hci_dma_dequeue_xfer() is serialized against itself via control_mutex, this does not guarantee that a DMA ring restart triggered by a previous invocation has fully completed. When the function is called again in rapid succession, the DMA ring may still be transitioning back to the running state, which may confound or disrupt further state changes. Address this by waiting for the DMA ring restart to complete before continuing. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20260603090754.16252-5-adrian.hunter@intel.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-rw-r--r--drivers/i3c/master/mipi-i3c-hci/dma.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/i3c/master/mipi-i3c-hci/dma.c b/drivers/i3c/master/mipi-i3c-hci/dma.c
index c3da6eab8eae..3b14bc87bdf6 100644
--- a/drivers/i3c/master/mipi-i3c-hci/dma.c
+++ b/drivers/i3c/master/mipi-i3c-hci/dma.c
@@ -617,6 +617,7 @@ static bool hci_dma_dequeue_xfer(struct i3c_hci *hci,
}
/* restart the ring */
+ reinit_completion(&rh->op_done);
mipi_i3c_hci_resume(hci);
rh_reg_write(RING_CONTROL, RING_CTRL_ENABLE);
rh_reg_write(RING_CONTROL, RING_CTRL_ENABLE | RING_CTRL_RUN_STOP);
@@ -625,6 +626,8 @@ static bool hci_dma_dequeue_xfer(struct i3c_hci *hci,
spin_unlock_irq(&hci->lock);
+ wait_for_completion_timeout(&rh->op_done, HZ);
+
return did_unqueue;
}