mirror_ubuntu-kernels/drivers/tty/serial
Ilpo Järvinen 039d492637 serial: 8250: Toggle IER bits on only after irq has been set up
Invoking TIOCVHANGUP on 8250_mid port on Ice Lake-D and then reopening
the port triggers these faults during serial8250_do_startup():

  DMAR: DRHD: handling fault status reg 3
  DMAR: [DMA Write NO_PASID] Request device [00:1a.0] fault addr 0x0 [fault reason 0x05] PTE Write access is not set

If the IRQ hasn't been set up yet, the UART will have zeroes in its MSI
address/data registers. Disabling the IRQ at the interrupt controller
won't stop the UART from performing a DMA write to the address programmed
in its MSI address register (zero) when it wants to signal an interrupt.

The UARTs (in Ice Lake-D) implement PCI 2.1 style MSI without masking
capability, so there is no way to mask the interrupt at the source PCI
function level, except disabling the MSI capability entirely, but that
would cause it to fall back to INTx# assertion, and the PCI specification
prohibits disabling the MSI capability as a way to mask a function's
interrupt service request.

The MSI address register is zeroed by the hangup as the irq is freed.
The interrupt is signalled during serial8250_do_startup() performing a
THRE test that temporarily toggles THRI in IER. The THRE test currently
occurs before UART's irq (and MSI address) is properly set up.

Refactor serial8250_do_startup() such that irq is set up before the
THRE test. The current irq setup code is intermixed with the timer
setup code. As THRE test must be performed prior to the timer setup,
extract it into own function and call it only after the THRE test.

The ->setup_timer() needs to be part of the struct uart_8250_ops in
order to not create circular dependency between 8250 and 8250_base
modules.

Fixes: 40b36daad0 ("[PATCH] 8250 UART backup timer")
Reported-by: Lennert Buytenhek <buytenh@arista.com>
Tested-by: Lennert Buytenhek <buytenh@arista.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220922070005.2965-1-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-09-22 16:30:14 +02:00
..
8250 serial: 8250: Toggle IER bits on only after irq has been set up 2022-09-22 16:30:14 +02:00
cpm_uart tty: serial: cpm_uart: remove unused cpm_uart_nr declaration 2022-09-22 16:10:44 +02:00
jsm drivers: serial: jsm: fix some leaks in probe 2022-09-22 16:11:43 +02:00
21285.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
altera_jtaguart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
altera_uart.c tty: serial: altera_uart_{r,t}x_chars() need only uart_port 2022-09-22 16:14:08 +02:00
amba-pl010.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
amba-pl011.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
apbuart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
apbuart.h
ar933x_uart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
arc_uart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
atmel_serial.c Merge 6.0-rc4 into tty-next 2022-09-05 07:59:28 +02:00
atmel_serial.h
bcm63xx_uart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
clps711x.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
digicolor-usart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
dz.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
dz.h
earlycon-arm-semihost.c serial: make uart_console_write->putchar()'s character an unsigned char 2022-03-03 15:06:31 +01:00
earlycon-riscv-sbi.c serial: make uart_console_write->putchar()'s character an unsigned char 2022-03-03 15:06:31 +01:00
earlycon.c tty: move from strlcpy with unused retval to strscpy 2022-08-30 14:21:59 +02:00
fsl_linflexuart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
fsl_lpuart.c Merge 6.0-rc4 into tty-next 2022-09-05 07:59:28 +02:00
icom.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
imx_earlycon.c serial: make uart_console_write->putchar()'s character an unsigned char 2022-03-03 15:06:31 +01:00
imx.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
ip22zilog.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
ip22zilog.h
Kconfig tty: serial: fsl_lpuart: adjust SERIAL_FSL_LPUART_CONSOLE config dependency 2022-08-30 14:14:27 +02:00
kgdb_nmi.c tty: drop put_tty_driver 2021-07-27 12:17:21 +02:00
kgdboc.c serial: kgdboc: Fix typo in comment 2022-06-27 14:37:09 +02:00
lantiq.c tty: serial: extract lqasc_tx_ready() from lqasc_tx_chars() 2022-09-22 16:14:08 +02:00
liteuart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
lpc32xx_hs.c tty: serial: extract tx_ready() from __serial_lpc32xx_tx() 2022-09-22 16:14:08 +02:00
Makefile serial: remove VR41XX serial driver 2022-07-16 08:16:01 +02:00
max310x.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
max3100.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
mcf.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
men_z135_uart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
meson_uart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
milbeaut_usio.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
mpc52xx_uart.c tty: serial: switch mpc52xx_uart_int_{r,t}x_chars() to bool 2022-09-22 16:14:08 +02:00
mps2-uart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
msm_serial.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
mux.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
mvebu-uart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
mxs-auart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
omap-serial.c tty: serial: extract serial_omap_put_char() from transmit_chars() 2022-09-22 16:14:08 +02:00
owl-uart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
pch_uart.c serial: pch_uart: CIRC_CNT_TO_END() is enough 2022-08-30 14:23:05 +02:00
pic32_uart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
pmac_zilog.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
pmac_zilog.h serial: pmac_zilog: remove unused uart_pmac_port::termios_cache 2022-05-19 18:23:19 +02:00
pxa.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
qcom_geni_serial.c tty: serial: qcom-geni-serial: Replace hardcoded icc flags with macros. 2022-09-08 08:19:24 +02:00
rda-uart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
rp2.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
sa1100.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
samsung_tty.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
sb1250-duart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
sc16is7xx.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
sccnxp.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
serial_core.c tty: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
serial_mctrl_gpio.c Documentation: serial: move GPIO kernel-doc to the functions 2022-07-28 10:37:42 +02:00
serial_mctrl_gpio.h serial: mctrl_gpio: add a new API to enable / disable wake_irq 2022-02-08 11:07:16 +01:00
serial_txx9.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
serial-tegra.c serial: tegra: Remove custom frame size calculation 2022-08-30 14:28:33 +02:00
sh-sci.c serial: sh-sci: tail is already on valid range 2022-08-30 14:23:05 +02:00
sh-sci.h serial: sh-sci: Add support for RZ/G2L SoC 2021-06-04 15:12:40 +02:00
sifive.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
sprd_serial.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
st-asc.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
stm32-usart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
stm32-usart.h serial: stm32: make info structs static to avoid sparse warnings 2022-07-28 10:35:23 +02:00
suncore.c
sunhv.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
sunplus-uart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
sunsab.c serial: sunsab: Remove frame size calculation dead-code 2022-08-30 14:28:33 +02:00
sunsab.h
sunsu.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
sunzilog.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
sunzilog.h
tegra-tcu.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
timbuart.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
timbuart.h
uartlite.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
ucc_uart.c serial: ucc_uart: Remove custom frame size calculation 2022-08-30 14:28:33 +02:00
vt8500_serial.c tty: serial: move and cleanup vt8500_tx_empty() 2022-09-22 16:14:07 +02:00
xilinx_uartps.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
zs.c serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
zs.h