Commit fb793b95 authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Greg Kroah-Hartman

serial: meson: Use uart_prepare_sysrq_char().

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.

Cc: Kevin Hilman <khilman@baylibre.com>
Cc: Jerome Brunet <jbrunet@baylibre.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-amlogic@lists.infradead.org
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Link: https://lore.kernel.org/r/20240301215246.891055-5-bigeasy@linutronix.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8c1cbc5a
...@@ -220,7 +220,7 @@ static void meson_receive_chars(struct uart_port *port) ...@@ -220,7 +220,7 @@ static void meson_receive_chars(struct uart_port *port)
continue; continue;
} }
if (uart_handle_sysrq_char(port, ch)) if (uart_prepare_sysrq_char(port, ch))
continue; continue;
if ((status & port->ignore_status_mask) == 0) if ((status & port->ignore_status_mask) == 0)
...@@ -248,7 +248,7 @@ static irqreturn_t meson_uart_interrupt(int irq, void *dev_id) ...@@ -248,7 +248,7 @@ static irqreturn_t meson_uart_interrupt(int irq, void *dev_id)
meson_uart_start_tx(port); meson_uart_start_tx(port);
} }
uart_port_unlock(port); uart_unlock_and_check_sysrq(port);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -556,18 +556,13 @@ static void meson_serial_port_write(struct uart_port *port, const char *s, ...@@ -556,18 +556,13 @@ static void meson_serial_port_write(struct uart_port *port, const char *s,
u_int count) u_int count)
{ {
unsigned long flags; unsigned long flags;
int locked; int locked = 1;
u32 val, tmp; u32 val, tmp;
local_irq_save(flags); if (oops_in_progress)
if (port->sysrq) { locked = uart_port_trylock_irqsave(port, &flags);
locked = 0; else
} else if (oops_in_progress) { uart_port_lock_irqsave(port, &flags);
locked = uart_port_trylock(port);
} else {
uart_port_lock(port);
locked = 1;
}
val = readl(port->membase + AML_UART_CONTROL); val = readl(port->membase + AML_UART_CONTROL);
tmp = val & ~(AML_UART_TX_INT_EN | AML_UART_RX_INT_EN); tmp = val & ~(AML_UART_TX_INT_EN | AML_UART_RX_INT_EN);
...@@ -577,8 +572,7 @@ static void meson_serial_port_write(struct uart_port *port, const char *s, ...@@ -577,8 +572,7 @@ static void meson_serial_port_write(struct uart_port *port, const char *s,
writel(val, port->membase + AML_UART_CONTROL); writel(val, port->membase + AML_UART_CONTROL);
if (locked) if (locked)
uart_port_unlock(port); uart_port_unlock_irqrestore(port, flags);
local_irq_restore(flags);
} }
static void meson_serial_console_write(struct console *co, const char *s, static void meson_serial_console_write(struct console *co, const char *s,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment