mbox series

[v9,0/4] Serial: 8250: Fix PSLVERR related issues

Message ID 20250610092135.28738-1-cuiyunhui@bytedance.com
Headers show
Series Serial: 8250: Fix PSLVERR related issues | expand

Message

Yunhui Cui June 10, 2025, 9:21 a.m. UTC
Cause of PSLVERR:
When the PSLVERR_RESP_EN parameter is set to 1, the device generates
an error response if an attempt is made to read an empty RBR
(Receive Buffer Register) while the FIFO is enabled.

Patch[1]: Fixes a panic caused by PSLVERR due to concurrent UART access.
Patch[2]: Fixes a panic caused by PSLVERR during RX_TIMEOUT conditions.
Patch[3] & Patch[4]: Improvements to minimize the occurrence of PSLVERR.

v1 -> v2:
Added UART_LSR_DR check in shutdown() to avoid PSLVERR issues.
Added Fixes: tag to reference upstream issues.
v2 -> v3:
Added lock protection in more functions (e.g., autoconfig_irq()) to
ensure atomicity.
Used lockdep_assert_held_once to detect potential deadlock risks early.
v3 -> v4:
Introduced serial8250_discard_data() to unify data read logic and avoid
code duplication.
Addressed PSLVERR caused by RX_TIMEOUT.
Split complex fixes into multiple patches (1/4 to 4/4).
v4 -> v5:
Removed reads from UART_FCR, using up->fcr to determine FIFO enable status.
Removed return value from serial8250_discard_data().
v5 -> v6:
Based on latest linux-next code: Resolved redundant dont_test_tx_en code.
Updated comments and git commit descriptions.
v6 -> v7:
Reverted PSLVERR-related changes in serial8250_get_poll_char().
v7 -> v8:
Added Cc: stable@vger.kernel.org to patch[1] and patch[4].
v8 -> v9:
Reordered the patches: bugfixes as 1-2, improvements as 3-4.

Yunhui Cui (4):
  serial: 8250: fix panic due to PSLVERR
  serial: 8250_dw: fix PSLVERR on RX_TIMEOUT
  serial: 8250: avoid potential PSLVERR issue
  serial: 8250_dw: assert port->lock is held in dw8250_force_idle()

 drivers/tty/serial/8250/8250.h      | 13 +++++++++++++
 drivers/tty/serial/8250/8250_dw.c   | 14 +++++++++++++-
 drivers/tty/serial/8250/8250_port.c | 29 +++++++++++++++++------------
 3 files changed, 43 insertions(+), 13 deletions(-)