Skip to content

usb: xhci: improve Set TR Deq completion error handling

Niklas Neronin linux-usb 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4usb: xhci: handle Set TR Deq TRB Errordrivers/usb/host/xhci-ring.c+10 -32 replies
2/4usb: xhci: handle Set TR Deq Slot Not Enabled Errordrivers/usb/host/xhci-ring.c+14 -42 replies
3/4usb: xhci: handle Set TR Deq Context State Error due to Slot statedrivers/usb/host/xhci-ring.c+7 -21 reply
4/4usb: xhci: handle Set TR Deq Context State Error due to Endpoint statedrivers/usb/host/xhci-ring.c+22 -46 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] usb: xhci: improve Set TR Deq completion error handling

The Set TR Deq command instructs the hardware to skip Transfer Descriptors (TDs) from A to B. Once the hardware processes the Set TR Deq command, it returns a completion event indicating either success or an error.

In the event of success, TDs A to B are released, the dequeue pointer is updated, and if there are still cancelled TDs, a new Set TR Deq command is issued. Conversely, if an error occurs, a warning is logged, and TDs A to B are released. This can lead to a mismatch between the driver and hardware, eventually resulting in an critical error.

When feasible, attempt to resolve errors. Otherwise, retain unresolved errors as they are and improve the warning message.

xHCI driver issues Set TR Deq commands in 4 places:
xhci_handle_cmd_stop_ep()
After a successful Stop Endpoint completion event is received.

xhci_handle_cmd_set_deq()
After receiving a Set TR Deq completion event and there are new cancelled TDs.

xhci_handle_cmd_reset_ep()
After a Endpoint reset completion, Endpoint state is Stopped.

xhci_urb_dequeue()
If clearing Endpoints Transaction Translator, Endpoint state is Stopped.

Niklas Neronin (4):
usb: xhci: handle Set TR Deq TRB Error
usb: xhci: handle Set TR Deq Slot Not Enabled Error
usb: xhci: handle Set TR Deq Context State Error due to Slot state
usb: xhci: handle Set TR Deq Context State Error due to Endpoint state

 drivers/usb/host/xhci-ring.c | 68 ++++++++++++++++++++++++++++--------
 1 file changed, 54 insertions(+), 14 deletions(-)
Signature · 1 line
2.50.1