All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] serial: 8250: calculate TX length before preparing DMA flow control
@ 2026-10-22 17:14 James Hilliard
  2026-10-22 17:18 ` sashiko-bot
  2026-10-23  7:42 ` Miquel Raynal
  0 siblings, 2 replies; 3+ messages in thread
From: James Hilliard @ 2026-10-22 17:14 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Raul E Rangel, Ilpo Järvinen,
	Andy Shevchenko, Heikki Krogerus, Miquel Raynal, Phil Edworthy
  Cc: linux-kernel, linux-serial, James Hilliard

The Renesas RZ/N1 preparation hook programs the UART DMA block size from
dma->tx_size. The generic TX path calls that hook before calculating the
length of the new transfer, so it programs zero on the first transfer and
the previous length on subsequent transfers.

Calculate the scatterlist length before calling the preparation hook so
the UART flow controller and DMA descriptor use the same transfer size.

Fixes: aa63d786cea2 ("serial: 8250: dw: Add support for DMA flow controlling devices")
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
 drivers/tty/serial/8250/8250_dma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c
index 1da605cc8601..2dc47adafec0 100644
--- a/drivers/tty/serial/8250/8250_dma.c
+++ b/drivers/tty/serial/8250/8250_dma.c
@@ -110,8 +110,6 @@ int serial8250_tx_dma(struct uart_8250_port *p)
 		return 0;
 	}
 
-	serial8250_do_prepare_tx_dma(p);
-
 	sg_init_table(sgl, ARRAY_SIZE(sgl));
 
 	ret = kfifo_dma_out_prepare_mapped(&tport->xmit_fifo, sgl, ARRAY_SIZE(sgl),
@@ -122,6 +120,8 @@ int serial8250_tx_dma(struct uart_8250_port *p)
 	for_each_sg(sgl, sg, ret, i)
 		dma->tx_size += sg_dma_len(sg);
 
+	serial8250_do_prepare_tx_dma(p);
+
 	desc = dmaengine_prep_slave_sg(dma->txchan, sgl, ret,
 				       DMA_MEM_TO_DEV,
 				       DMA_PREP_INTERRUPT | DMA_CTRL_ACK);

---
base-commit: 1184f87e2790e8af9be3116f608d2e86b4792d7d
change-id: 20261022-submit-serial-8250-dma-tx-length-v1-bf627278129a

Best regards,
--  
James Hilliard <james.hilliard1@gmail.com>


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

* Re: [PATCH] serial: 8250: calculate TX length before preparing DMA flow control
  2026-10-22 17:14 [PATCH] serial: 8250: calculate TX length before preparing DMA flow control James Hilliard
@ 2026-10-22 17:18 ` sashiko-bot
  2026-10-23  7:42 ` Miquel Raynal
  1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-10-22 17:18 UTC (permalink / raw)
  To: James Hilliard; +Cc: linux-serial

> The Renesas RZ/N1 preparation hook programs the UART DMA block size from
> dma->tx_size. The generic TX path calls that hook before calculating the
> length of the new transfer, so it programs zero on the first transfer and
> the previous length on subsequent transfers.
> 
> Calculate the scatterlist length before calling the preparation hook so
> the UART flow controller and DMA descriptor use the same transfer size.
> 
> Fixes: aa63d786cea2 ("serial: 8250: dw: Add support for DMA flow controlling devices")
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261022-submit-serial-8250-dma-tx-length-v1-v1-1-18cecc89a099@gmail.com?part=1


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

* Re: [PATCH] serial: 8250: calculate TX length before preparing DMA flow control
  2026-10-22 17:14 [PATCH] serial: 8250: calculate TX length before preparing DMA flow control James Hilliard
  2026-10-22 17:18 ` sashiko-bot
@ 2026-10-23  7:42 ` Miquel Raynal
  1 sibling, 0 replies; 3+ messages in thread
From: Miquel Raynal @ 2026-10-23  7:42 UTC (permalink / raw)
  To: James Hilliard
  Cc: Greg Kroah-Hartman, Jiri Slaby, Raul E Rangel, Ilpo Järvinen,
	Andy Shevchenko, Heikki Krogerus, Phil Edworthy, linux-kernel,
	linux-serial

Hi James,

On 22/10/2026 at 11:14:41 -06, James Hilliard <james.hilliard1@gmail.com> wrote:

> The Renesas RZ/N1 preparation hook programs the UART DMA block size from
> dma->tx_size. The generic TX path calls that hook before calculating the
> length of the new transfer, so it programs zero on the first transfer and
> the previous length on subsequent transfers.
>
> Calculate the scatterlist length before calling the preparation hook so
> the UART flow controller and DMA descriptor use the same transfer size.
>
> Fixes: aa63d786cea2 ("serial: 8250: dw: Add support for DMA flow
> controlling devices")

This is the wrong fixes. Watch out 1788cf6a91d9 ("tty: serial: switch
from circ_buf to kfifo"). This is the one moving the size assignment
after the do_prepare_tx_dma() call.

Also requires to be backported, so Cc: stable.

Thanks,
Miquèl

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

end of thread, other threads:[~2026-10-23  7:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-22 17:14 [PATCH] serial: 8250: calculate TX length before preparing DMA flow control James Hilliard
2026-10-22 17:18 ` sashiko-bot
2026-10-23  7:42 ` Miquel Raynal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.