summaryrefslogtreecommitdiffstats
path: root/debian/patches-rt/0011-serial-rda-Use-uart_prepare_sysrq_char-to-handle-sys.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 18:50:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 18:50:31 +0000
commitf7bf6055eb1e7ff603f0907b18ece35c72b05302 (patch)
tree13ac5b481056384a3ccc7979b86a42d208fcacdc /debian/patches-rt/0011-serial-rda-Use-uart_prepare_sysrq_char-to-handle-sys.patch
parentMerging upstream version 6.8.9. (diff)
downloadlinux-f7bf6055eb1e7ff603f0907b18ece35c72b05302.tar.xz
linux-f7bf6055eb1e7ff603f0907b18ece35c72b05302.zip
Adding debian version 6.8.9-1.debian/6.8.9-1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches-rt/0011-serial-rda-Use-uart_prepare_sysrq_char-to-handle-sys.patch')
-rw-r--r--debian/patches-rt/0011-serial-rda-Use-uart_prepare_sysrq_char-to-handle-sys.patch91
1 files changed, 91 insertions, 0 deletions
diff --git a/debian/patches-rt/0011-serial-rda-Use-uart_prepare_sysrq_char-to-handle-sys.patch b/debian/patches-rt/0011-serial-rda-Use-uart_prepare_sysrq_char-to-handle-sys.patch
new file mode 100644
index 0000000000..35d33ed2f9
--- /dev/null
+++ b/debian/patches-rt/0011-serial-rda-Use-uart_prepare_sysrq_char-to-handle-sys.patch
@@ -0,0 +1,91 @@
+From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Date: Fri, 1 Mar 2024 22:45:24 +0100
+Subject: [PATCH 11/18] serial: rda: Use uart_prepare_sysrq_char() to handle
+ sysrq.
+Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/6.8/older/patches-6.8.2-rt11.tar.xz
+
+The port lock is a spinlock_t which is becomes a sleeping lock on PREEMPT_RT.
+The driver splits the locking function into two parts: local_irq_save() and
+uart_port_lock() and this breaks PREEMPT_RT.
+
+Handle sysrq requests sysrq once the port lock is dropped.
+Remove the special case in the console write routine an always use the
+complete locking function.
+
+Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
+Cc: linux-arm-kernel@lists.infradead.org
+Cc: linux-unisoc@lists.infradead.org
+Link: https://lore.kernel.org/r/20240301215246.891055-12-bigeasy@linutronix.de
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+---
+ drivers/tty/serial/rda-uart.c | 28 ++++++++++------------------
+ 1 file changed, 10 insertions(+), 18 deletions(-)
+
+--- a/drivers/tty/serial/rda-uart.c
++++ b/drivers/tty/serial/rda-uart.c
+@@ -394,7 +394,8 @@ static void rda_uart_receive_chars(struc
+ val &= 0xff;
+
+ port->icount.rx++;
+- tty_insert_flip_char(&port->state->port, val, flag);
++ if (!uart_prepare_sysrq_char(port, val))
++ tty_insert_flip_char(&port->state->port, val, flag);
+
+ status = rda_uart_read(port, RDA_UART_STATUS);
+ }
+@@ -405,10 +406,9 @@ static void rda_uart_receive_chars(struc
+ static irqreturn_t rda_interrupt(int irq, void *dev_id)
+ {
+ struct uart_port *port = dev_id;
+- unsigned long flags;
+ u32 val, irq_mask;
+
+- uart_port_lock_irqsave(port, &flags);
++ uart_port_lock(port);
+
+ /* Clear IRQ cause */
+ val = rda_uart_read(port, RDA_UART_IRQ_CAUSE);
+@@ -425,7 +425,7 @@ static irqreturn_t rda_interrupt(int irq
+ rda_uart_send_chars(port);
+ }
+
+- uart_port_unlock_irqrestore(port, flags);
++ uart_unlock_and_check_sysrq(port);
+
+ return IRQ_HANDLED;
+ }
+@@ -590,18 +590,12 @@ static void rda_uart_port_write(struct u
+ {
+ u32 old_irq_mask;
+ unsigned long flags;
+- int locked;
++ int locked = 1;
+
+- local_irq_save(flags);
+-
+- if (port->sysrq) {
+- locked = 0;
+- } else if (oops_in_progress) {
+- locked = uart_port_trylock(port);
+- } else {
+- uart_port_lock(port);
+- locked = 1;
+- }
++ if (oops_in_progress)
++ locked = uart_port_trylock_irqsave(port, &flags);
++ else
++ uart_port_lock_irqsave(port, &flags);
+
+ old_irq_mask = rda_uart_read(port, RDA_UART_IRQ_MASK);
+ rda_uart_write(port, 0, RDA_UART_IRQ_MASK);
+@@ -615,9 +609,7 @@ static void rda_uart_port_write(struct u
+ rda_uart_write(port, old_irq_mask, RDA_UART_IRQ_MASK);
+
+ if (locked)
+- uart_port_unlock(port);
+-
+- local_irq_restore(flags);
++ uart_port_unlock_irqrestore(port, flags);
+ }
+
+ static void rda_uart_console_write(struct console *co, const char *s,