FAILED: patch "[PATCH] serial: dz: Fix bootconsole handover lockup" failed to apply to 5.10-stable tree
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 7f127b2208e5e2b817243cad41fe4211a6d5a7a3
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026060445-upper-slapstick-c674@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 7f127b2208e5e2b817243cad41fe4211a6d5a7a3 Mon Sep 17 00:00:00 2001
From: "Maciej W. Rozycki" <[email protected]>
Date: Wed, 6 May 2026 23:42:35 +0100
Subject: [PATCH] serial: dz: Fix bootconsole handover lockup
Calling dz_reset() in the course of setting up the serial device causes line parameters to be reset and the transmitter disabled. We've been lucky in that no message is usually produced to the kernel log between this call and the later call to uart_set_options() in the course of console setup done by dz_serial_console_init(), or the system would hang as the console output handler in the firmware tried to access a port the transmitter of which has been disabled and line parameters messed up.
This will change with the next change to the driver, so fix dz_reset() such that line parameters are set for 9600n8 console operation as with the system firmware and the transmitter re-enabled after reset. This also means dz_pm() serves no purpose anymore, so drop it.
drivers/tty/serial/dz.c +12 -24
@@ -571,6 +571,18 @@ static void dz_reset(struct dz_port *dport)while (dz_in (dport,DZ_CSR ) &DZ_CLR );iob (); +/* +* Set parameters across all lines such as not to interfere +* with the initial PROM-based console. Otherwise any output +* produced before the console handover would cause the system +* firmware to produce rubbish. +*/ +for (int line =0 ; line <DZ_NB_PORT ; line++) +dz_out (dport,DZ_LPR ,DZ_B9600 |DZ_CS8 | line); + +/* Re-enable transmission for the initial PROM-based console. */ +dz_out (dport,DZ_TCR , tcr); +/* Enable scanning. */ dz_out (dport,DZ_CSR ,DZ_MSE );
@@ -654,26 +666,6 @@ static void dz_set_termios(struct uart_port *uport, struct ktermios *termios,uart_port_unlock_irqrestore (&dport->port, flags); } -/* -* Hack alert! -* Required solely so that the initial PROM-based console -* works undisturbed in parallel with this one. -*/ -static void dz_pm (struct uart_port *uport,unsigned int state, -unsigned int oldstate) -{ -struct dz_port *dport =to_dport (uport); -unsigned long flags; - -uart_port_lock_irqsave (&dport->port, &flags); -if (state <3 ) -dz_start_tx (&dport->port); -else -dz_stop_tx (&dport->port); -uart_port_unlock_irqrestore (&dport->port, flags); -} - -static const char *dz_type (struct uart_port *uport) {return "DZ" ;
@@ -769,7 +761,6 @@ static const struct uart_ops dz_ops = { .startup = dz_startup, .shutdown = dz_shutdown, .set_termios = dz_set_termios, - .pm = dz_pm, .type = dz_type, .release_port = dz_release_port, .request_port = dz_request_port,
@@ -894,10 +885,7 @@ static int __init dz_console_setup(struct console *co, char *options)if (ret)return ret; -spin_lock_init (&dport->port.lock);/* For dz_pm(). */ -dz_reset (dport); -dz_pm (uport,0 ,-1 );if (options)uart_parse_options (options, &baud, &parity, &bits, &flow);
Maciej W. Rozycki
maintainerPATCH 1/1 serial: dz: Fix bootconsole handover lockup
commit 7f127b2208e5e2b817243cad41fe4211a6d5a7a3 upstream.
Calling dz_reset() in the course of setting up the serial device causes line parameters to be reset and the transmitter disabled. We've been lucky in that no message is usually produced to the kernel log between this call and the later call to uart_set_options() in the course of console setup done by dz_serial_console_init(), or the system would hang as the console output handler in the firmware tried to access a port the transmitter of which has been disabled and line parameters messed up.
This will change with the next change to the driver, so fix dz_reset() such that line parameters are set for 9600n8 console operation as with the system firmware and the transmitter re-enabled after reset. This also means dz_pm() serves no purpose anymore, so drop it.
--- drivers/tty/serial/dz.c | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-)
drivers/tty/serial/dz.c +13 -24
@@ -546,6 +546,7 @@ static void dz_reset(struct dz_port *dport)struct dz_mux *mux = dport->mux;unsigned short tcr;int loops =10000 ; +int line;if (mux->initialised)return ;
@@ -573,6 +574,18 @@ static void dz_reset(struct dz_port *dport)while (dz_in (dport,DZ_CSR ) &DZ_CLR );iob (); +/* +* Set parameters across all lines such as not to interfere +* with the initial PROM-based console. Otherwise any output +* produced before the console handover would cause the system +* firmware to produce rubbish. +*/ +for (line =0 ; line <DZ_NB_PORT ; line++) +dz_out (dport,DZ_LPR ,DZ_B9600 |DZ_CS8 | line); + +/* Re-enable transmission for the initial PROM-based console. */ +dz_out (dport,DZ_TCR , tcr); +/* Enable scanning. */ dz_out (dport,DZ_CSR ,DZ_MSE );
@@ -653,26 +666,6 @@ static void dz_set_termios(struct uart_port *uport, struct ktermios *termios,spin_unlock_irqrestore (&dport->port.lock, flags); } -/* -* Hack alert! -* Required solely so that the initial PROM-based console -* works undisturbed in parallel with this one. -*/ -static void dz_pm (struct uart_port *uport,unsigned int state, -unsigned int oldstate) -{ -struct dz_port *dport =to_dport (uport); -unsigned long flags; - -spin_lock_irqsave (&dport->port.lock, flags); -if (state <3 ) -dz_start_tx (&dport->port); -else -dz_stop_tx (&dport->port); -spin_unlock_irqrestore (&dport->port.lock, flags); -} - -static const char *dz_type (struct uart_port *uport) {return "DZ" ;
@@ -768,7 +761,6 @@ static const struct uart_ops dz_ops = { .startup = dz_startup, .shutdown = dz_shutdown, .set_termios = dz_set_termios, - .pm = dz_pm, .type = dz_type, .release_port = dz_release_port, .request_port = dz_request_port,
@@ -893,10 +885,7 @@ static int __init dz_console_setup(struct console *co, char *options)if (ret)return ret; -spin_lock_init (&dport->port.lock);/* For dz_pm(). */ -dz_reset (dport); -dz_pm (uport,0 ,-1 );if (options)uart_parse_options (options, &baud, &parity, &bits, &flow);
Signature · 1 line
2.20.1