mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/5] usb: xhci: fix endpoint halt and stall recovery
@ 2026-08-22 22:33 Stephano Cetola
  2026-08-22 22:34 ` [PATCH 1/5] usb: xhci: tolerate COMP_CTX_STATE in abort_td's final completion check Stephano Cetola
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Stephano Cetola @ 2026-08-22 22:33 UTC (permalink / raw)
  To: Sascha Hauer, open list:BAREBOX

Recovering from a halted or stalled USB endpoint is broken in the
XHCI driver in several independent ways. An interrupt endpoint
transfer never gets a real chance to complete. Its own timeout
always defeats the hardware's autonomous polling before it can
succeed. When that or any other transfer times out, the resulting
cleanup can hit a BUG_ON in the wrong completion state, corrupt a
pointer used in the recovery command, or leave the endpoint looking
halted even after recovery actually succeeded.

In practice this shows up two ways. Most keypresses still get
through by racing the cleanup against the hardware's real response,
so it looks like occasional dropped keystrokes rather than a dead
keyboard. When the rarer failure paths trigger instead, the keyboard
stops responding entirely until reboot.

This series fixes each of those problems in the order they are
actually hit during recovery. Patch order matters.

reset_ep()'s timeout_ms parameter was inherited from an unrelated
feature (b310b08f087e, "usb: xhci: Honor transfer timeouts") meant
to let data polls like network RX return quickly, not to describe
how long a hardware recovery command needs. Recovery should always
run to completion regardless of the original transfer's timeout, so
this series gives it a fixed one instead.

Found and fixed during USB bring-up on the MNT Pocket Reform
(RK3588S), which appears to be the first board in this tree to
combine an XHCI controller with a polled USB keyboard. Testers on
the official RCORE RK3588 module independently report the same
symptom. USB polling errors appear on screen, and only a reboot
recovers the keyboard.

Signed-off-by: Stephano Cetola <stephano@cetola.net>
---
Stephano Cetola (5):
      usb: xhci: tolerate COMP_CTX_STATE in abort_td's final completion check
      usb: xhci: reset_ep: wait for real completion, not the caller's timeout
      usb: xhci: reset_ep: fix misaligned pointer in Set TR Dequeue Pointer
      usb: xhci: xhci_bulk_tx: re-fetch ep_ctx after resetting a halted endpoint
      usb: xhci: wait a real interval for interrupt endpoint transfers

 drivers/usb/host/xhci-ring.c | 29 +++++++++++++++++++----------
 drivers/usb/host/xhci.c      |  2 +-
 2 files changed, 20 insertions(+), 11 deletions(-)
---
base-commit: 9bc1a26592a59919d2ee8c60c273d87d3d9f2e81
change-id: 20260822-send-xhci-fixes-bf1812c6c27e




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-08-24 10:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-22 22:33 [PATCH 0/5] usb: xhci: fix endpoint halt and stall recovery Stephano Cetola
2026-08-22 22:34 ` [PATCH 1/5] usb: xhci: tolerate COMP_CTX_STATE in abort_td's final completion check Stephano Cetola
2026-08-22 22:34 ` [PATCH 2/5] usb: xhci: reset_ep: wait for real completion, not the caller's timeout Stephano Cetola
2026-08-22 22:34 ` [PATCH 3/5] usb: xhci: reset_ep: fix misaligned pointer in Set TR Dequeue Pointer Stephano Cetola
2026-08-22 22:34 ` [PATCH 4/5] usb: xhci: xhci_bulk_tx: re-fetch ep_ctx after resetting a halted endpoint Stephano Cetola
2026-08-22 22:34 ` [PATCH 5/5] usb: xhci: wait a real interval for interrupt endpoint transfers Stephano Cetola
2026-08-24 10:14 ` [PATCH 0/5] usb: xhci: fix endpoint halt and stall recovery Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox