diff options
| author | John Ogness <[email protected]> | 2022-05-08 12:41:47 +0206 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2022-05-19 18:29:25 +0200 |
| commit | 589f892ac8ef244e47c5a00ffd8605daa1eaef8e (patch) | |
| tree | 03b8b6c7b138467b524b13509c94817795a90432 /tools/perf/scripts/python/bin | |
| parent | 57f83e5dd6a33c4696699954784f8fee789b1d0c (diff) | |
serial: meson: acquire port->lock in startup()
The uart_ops startup() callback is called without interrupts
disabled and without port->lock locked, relatively late during the
boot process (from the call path of console_on_rootfs()). If the
device is a console, it was already previously registered and could
be actively printing messages.
Since the startup() callback is reading/writing registers used by
the console write() callback (AML_UART_CONTROL), its access must
be synchronized using the port->lock. Currently it is not.
The startup() callback is the only function that explicitly enables
interrupts. Without the synchronization, it is possible that
interrupts become accidentally permanently disabled.
CPU0 CPU1
meson_serial_console_write meson_uart_startup
-------------------------- ------------------
spin_lock(port->lock)
val = readl(AML_UART_CONTROL)
uart_console_write()
writel(INT_EN, AML_UART_CONTROL)
writel(val, AML_UART_CONTROL)
spin_unlock(port->lock)
Add port->lock synchronization to meson_uart_startup() to avoid
racing with meson_serial_console_write().
Also add detailed comments to meson_uart_reset() explaining why it
is *not* using port->lock synchronization.
Link: https://lore.kernel.org/lkml/[email protected]
Fixes: ff7693d079e5 ("ARM: meson: serial: add MesonX SoC on-chip uart driver")
Reported-by: Marek Szyprowski <[email protected]>
Tested-by: Marek Szyprowski <[email protected]>
Reviewed-by: Petr Mladek <[email protected]>
Reviewed-by: Jiri Slaby <[email protected]>
Acked-by: Neil Armstrong <[email protected]>
Signed-off-by: John Ogness <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/bin')
0 files changed, 0 insertions, 0 deletions