freebsd-dev/sys/dev/uart
Mitchell Horne 7e7f7beee7 ns8250: don't drop IER_TXRDY on bus_grab/ungrab
It has been observed that some systems are often unable to resume from
ddb after entering with debug.kdb.enter=1. Checking the status further
shows the terminal is blocked waiting in tty_drain(), but it never makes
progress in clearing the output queue, because sc->sc_txbusy is high.

I noticed that when entering polling mode for the debugger, IER_TXRDY is
set in the failure case. Since this bit is never tracked by the softc,
it will not be restored by ns8250_bus_ungrab(). This creates a race in
which a TX interrupt can be lost, creating the hang described above.
Ensuring that this bit is restored is enough to prevent this, and resume
from ddb as expected.

The solution is to track this bit in the sc->ier field, for the same
lifetime that TX interrupts are enabled.

PR:		223917, 240122
Reviewed by:	imp, manu
Tested by:	bz
MFC after:	5 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29130
2021-03-10 11:04:42 -04:00
..
uart_bus_acpi.c
uart_bus_fdt.c
uart_bus_isa.c
uart_bus_pci.c
uart_bus_puc.c
uart_bus_scc.c
uart_bus.h
uart_core.c
uart_cpu_acpi.c
uart_cpu_acpi.h
uart_cpu_arm64.c
uart_cpu_fdt.c
uart_cpu_fdt.h
uart_cpu_powerpc.c
uart_cpu_x86.c
uart_cpu.h
uart_dbg.c
uart_dev_imx.c
uart_dev_imx.h
uart_dev_lowrisc.c
uart_dev_lowrisc.h
uart_dev_msm.c
uart_dev_msm.h
uart_dev_mu.c
uart_dev_mvebu.c
uart_dev_ns8250.c
uart_dev_ns8250.h
uart_dev_pl011.c
uart_dev_quicc.c
uart_dev_snps.c
uart_dev_ti8250.c
uart_dev_z8530.c
uart_if.m
uart_ppstypes.h
uart_subr.c
uart_tty.c
uart.h