[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7a814f93-49b5-4b62-ae2c-dc28f174b11a@kernel.org>
Date: Tue, 6 May 2025 09:32:21 +0200
From: Jiri Slaby <jirislaby@...nel.org>
To: Mans Rullgard <mans@...sr.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org
Subject: Re: [PATCH] tty: serial: 8250_omap: fix tx with dma
On 30. 04. 25, 18:37, Mans Rullgard wrote:
> Commit 1788cf6a91d9 ("tty: serial: switch from circ_buf to kfifo")
> introduced two errors in the TX DMA handling for 8250_omap.
>
> Firstly, kfifo_dma_out_prepare_mapped() needs a scatterlist with two
> entries whereas only one is provided. The same error was fixed for
> 8250_dma in 59449c9dbdaa ("tty: serial: 8250_dma: use sgl with 2 nents
> to take care of buffer wrap").
It's not an error. This is how it used to work since ever. Providing two
is an optimization, right?
> Secondly, when the OMAP_DMA_TX_KICK flag is set, one byte is pulled from
> the kfifo and emitted directly in order to start the DMA.
> This is done without updating DMA tx_size
Ah, that's an error, of course.
> which leads to uart_xmit_advance() called
> in the DMA complete callback advancing the kfifo by one too much.
>
> In practice, transmitting N bytes has been seen to result in the last
> N-1 bytes being sent repeatedly.
>
> This change fixes both problems.
I am not sure you want to mix fixups with features.
> Fixes: 1788cf6a91d9 ("tty: serial: switch from circ_buf to kfifo")
> Signed-off-by: Mans Rullgard <mans@...sr.com>
...
> @@ -1248,8 +1247,10 @@ static int omap_8250_tx_dma(struct uart_8250_port *p)
> err:
> dma->tx_err = 1;
> out_skip:
> - if (skip_byte >= 0)
> + if (skip_byte >= 0) {
> serial_out(p, UART_TX, skip_byte);
> + p->port.icount.tx++;
This is unrelated (but correct) too.
thanks,
--
js
suse labs
Powered by blists - more mailing lists