NVIDIA: SAUCE: tty: serial: Quick fix for kernel crash

BugLink: https://bugs.launchpad.net/bugs/2080908

During the boot, kernel get crashed and this is due to
some changes done for RT patches
  printk: nbcon: Implement processing in port->lock wrapper
  serial: amba-pl011: Use uart_prepare_sysrq_char()

Instead of full revert of above patches, updating the
drivers/tty/serial/amba-pl011.c to get the kernel crash fix.

This is quick fix and proper fix needs to be implement after
finding the rootcause.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Noah Wager <noah.wager@canonical.com>
Acked-by: Jacob Martin <jacob.martin@canonical.com>
Signed-off-by: Noah Wager <noah.wager@canonical.com>
This commit is contained in:
Laxman Dewangan
2024-09-15 20:04:01 +00:00
committed by Noah Wager
parent 67420e239d
commit e5dd636522
+16 -9
View File
@@ -395,7 +395,10 @@ static int pl011_fifo_to_tty(struct uart_amba_port *uap)
flag = TTY_FRAME;
}
sysrq = uart_prepare_sysrq_char(&uap->port, ch & 255);
uart_port_unlock(&uap->port);
sysrq = uart_handle_sysrq_char(&uap->port, ch & 255);
uart_port_lock(&uap->port);
if (!sysrq)
uart_insert_char(&uap->port, ch, UART011_DR_OE, ch, flag);
}
@@ -1074,7 +1077,7 @@ static void pl011_dma_rx_callback(void *data)
ret = pl011_dma_rx_trigger_dma(uap);
pl011_dma_rx_chars(uap, pending, lastbuf, false);
uart_unlock_and_check_sysrq(&uap->port);
uart_port_unlock_irq(&uap->port);
/*
* Do this check after we picked the DMA chars so we don't
* get some IRQ immediately from RX.
@@ -1608,11 +1611,11 @@ static void check_apply_cts_event_workaround(struct uart_amba_port *uap)
static irqreturn_t pl011_int(int irq, void *dev_id)
{
struct uart_amba_port *uap = dev_id;
unsigned int status, pass_counter = AMBA_ISR_PASS_LIMIT;
unsigned long flags;
unsigned int status, pass_counter = AMBA_ISR_PASS_LIMIT;
int handled = 0;
uart_port_lock(&uap->port);
uart_port_lock_irqsave(&uap->port, &flags);
status = pl011_read(uap, REG_RIS) & uap->im;
if (status) {
do {
@@ -2447,10 +2450,13 @@ pl011_console_write(struct console *co, const char *s, unsigned int count)
clk_enable(uap->clk);
if (oops_in_progress)
locked = uart_port_trylock_irqsave(&uap->port, &flags);
local_irq_save(flags);
if (uap->port.sysrq)
locked = 0;
else if (oops_in_progress)
locked = uart_port_trylock(&uap->port);
else
uart_port_lock_irqsave(&uap->port, &flags);
uart_port_lock(&uap->port);
/*
* First save the CR then disable the interrupts
@@ -2476,7 +2482,8 @@ pl011_console_write(struct console *co, const char *s, unsigned int count)
pl011_write(old_cr, uap, REG_CR);
if (locked)
uart_port_unlock_irqrestore(&uap->port, flags);
uart_port_unlock(&uap->port);
local_irq_restore(flags);
clk_disable(uap->clk);
}
@@ -2617,7 +2624,7 @@ static int pl011_console_match(struct console *co, char *name, int idx,
continue;
co->index = i;
uart_port_set_cons(port, co);
port->cons = co;
return pl011_console_setup(co, options);
}