stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 2/3] serial: tegra: Use uart_xmit_advance(), fixes icount.tx accounting
       [not found] <20220830131343.25968-1-ilpo.jarvinen@linux.intel.com>
@ 2022-08-30 13:13 ` Ilpo Järvinen
  2022-08-30 13:13 ` [PATCH v2 3/3] serial: tegra-tcu: " Ilpo Järvinen
  1 sibling, 0 replies; 3+ messages in thread
From: Ilpo Järvinen @ 2022-08-30 13:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, linux-serial, Andy Shevchenko,
	Laxman Dewangan, Thierry Reding, Jonathan Hunter, Alan Cox,
	Stephen Warren, linux-tegra, linux-kernel
  Cc: Ilpo Järvinen, stable, Andy Shevchenko

DMA complete & stop paths did not correctly account Tx'ed characters
into icount.tx. Using uart_xmit_advance() fixes the problem.

Cc: <stable@vger.kernel.org> # serial: Create uart_xmit_advance()
Fixes: e9ea096dd225 ("serial: tegra: add serial driver")
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/tty/serial/serial-tegra.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c
index ad4f3567ff90..a5748e41483b 100644
--- a/drivers/tty/serial/serial-tegra.c
+++ b/drivers/tty/serial/serial-tegra.c
@@ -525,7 +525,7 @@ static void tegra_uart_tx_dma_complete(void *args)
 	count = tup->tx_bytes_requested - state.residue;
 	async_tx_ack(tup->tx_dma_desc);
 	spin_lock_irqsave(&tup->uport.lock, flags);
-	xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1);
+	uart_xmit_advance(&tup->uport, count);
 	tup->tx_in_progress = 0;
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
 		uart_write_wakeup(&tup->uport);
@@ -613,7 +613,6 @@ static unsigned int tegra_uart_tx_empty(struct uart_port *u)
 static void tegra_uart_stop_tx(struct uart_port *u)
 {
 	struct tegra_uart_port *tup = to_tegra_uport(u);
-	struct circ_buf *xmit = &tup->uport.state->xmit;
 	struct dma_tx_state state;
 	unsigned int count;
 
@@ -624,7 +623,7 @@ static void tegra_uart_stop_tx(struct uart_port *u)
 	dmaengine_tx_status(tup->tx_dma_chan, tup->tx_cookie, &state);
 	count = tup->tx_bytes_requested - state.residue;
 	async_tx_ack(tup->tx_dma_desc);
-	xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1);
+	uart_xmit_advance(&tup->uport, count);
 	tup->tx_in_progress = 0;
 }
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2 3/3] serial: tegra-tcu: Use uart_xmit_advance(), fixes icount.tx accounting
       [not found] <20220830131343.25968-1-ilpo.jarvinen@linux.intel.com>
  2022-08-30 13:13 ` [PATCH v2 2/3] serial: tegra: Use uart_xmit_advance(), fixes icount.tx accounting Ilpo Järvinen
@ 2022-08-30 13:13 ` Ilpo Järvinen
  2022-09-15 12:26   ` Thierry Reding
  1 sibling, 1 reply; 3+ messages in thread
From: Ilpo Järvinen @ 2022-08-30 13:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, linux-serial, Andy Shevchenko,
	Thierry Reding, Jonathan Hunter, linux-tegra, linux-kernel
  Cc: Ilpo Järvinen, stable, Andy Shevchenko

Tx'ing does not correctly account Tx'ed characters into icount.tx.
Using uart_xmit_advance() fixes the problem.

Cc: <stable@vger.kernel.org> # serial: Create uart_xmit_advance()
Fixes: 2d908b38d409 ("serial: Add Tegra Combined UART driver")
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/tty/serial/tegra-tcu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/tegra-tcu.c b/drivers/tty/serial/tegra-tcu.c
index 4877c54c613d..889b701ba7c6 100644
--- a/drivers/tty/serial/tegra-tcu.c
+++ b/drivers/tty/serial/tegra-tcu.c
@@ -101,7 +101,7 @@ static void tegra_tcu_uart_start_tx(struct uart_port *port)
 			break;
 
 		tegra_tcu_write(tcu, &xmit->buf[xmit->tail], count);
-		xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1);
+		uart_xmit_advance(port, count);
 	}
 
 	uart_write_wakeup(port);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 3/3] serial: tegra-tcu: Use uart_xmit_advance(), fixes icount.tx accounting
  2022-08-30 13:13 ` [PATCH v2 3/3] serial: tegra-tcu: " Ilpo Järvinen
@ 2022-09-15 12:26   ` Thierry Reding
  0 siblings, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2022-09-15 12:26 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Greg Kroah-Hartman, Jiri Slaby, linux-serial, Andy Shevchenko,
	Jonathan Hunter, linux-tegra, linux-kernel, stable,
	Andy Shevchenko

[-- Attachment #1: Type: text/plain, Size: 595 bytes --]

On Tue, Aug 30, 2022 at 04:13:43PM +0300, Ilpo Järvinen wrote:
> Tx'ing does not correctly account Tx'ed characters into icount.tx.
> Using uart_xmit_advance() fixes the problem.
> 
> Cc: <stable@vger.kernel.org> # serial: Create uart_xmit_advance()
> Fixes: 2d908b38d409 ("serial: Add Tegra Combined UART driver")
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
>  drivers/tty/serial/tegra-tcu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-15 12:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20220830131343.25968-1-ilpo.jarvinen@linux.intel.com>
2022-08-30 13:13 ` [PATCH v2 2/3] serial: tegra: Use uart_xmit_advance(), fixes icount.tx accounting Ilpo Järvinen
2022-08-30 13:13 ` [PATCH v2 3/3] serial: tegra-tcu: " Ilpo Järvinen
2022-09-15 12:26   ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).