[PATCH tty-next v3 0/6] convert 8250 to nbcon

From: John Ogness
Date: Fri Oct 25 2024 - 06:57:46 EST


This is v3 of a series to convert the 8250 driver to an NBCON
console, providing both threaded and atomic printing
implementations. v2 of this series is here [0], which also
contains additional background information about NBCON consoles
in general in the cover letter.

To test this version I acquired real hardware (TI AM3358
BeagleBone Black) and tested the following modes:

RS232
- no flow control
- software flow control
(UPF_SOFT_FLOW, UPSTAT_AUTOXOFF)
- hardware flow control
(UPF_HARD_FLOW, UPSTAT_AUTOCTS, UPSTAT_AUTORTS)
- software emulated hardware flow control
(UPF_CONS_FLOW, UPSTAT_CTS_ENABLE)

RS485
- with SER_RS485_RX_DURING_TX
- without SER_RS485_RX_DURING_TX

The tests focussed on kernel logging in various combinations of
normal, warning, and panic situations. Although not related to
the console printing code changes, the tests also included
using a getty/login session on the console.

Note that this UART (TI16750) supports a 64-byte TX-FIFO, which
is used in all console printing modes except for the software
emulated hardware flow control.

Here are the changes since v2:

- For RS485 start/stop TX, specify if called in console
context.

- For RS485 start/stop TX, when in console context, do not
disable/enable interrupts.

- Relocate modem_status_handler() to avoid unused static
function for some configs.

- Move LSR_THRE waiting into a new
serial8250_console_wait_putchar() function.

- For serial8250_console_fifo_write(), use
serial8250_console_putchar() for writing. This allows newline
tracking for FIFO mode as well.

- For serial8250_console_fifo_write(), allow 10ms timeout for
each byte written.

- Use FIFO mode for thread and atomic modes when available.

- Introduce serial8250_console_byte_write() to handle writing
when not using the FIFO mode.

- Consolidate thread and atomic callbacks. Now the only
difference is modem control: For atomic, called as irq_work.
For thread, called direct.

John Ogness

[0] https://lore.kernel.org/lkml/20240913140538.221708-1-john.ogness@xxxxxxxxxxxxx

John Ogness (6):
serial: 8250: Adjust the timeout for FIFO mode
serial: 8250: Use high-level write function for FIFO
serial: 8250: Split out rx stop/start code into helpers
serial: 8250: Specify console context for rs485_start/stop_tx
serial: 8250: Switch to nbcon console
serial: 8250: Revert "drop lockdep annotation from
serial8250_clear_IER()"

drivers/tty/serial/8250/8250.h | 4 +-
drivers/tty/serial/8250/8250_bcm2835aux.c | 4 +-
drivers/tty/serial/8250/8250_core.c | 35 ++-
drivers/tty/serial/8250/8250_omap.c | 2 +-
drivers/tty/serial/8250/8250_port.c | 267 +++++++++++++++++-----
include/linux/serial_8250.h | 11 +-
6 files changed, 251 insertions(+), 72 deletions(-)


base-commit: 44059790a5cb9258ae6137387e4c39b717fd2ced
--
2.39.5