[PATCH v4 0/1] xhci: Some improvement for Etron xHCI host

Kuangyi Chiang posted 1 patch 10 months, 1 week ago
drivers/usb/host/xhci-ring.c | 29 +++++++++++++++++++++--------
1 file changed, 21 insertions(+), 8 deletions(-)
[PATCH v4 0/1] xhci: Some improvement for Etron xHCI host
Posted by Kuangyi Chiang 10 months, 1 week ago
To prevent the xHCI driver from printing a "Transfer event TRB DMA
ptr not part of current TD" error message when an error is detected
while processing the last TRB of an isoc TD:
  xhci: Correctly handle last TRB of isoc TD on Etron xHCI host

---
Changes in v4:
- Rebase against Linux 6.14-rc1
- Link to v3: https://lore.kernel.org/all/20241202050135.13504-1-ki.chiang65@gmail.com

Changes in v3:
- Update subject and commit message
- Use error_mid_td instead of last_td_was_short to solve the problem, as suggested by Michal
- Link to v2: https://lore.kernel.org/all/20241028025337.6372-1-ki.chiang65@gmail.com

Changes in v2:
- Modify commit message
- Remove XHCI_NO_RESET_DEVICE/XHCI_NO_BREAK_CTRL_TD quirk flag
- Add XHCI_ETRON_HOST quirk flag, thanks for the suggestion by Michal
- Check device speed before invoking the workaround
- Add (xhci: Combine two if statements for Etron xHCI host)
- Add (xhci: Correct handling of one-TRB isoc TD on Etron xHCI host)
- Link to v1: https://lore.kernel.org/all/20240911051716.6572-4-ki.chiang65@gmail.com

Kuangyi Chiang (1):
  xhci: Correctly handle last TRB of isoc TD on Etron xHCI host

 drivers/usb/host/xhci-ring.c | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

-- 
2.25.1
Re: [PATCH v4 0/1] xhci: Some improvement for Etron xHCI host
Posted by Michał Pecio 9 months ago
Hi again.

> To prevent the xHCI driver from printing a "Transfer event TRB DMA
> ptr not part of current TD" error message when an error is detected
> while processing the last TRB of an isoc TD:
>   xhci: Correctly handle last TRB of isoc TD on Etron xHCI host

By the way, do you have other problems with your Etrons trying to run
SuperSpeed isochronous endpoints? Mine doesn't work at altsettings with
non-power-of-two ESIT payload very well.

rmmod uvcvideo ; modprobe uvcvideo trace=0x400
causes the selected altsetting to be printed to dmesg. Choosing some
video resolutions results in non-power-of-two altsetting which works
on other HCs, but causes visible image corruption and errors on Etron:

[  +5.514779] usb 7-1: Device requested 7332 B/frame bandwidth
[  +0.000016] usb 7-1: Selecting alternate setting 8 (12288 B/frame bandwidth)
[  +0.002647] usb 7-1: Allocated 5 URB buffers of 32x12288 bytes each
[  +0.148160] xhci_hcd 0000:06:00.0: WARN: bandwidth overrun event for slot 1 ep 2 on endpoint
[  +0.003382] xhci_hcd 0000:06:00.0: WARN: bandwidth overrun event for slot 1 ep 2 on endpoint
[  +0.000621] xhci_hcd 0000:06:00.0: WARN: bandwidth overrun event for slot 1 ep 2 on endpoint
[  +0.003380] xhci_hcd 0000:06:00.0: WARN: bandwidth overrun event for slot 1 ep 2 on endpoint
[  +0.000614] xhci_hcd 0000:06:00.0: WARN: bandwidth overrun event for slot 1 ep 2 on endpoint
[  +0.003388] xhci_hcd 0000:06:00.0: WARN: bandwidth overrun event for slot 1 ep 2 on endpoint
[  +0.000609] xhci_hcd 0000:06:00.0: WARN: bandwidth overrun event for slot 1 ep 2 on endpoint

As far as I'm able to tell, the problem is caused by multi-TRB TDs
completeing with Short Packet on the first TRB. Then it kinda looks
like the stupid chip assumes that the second TRB is a new TD, adds
the actual TRB of the next TD to it and finds that the resulting TD
is too long, so it rejects it with BW Overrun error.

I wonder if it's something unique to my chip (maybe FW revision?) or
a general rule with those buggy things.

Thanks,
Michal