summaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/8250/8250_aspeed_vuart.c
diff options
context:
space:
mode:
authorJohn Ogness <john.ogness@linutronix.de>2023-05-25 11:37:59 +0206
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-05-30 11:45:42 +0100
commitd0b309a5d3f4648fd4fb1a255a7ae9fb98d87be3 (patch)
tree89d0491d91746e06337ec8e8fc0a1172a7f95494 /drivers/tty/serial/8250/8250_aspeed_vuart.c
parent25614735a647693c1260f253dc3ab32127697806 (diff)
downloadlinux-d0b309a5d3f4648fd4fb1a255a7ae9fb98d87be3.tar.gz
linux-d0b309a5d3f4648fd4fb1a255a7ae9fb98d87be3.tar.bz2
linux-d0b309a5d3f4648fd4fb1a255a7ae9fb98d87be3.zip
serial: 8250: synchronize and annotate UART_IER access
The UART_IER register is modified twice by each console write (serial8250_console_write()) under the port lock. Any driver code that accesses UART_IER must do so with the port locked in order to ensure consistent values, even when for read accesses. Add locking, lockdep notation, and/or comments everywhere UART_IER is accessed. The added locking is not fixing a real problem because it occurs where the console is not active. However, adding the locking to these non-critical paths greatly simplifies UART_IER access tracking by establishing a general policy that all UART_IER access is performed with the port locked. Signed-off-by: John Ogness <john.ogness@linutronix.de> Link: https://lore.kernel.org/r/20230525093159.223817-9-john.ogness@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/8250/8250_aspeed_vuart.c')
-rw-r--r--drivers/tty/serial/8250/8250_aspeed_vuart.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/tty/serial/8250/8250_aspeed_vuart.c b/drivers/tty/serial/8250/8250_aspeed_vuart.c
index 9d2a7856784f..4a9e71b2dbbc 100644
--- a/drivers/tty/serial/8250/8250_aspeed_vuart.c
+++ b/drivers/tty/serial/8250/8250_aspeed_vuart.c
@@ -275,6 +275,9 @@ static void __aspeed_vuart_set_throttle(struct uart_8250_port *up,
{
unsigned char irqs = UART_IER_RLSI | UART_IER_RDI;
+ /* Port locked to synchronize UART_IER access against the console. */
+ lockdep_assert_held_once(&up->port.lock);
+
up->ier &= ~irqs;
if (!throttle)
up->ier |= irqs;