usb: xhci: pci: do not perform Soft Retry on AMD 500 series chipset host
Subsystems (3)
PATCH 1/1 usb: xhci: pci: do not perform Soft Retry on AMD 500 series chipset host
Full-speed HID devices hot-plugged into a root port of the AMD 500 series chipset xHCI host (1022:43ee) enumerate and bind, but never deliver any input. The device then resets itself after ~10 seconds, re-enumerates, and the cycle repeats. Devices present at boot are not affected.
With xhci_hcd dynamic debug enabled, the first poll of the interrupt IN endpoint fails with a transaction error, the driver performs a Soft Retry, and the endpoint never completes another transfer:
[ 6658.313453] xhci_hcd 0000:02:00.0: Successful Endpoint Configure command [ 6658.352348] input: ELECOM TrackBall Mouse HUGE TrackBall as ... [ 6659.424165] xhci_hcd 0000:02:00.0: Transfer error for slot 29 ep 2 on endpoint [ 6659.424170] xhci_hcd 0000:02:00.0: Soft-reset ep 2, slot 29 [ 6659.424290] xhci_hcd 0000:02:00.0: Ignoring reset ep completion code of 1 [ 6667.989369] usb 1-9: USB disconnect, device number 30
usbmon shows the interrupt URB submitted at enumeration and only given back by the disconnect, 9.6 seconds later:
2562187476 S Ii:1:030:1 -115:1 8 <
2571824873 C Ii:1:030:1 -108:1 0
No further transfer events or errors are reported for the endpoint after the soft reset completes and the doorbell is rung, so the TD is never retried or failed.
This matches commit a4a251f8c235 ("usb: xhci: do not perform Soft Retry for some xHCI hosts"), which disabled Soft Retry on the AMD Promontory A hosts (43b9, 43bb) for the same class of failure. Booting with xhci_hcd.quirks=0x10000000000 (XHCI_NO_SOFT_RETRY) makes the device work reliably after hot-plug on the chipset root ports tested (1-3, 1-9); the same device also works after hot-plug on the CPU's xHCI host (1022:149c) without the quirk.
Tested on an ASUS ROG STRIX B550-F GAMING (BIOS 3621) with an ELECOM HUGE trackball (056e:010c) and a PFU HHKB Professional HYBRID Type-S (04fe:0021), on 7.3.4 with commit 6895dbdc19d9 ("xhci: give back TDs and clean up ep0 after disconnect") applied. The trackball showed the same behaviour on 7.2.x.
Add the AMD 500 series chipset xHCI to the hosts that do not perform Soft Retry.
--- drivers/usb/host/xhci-pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-pci.c +3 -1
@@ -88,6 +88,7 @@#define PCI_DEVICE_ID_AMD_PROMONTORYA_3 0x43ba#define PCI_DEVICE_ID_AMD_PROMONTORYA_2 0x43bb#define PCI_DEVICE_ID_AMD_PROMONTORYA_1 0x43bc +#define PCI_DEVICE_ID_AMD_500_SERIES_XHCI 0x43ee#define PCI_DEVICE_ID_ATI_NAVI10_7316_XHCI 0x7316
@@ -493,7 +494,8 @@if (pdev->vendor ==PCI_VENDOR_ID_AMD && (pdev->device ==PCI_DEVICE_ID_AMD_PROMONTORYA_2 || - pdev->device ==PCI_DEVICE_ID_AMD_PROMONTORYA_4 )) + pdev->device ==PCI_DEVICE_ID_AMD_PROMONTORYA_4 || + pdev->device ==PCI_DEVICE_ID_AMD_500_SERIES_XHCI )) xhci->quirks |=XHCI_NO_SOFT_RETRY ;if (pdev->vendor ==PCI_VENDOR_ID_ZHAOXIN ) {
Signature · 1 line
2.56.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 15 lines
Full-speed HID devices hot-plugged into a root port of the AMD 500 series chipset xHCI host (1022:43ee) enumerate and bind, but never deliver any input. The device then resets itself after ~10 seconds, re-enumerates, and the cycle repeats. Devices present at boot are not affected.
With
xhci_hcddynamic debug enabled, the first poll of the interrupt IN endpoint fails with a transaction error, the driver performs a Soft Retry, and the endpoint never completes another transfer:[ 6658.313453] xhci_hcd 0000:02:00.0: Successful Endpoint Configure command [ 6658.352348] input: ELECOM TrackBall Mouse HUGE TrackBall as ... [ 6659.424165] xhci_hcd 0000:02:00.0: Transfer error for slot 29 ep 2 on endpoint [ 6659.424170] xhci_hcd 0000:02:00.0: Soft-reset ep 2, slot 29 [ 6659.424290] xhci_hcd 0000:02:00.0: Ignoring reset ep completion code of 1
Quoted 6 lines
[ ... ]
Fixes f8f80be501aa ("xhci: Use soft retry to recover faster from transaction errors")Signed-off-by Riley Wagner <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 5 lines · Riley Wagner
Full-speed HID devices hot-plugged into a root port of the AMD 500 series chipset xHCI host (1022:43ee) enumerate and bind, but never deliver any input. The device then resets itself after ~10 seconds, re-enumerates, and the cycle repeats. Devices present at boot are not affected.
I doubt that this affects all HID devices, people would have noticed.
What if it's not connected to the root hub? Is this important?
Quoted 14 lines
With
xhci_hcddynamic debug enabled, the first poll of the interrupt IN endpoint fails with a transaction error, the driver performs a Soft Retry, and the endpoint never completes another transfer:[ 6658.313453] xhci_hcd 0000:02:00.0: Successful Endpoint Configure command [ 6658.352348] input: ELECOM TrackBall Mouse HUGE TrackBall as ... [ 6659.424165] xhci_hcd 0000:02:00.0: Transfer error for slot 29 ep 2 on endpoint [ 6659.424170] xhci_hcd 0000:02:00.0: Soft-reset ep 2, slot 29 [ 6659.424290] xhci_hcd 0000:02:00.0: Ignoring reset ep completion code of 1 [ 6667.989369] usb 1-9: USB disconnect, device number 30usbmon shows the interrupt URB submitted at enumeration and only given back by the disconnect, 9.6 seconds later:
Quoted 6 lines
2562187476 S Ii:1:030:1 -115:1 8 <
2571824873 C Ii:1:030:1 -108:1 0No further transfer events or errors are reported for the endpoint after the soft reset completes and the doorbell is rung, so the TD is never retried or failed.
IIRC that's the same HW bug which broke some high-speed Realtek WiFi dongle and caused Soft Retry to be disabled in multiple variants of Promontory chipsets. I actually obtained that WiFi dongle (long after the fact) and reproduced the issue - it happens when a device fails the first URB and it gets retried. Most HCs handle this normally, but Promontory generates no transfer events and later fails Stop Endpoint with Context State Error and the endpoint is "halted".
And I think I have seen similar issues on other ASMedia HCs in case of disconnection and repeated retries and endpoint resets. OTOH, in other cases this controllers perform retries correctly.
I will look into that, because maybe we could only avoid the particular retries which fail (and also add a whole lot more PCI IDs).
Quoted 8 lines
This matches commit
a4a251f8c235("usb: xhci: do not perform Soft Retry for some xHCI hosts"), which disabled Soft Retry on the AMD Promontory A hosts (43b9, 43bb) for the same class of failure. Booting with xhci_hcd.quirks=0x10000000000 (XHCI_NO_SOFT_RETRY) makes the device work reliably after hot-plug on the chipset root ports tested (1-3, 1-9); the same device also works after hot-plug on the CPU's xHCI host (1022:149c) without the quirk.
Quoted 5 lines
Tested on an ASUS ROG STRIX B550-F GAMING (BIOS 3621) with an ELECOM HUGE trackball (056e:010c) and a PFU HHKB Professional HYBRID Type-S (04fe:0021), on 7.3.4 with commit
6895dbdc19d9("xhci: give back TDs and clean up ep0 after disconnect") applied. The trackball showed the same behaviour on 7.2.x.
I suppose the keyboard also had problems on 7.2?
IIRC it's that one which always disconnects itself on initialization.
Quoted 15 lines
Add the AMD 500 series chipset xHCI to the hosts that do not perform Soft Retry.
Fixes f8f80be501aa ("xhci: Use soft retry to recover faster from transaction errors")Signed-off-by Riley Wagner <[email protected]>--- drivers/usb/host/xhci-pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-pci.c line 91
Quoted 4 lines
drivers/usb/host/xhci-pci.c +1
-0@@ -88,6 +88,7 @@#define PCI_DEVICE_ID_AMD_PROMONTORYA_3 0x43ba#define PCI_DEVICE_ID_AMD_PROMONTORYA_2 0x43bb#define PCI_DEVICE_ID_AMD_PROMONTORYA_1 0x43bc +#define PCI_DEVICE_ID_AMD_500_SERIES_XHCI 0x43ee
I think "PROMONTORY_19" or "PROM19" would be better for consistency with other entries (see also: commit 9e896b4a48c4).
And isn't 1022:43ec another PROM19 ID?
Does anyone know if 400-series or PROM21 have the same bug?
Adding some AMD people...
Quoted 15 lines
drivers/usb/host/xhci-pci.c +2
-1#define PCI_DEVICE_ID_ATI_NAVI10_7316_XHCI 0x7316@@ -493,7 +494,8 @@if (pdev->vendor ==PCI_VENDOR_ID_AMD && (pdev->device ==PCI_DEVICE_ID_AMD_PROMONTORYA_2 || - pdev->device ==PCI_DEVICE_ID_AMD_PROMONTORYA_4 )) + pdev->device ==PCI_DEVICE_ID_AMD_PROMONTORYA_4 || + pdev->device ==PCI_DEVICE_ID_AMD_500_SERIES_XHCI )) xhci->quirks |=XHCI_NO_SOFT_RETRY ;if (pdev->vendor ==PCI_VENDOR_ID_ZHAOXIN ) {Signature · 1 line
2.56.0