]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
tty: serial: imx: disable TXDC IRQ in imx_uart_shutdown() to avoid IRQ storm
authorMatthias Schiffer <matthias.schiffer@ew.tq-group.com>
Fri, 25 Sep 2020 08:24:12 +0000 (10:24 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Sep 2020 12:31:04 +0000 (14:31 +0200)
commitedd64f30792dca1aee1fc27381b7c9c1ec0e9e58
treefb87006abbf8dda3ab65082a12df96ad970b05f9
parent409cc4541ade015acd11f2566dcda599363a87a3
tty: serial: imx: disable TXDC IRQ in imx_uart_shutdown() to avoid IRQ storm

The IPG clock is disabled at the end of imx_uart_shutdown(); we really
don't want to run any IRQ handlers after this point.

At least on i.MX8MN, the UART will happily continue to generate interrupts
even with its clocks disabled, but in this state, all register writes are
ignored (which will cause the shadow registers to differ from the actual
register values, resulting in all kinds of weirdness).

In a transfer without DMA, this could lead to the following sequence of
events:

- The UART finishes its transmission while imx_uart_shutdown() is run,
  triggering the TXDC interrupt (we can trigger this fairly reliably by
  writing a single byte to the TTY and closing it right away)
- imx_uart_shutdown() finishes, disabling the UART clocks
- imx_uart_int() -> imx_uart_transmit_buffer() -> imx_uart_stop_tx()

imx_uart_stop_tx() should now clear UCR4_TCEN to disable the TXDC
interrupt, but this register write is ineffective. This results in an
interrupt storm.

To disable all interrupts in the same place, and to avoid setting UCR4
twice, clearing UCR4_OREN is moved below del_timer_sync() as well; this
should be harmless.

Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Link: https://lore.kernel.org/r/20200925082412.12960-1-matthias.schiffer@ew.tq-group.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/imx.c