Re: [PATCH v5] serial: 8250_omap: clear rx_running on zero-length DMA completes
From: andriy.shevchenko@xxxxxxxxxxxxxxx
Date: Tue Jun 02 2026 - 14:39:32 EST
On Tue, May 26, 2026 at 07:35:09AM +0000, Matthias Feser wrote:
> On AM33xx RX DMA only triggers when the FIFO reaches the
> configured threshold (typically 48 bytes). For smaller bursts
> no DMA request is issued and the FIFO is drained by RX timeout.
>
> In this case __dma_rx_do_complete() can legitimately see count == 0.
>
> The current code exits early in this case and does not clear
> dma->rx_running, leaving the DMA state inconsistent. This can
> prevent RX DMA from restarting and may cause
> omap_8250_rx_dma_flush() to fail, marking DMA as broken.
>
> Fix this by clearing dma->rx_running once the DMA transfer has
> completed or been terminated, even if no data was transferred.
...
> + dma->rx_running = 0;
> if (!count)
> goto out;
> ret = tty_insert_flip_string(tty_port, dma->rx_buf, count);
>
> - dma->rx_running = 0;
I'm wondering if this opens a window when dma->rx_buf may be rewritten (or
unmapped or something else) before tty layer has a chance to insert bytes to
its ring buffer. I.o.w. is this change synchronous to other threads?
--
With Best Regards,
Andy Shevchenko