summaryrefslogtreecommitdiffstats
path: root/debian/patches-rt/0006-serial-omap-Use-uart_prepare_sysrq_char.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches-rt/0006-serial-omap-Use-uart_prepare_sysrq_char.patch')
-rw-r--r--debian/patches-rt/0006-serial-omap-Use-uart_prepare_sysrq_char.patch66
1 files changed, 66 insertions, 0 deletions
diff --git a/debian/patches-rt/0006-serial-omap-Use-uart_prepare_sysrq_char.patch b/debian/patches-rt/0006-serial-omap-Use-uart_prepare_sysrq_char.patch
new file mode 100644
index 000000000..58fe8b132
--- /dev/null
+++ b/debian/patches-rt/0006-serial-omap-Use-uart_prepare_sysrq_char.patch
@@ -0,0 +1,66 @@
+From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Date: Fri, 1 Mar 2024 22:45:19 +0100
+Subject: [PATCH 06/18] serial: omap: Use uart_prepare_sysrq_char().
+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.
+
+Delay handling sysrq until port lock is dropped.
+Remove the special case in the console write routine an always use the
+complete locking function.
+
+Link: https://lore.kernel.org/r/20240301215246.891055-7-bigeasy@linutronix.de
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+---
+ drivers/tty/serial/omap-serial.c | 16 ++++++----------
+ 1 file changed, 6 insertions(+), 10 deletions(-)
+
+--- a/drivers/tty/serial/omap-serial.c
++++ b/drivers/tty/serial/omap-serial.c
+@@ -508,7 +508,7 @@ static void serial_omap_rdi(struct uart_
+
+ up->port.icount.rx++;
+
+- if (uart_handle_sysrq_char(&up->port, ch))
++ if (uart_prepare_sysrq_char(&up->port, ch))
+ return;
+
+ uart_insert_char(&up->port, lsr, UART_LSR_OE, ch, TTY_NORMAL);
+@@ -563,7 +563,7 @@ static irqreturn_t serial_omap_irq(int i
+ }
+ } while (max_count--);
+
+- uart_port_unlock(&up->port);
++ uart_unlock_and_check_sysrq(&up->port);
+
+ tty_flip_buffer_push(&up->port.state->port);
+
+@@ -1212,13 +1212,10 @@ serial_omap_console_write(struct console
+ unsigned int ier;
+ int locked = 1;
+
+- local_irq_save(flags);
+- if (up->port.sysrq)
+- locked = 0;
+- else if (oops_in_progress)
+- locked = uart_port_trylock(&up->port);
++ if (oops_in_progress)
++ locked = uart_port_trylock_irqsave(&up->port, &flags);
+ else
+- uart_port_lock(&up->port);
++ uart_port_lock_irqsave(&up->port, &flags);
+
+ /*
+ * First save the IER then disable the interrupts
+@@ -1245,8 +1242,7 @@ serial_omap_console_write(struct console
+ check_modem_status(up);
+
+ if (locked)
+- uart_port_unlock(&up->port);
+- local_irq_restore(flags);
++ uart_port_unlock_irqrestore(&up->port, flags);
+ }
+
+ static int __init