summaryrefslogtreecommitdiffstats
path: root/debian/patches-rt/0012-serial-sifive-Use-uart_prepare_sysrq_char-to-handle-.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 18:50:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 18:50:59 +0000
commitba6b167af6ee5e63ca79ad22e7719644aed12b2c (patch)
tree62272cbe2fb256ecb90fa6e2cbfa509541954d28 /debian/patches-rt/0012-serial-sifive-Use-uart_prepare_sysrq_char-to-handle-.patch
parentMerging upstream version 6.8.9. (diff)
downloadlinux-ba6b167af6ee5e63ca79ad22e7719644aed12b2c.tar.xz
linux-ba6b167af6ee5e63ca79ad22e7719644aed12b2c.zip
Merging debian version 6.8.9-1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches-rt/0012-serial-sifive-Use-uart_prepare_sysrq_char-to-handle-.patch')
-rw-r--r--debian/patches-rt/0012-serial-sifive-Use-uart_prepare_sysrq_char-to-handle-.patch71
1 files changed, 71 insertions, 0 deletions
diff --git a/debian/patches-rt/0012-serial-sifive-Use-uart_prepare_sysrq_char-to-handle-.patch b/debian/patches-rt/0012-serial-sifive-Use-uart_prepare_sysrq_char-to-handle-.patch
new file mode 100644
index 0000000000..5b82468e40
--- /dev/null
+++ b/debian/patches-rt/0012-serial-sifive-Use-uart_prepare_sysrq_char-to-handle-.patch
@@ -0,0 +1,71 @@
+From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Date: Fri, 1 Mar 2024 22:45:25 +0100
+Subject: [PATCH 12/18] serial: sifive: 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: Palmer Dabbelt <palmer@dabbelt.com>
+Cc: Paul Walmsley <paul.walmsley@sifive.com>
+Cc: linux-riscv@lists.infradead.org
+Link: https://lore.kernel.org/r/20240301215246.891055-13-bigeasy@linutronix.de
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+---
+ drivers/tty/serial/sifive.c | 17 +++++++----------
+ 1 file changed, 7 insertions(+), 10 deletions(-)
+
+--- a/drivers/tty/serial/sifive.c
++++ b/drivers/tty/serial/sifive.c
+@@ -412,7 +412,8 @@ static void __ssp_receive_chars(struct s
+ break;
+
+ ssp->port.icount.rx++;
+- uart_insert_char(&ssp->port, 0, 0, ch, TTY_NORMAL);
++ if (!uart_prepare_sysrq_char(&ssp->port, ch))
++ uart_insert_char(&ssp->port, 0, 0, ch, TTY_NORMAL);
+ }
+
+ tty_flip_buffer_push(&ssp->port.state->port);
+@@ -534,7 +535,7 @@ static irqreturn_t sifive_serial_irq(int
+ if (ip & SIFIVE_SERIAL_IP_TXWM_MASK)
+ __ssp_transmit_chars(ssp);
+
+- uart_port_unlock(&ssp->port);
++ uart_unlock_and_check_sysrq(&ssp->port);
+
+ return IRQ_HANDLED;
+ }
+@@ -791,13 +792,10 @@ static void sifive_serial_console_write(
+ if (!ssp)
+ return;
+
+- local_irq_save(flags);
+- if (ssp->port.sysrq)
+- locked = 0;
+- else if (oops_in_progress)
+- locked = uart_port_trylock(&ssp->port);
++ if (oops_in_progress)
++ locked = uart_port_trylock_irqsave(&ssp->port, &flags);
+ else
+- uart_port_lock(&ssp->port);
++ uart_port_lock_irqsave(&ssp->port, &flags);
+
+ ier = __ssp_readl(ssp, SIFIVE_SERIAL_IE_OFFS);
+ __ssp_writel(0, SIFIVE_SERIAL_IE_OFFS, ssp);
+@@ -807,8 +805,7 @@ static void sifive_serial_console_write(
+ __ssp_writel(ier, SIFIVE_SERIAL_IE_OFFS, ssp);
+
+ if (locked)
+- uart_port_unlock(&ssp->port);
+- local_irq_restore(flags);
++ uart_port_unlock_irqrestore(&ssp->port, flags);
+ }
+
+ static int sifive_serial_console_setup(struct console *co, char *options)