Skip to content

Commit 302fbbb

Browse files
jognessgregkh
authored andcommitted
serial: 8250: Ignore flow control on suspend/resume with no_console_suspend
If no_console_suspend is specified, on suspend the 8250 console driver uses a scratch register (UART_SCR) to store a special canary value. This is used during the resume path to identify a printk() call before the driver's own ->resume() callback. In this case, serial8250_console_restore() is called to quickly re-init the 8250 for console printing. See commit 4516d50 ("serial: 8250: Use canary to restart console after suspend") for the original motivation. Unfortunately, this canary workaround does not work in all cases (such as suspend to mem) because the scratch register will not reset. This has not been a real issue until now because it could simply lead to some garbage characters upon resume. However, with the introduction of console flow control it becomes a real problem because a failed suspend/resume detection when flow control is enabled leads to all characters hitting the flow control timeout. Workaround this issue by temporarily ignoring console flow control when the debug canary suspend/resume detection is active. Fixes: 5e6dfb8 ("serial: 8250: Add support for console flow control") Signed-off-by: John Ogness <john.ogness@linutronix.de> Link: https://patch.msgid.link/20260707141032.5074-1-john.ogness@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b1b4efe commit 302fbbb

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

drivers/tty/serial/8250/8250_port.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2000,8 +2000,14 @@ static void wait_for_xmitr(struct uart_8250_port *up, int bits)
20002000

20012001
tx_ready = wait_for_lsr(up, bits);
20022002

2003-
/* Wait up to 1s for flow control if necessary */
2004-
if (uart_console_hwflow_active(&up->port)) {
2003+
/*
2004+
* Wait up to 1s for flow control if necessary.
2005+
* When 'no_console_suspend' is active (in the window between
2006+
* suspend() and resume()), flow control is temporarily ignored
2007+
* because the canary workaround is not reliable in all situations,
2008+
* leading to flow control timeouts for every character.
2009+
*/
2010+
if (uart_console_hwflow_active(&up->port) && !up->canary) {
20052011
for (tmout = 1000000; tmout; tmout--) {
20062012
unsigned int msr = serial_in(up, UART_MSR);
20072013
up->msr_saved_flags |= msr & MSR_SAVE_FLAGS;

0 commit comments

Comments
 (0)