diff options
author | Anssi Hannula <anssi.hannula@bitwise.fi> | 2019-02-15 19:45:08 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-02-19 15:42:07 +0300 |
commit | 7abab1605139bc41442864c18f9573440f7ca105 (patch) | |
tree | 1bdafd100c06297dfc856254514a6b9dcff8a77c /drivers/tty/n_gsm.c | |
parent | b289c496e52a9bcd5de098dd13e6609859d5a061 (diff) | |
download | linux-7abab1605139bc41442864c18f9573440f7ca105.tar.xz |
serial: uartps: Fix stuck ISR if RX disabled with non-empty FIFO
If RX is disabled while there are still unprocessed bytes in RX FIFO,
cdns_uart_handle_rx() called from interrupt handler will get stuck in
the receive loop as read bytes will not get removed from the RX FIFO
and CDNS_UART_SR_RXEMPTY bit will never get set.
Avoid the stuck handler by checking first if RX is disabled. port->lock
protects against race with RX-disabling functions.
This HW behavior was mentioned by Nathan Rossi in 43e98facc4a3 ("tty:
xuartps: Fix RX hang, and TX corruption in termios call") which fixed a
similar issue in cdns_uart_set_termios().
The behavior can also be easily verified by e.g. setting
CDNS_UART_CR_RX_DIS at the beginning of cdns_uart_handle_rx() - the
following loop will then get stuck.
Resetting the FIFO using RXRST would not set RXEMPTY either so simply
issuing a reset after RX-disable would not work.
I observe this frequently on a ZynqMP board during heavy RX load at 1M
baudrate when the reader process exits and thus RX gets disabled.
Fixes: 61ec9016988f ("tty/serial: add support for Xilinx PS UART")
Signed-off-by: Anssi Hannula <anssi.hannula@bitwise.fi>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/n_gsm.c')
0 files changed, 0 insertions, 0 deletions