On 11.1.2025 2.00, Forest wrote:
On Tue, 7 Jan 2025 14:29:35 +0200, Mathias Nyman wrote:
Does disabling USB2 hardware LPM for the device make it work again?
Adding USB_QUIRK_NO_LPM quirk "k" for your device vid:pid should do it.
i.e. add "usbcore.quirks=0fce:0dde:k" parameter to your kernel cmdline.
That fixed my test case on Debian kernel 6.12.8-amd64, which is among those
that have been failing.
# grep EXTCAP_PORTINFO reg-ext-protocol:*
reg-ext-protocol:00:EXTCAP_PORTINFO = 0x40000101
reg-ext-protocol:01:EXTCAP_PORTINFO = 0x20000402
reg-ext-protocol:02:EXTCAP_PORTINFO = 0x00190c06
bool(0x40000101 & 1 << 19)
False
bool(0x20000402 & 1 << 19)
False
bool(0x00190c06 & 1 << 19)
True
Device USB2 LPM capability can be checked from the devices BOS descriptor,
visible (as sudo/root) with lsusb -v -d 0fce:0dde
# lsusb -v -d 0fce:0dde |grep -B 5 LPM
USB 2.0 Extension Device Capability:
bLength 7
bDescriptorType 16
bDevCapabilityType 2
bmAttributes 0x00000006
BESL Link Power Management (LPM) Supported
I think that says the device claims support for LPM, yes?
Yes. Looks like both the device and host support USB2 LPM
I think I see what is going on.
Before commit 63a1f8454962a64746a59441687 the xhci driver apparently failed
to detect xHC USB2 LPM support if USB 3 ports were listed before USB 2 ports
in the "supported protocol capabilities.
Now that we correctly detect LPM support and enable it, it turns out the
device does not work well with USB 2 LPM enabled.
I'd recommend a patch that permanently adds USB_QUIRK_NO_LPM for this device.
Let me know if you want to submit it yourself, otherwise I can do it.
Thanks
Mathias
Additional debugging details:
We incorrectly compared usb device port numbers with xHC hardware port
numbers when checking for USB2 port capabilities.
xHC hardware has one long array of ports, including all USB 2 and USB 3 ports.
In your case host lists three sets of supported protocol capabilities:
One USB 3.2 port as the fist port at offset 1:
reg-ext-protocol:00:EXTCAP_REVISION = 0x03200802
reg-ext-protocol:00:EXTCAP_PORTINFO = 0x40000101
Four USB 3.1 ports starting at offset 2
reg-ext-protocol:01:EXTCAP_REVISION = 0x03100802
reg-ext-protocol:01:EXTCAP_PORTINFO = 0x20000402
Ten USB 2.0 ports stating at offset 6, supporting LPM
reg-ext-protocol:02:EXTCAP_REVISION = 0x02000802
reg-ext-protocol:02:EXTCAP_PORTINFO = 0x00190c06
Most xHC hosts used to list their USB 2.0 ports first, meaning there
was no offset difference between usb device port number and xHC port
number for USB 2.0 ports.
Usb device port numbers start from 1 on that hub, in your case it was "3"
xhci driver then checked that usb device with port number "3" does not match
the LPM supported USB 2 port range from 6 to 16 (10 LPM capabale USB 2
ports starting at offset 6).
-Mathias