3
0
Fork 0
forked from mirrors/linux
kernel/drivers/tty
Jiri Slaby (SUSE) b495021a97 tty: serial: 8250_omap: fix TX with DMA for am33xx
Commit 1788cf6a91 ("tty: serial: switch from circ_buf to kfifo")
introduced an error in the TX DMA handling for 8250_omap.

When the OMAP_DMA_TX_KICK flag is set, the "skip_byte" is pulled from
the kfifo and emitted directly in order to start the DMA. While the
kfifo is updated, dma->tx_size is not decreased. This leads to
uart_xmit_advance() called in omap_8250_dma_tx_complete() 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 the problem by moving all of the dma setup after the
OMAP_DMA_TX_KICK handling and using kfifo_len() instead of the DMA size
for the 4-byte cutoff check. This slightly changes the behaviour at
buffer wraparound, but it still transmits the correct bytes somehow.

Now, the "skip_byte" would no longer be accounted to the stats. As
previously, dma->tx_size included also this skip byte, up->icount.tx was
updated by aforementioned uart_xmit_advance() in
omap_8250_dma_tx_complete(). Fix this by using the uart_fifo_out()
helper instead of bare kfifo_get().

Based on patch by Mans Rullgard <mans@mansr.com>

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Fixes: 1788cf6a91 ("tty: serial: switch from circ_buf to kfifo")
Link: https://lore.kernel.org/all/20250506150748.3162-1-mans@mansr.com/
Reported-by: Mans Rullgard <mans@mansr.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20250522053835.3495975-1-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-05-22 07:50:45 +02:00
..
hvc s390: Convert MACHINE_IS_[LPAR|VM|KVM], etc, machine_is_[lpar|vm|kvm]() 2025-03-04 17:18:07 +01:00
ipwireless treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
serdev serdev: Refine several error or debug messages 2025-05-01 17:20:49 +02:00
serial tty: serial: 8250_omap: fix TX with DMA for am33xx 2025-05-22 07:50:45 +02:00
vt vt: add VT_GETCONSIZECSRPOS to retrieve console size and cursor position 2025-05-21 13:41:03 +02:00
amiserial.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
ehv_bytechan.c
goldfish.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
Kconfig TTY/Serial driver updates for 6.15-rc1 2025-04-02 18:17:33 -07:00
Makefile
mips_ejtag_fdc.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
moxa.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
mxser.c mxser: Use non-hybrid PCI devres API 2025-04-25 13:42:35 +02:00
n_gsm.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
n_hdlc.c
n_null.c
n_tty.c tty: n_tty: move more_to_be_read to the end of n_tty_read() 2025-03-20 08:00:51 -07:00
nozomi.c
pty.c fsnotify: use accessor to set FMODE_NONOTIFY_* 2025-02-07 10:27:26 +01:00
rpmsg_tty.c
synclink_gt.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
sysrq.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
tty.h
tty_audit.c tty: audit: do not use N_TTY_BUF_SIZE 2025-03-20 08:00:50 -07:00
tty_baudrate.c
tty_buffer.c
tty_io.c tty: use lock guard()s in tty_io 2025-04-25 13:46:31 +02:00
tty_ioctl.c tty: simplify throttling using guard()s 2025-04-25 13:46:30 +02:00
tty_jobctrl.c
tty_ldisc.c
tty_ldsem.c tty/ldsem: Remove unused ldsem_down_write_trylock 2025-02-04 14:38:42 +01:00
tty_mutex.c
tty_port.c tty: Remove unused API tty_port_register_device_serdev() 2025-04-25 13:44:28 +02:00
ttynull.c
vcc.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00