Re: [PATCH V3 04/16] i3c: mipi-i3c-hci: Wait for DMA ring restart to complete

Frank Li <[email protected]>
Newsgroups org.infradead.lists.linux-i3c,org.kernel.vger.linux-kernel
Message-ID <agNZPLM7GfVhxg38@lizhi-Precision-Tower-5810>
On Mon, May 04, 2026 at 02:33:40PM +0300, Adrian Hunter wrote:
> 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 <[email protected]>
> ---

Reviewed-by: Frank Li <[email protected]>

>
>
> Changes in V2 and V3:
>
> 	None
>
>
>  drivers/i3c/master/mipi-i3c-hci/dma.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/i3c/master/mipi-i3c-hci/dma.c b/drivers/i3c/master/mipi-i3c-hci/dma.c
> index 314635e6e190..28614fdbf558 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;
>  }
>
> --
> 2.51.0
>

-- 
linux-i3c mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-i3c
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.