USB hotplug on HP 255 G6 laptop
Quoted 113 lines · Mathias Nyman
Quoted 63 lines · Jan Kara
Quoted 62 lines · Jan Kara
Quoted 50 lines · Mathias Nyman
Quoted 32 lines · Jan Kara
Quoted 14 lines · Mathias Nyman
Quoted 12 lines · Jan Kara
Hello,
my wife has HP 255 G6 laptop. When it is attached to AC, everything works as expected however when it is running on battery, USB hotplug stops working - newly plugged devices do not appear to be visible to the kernel. Only when the AC is plugged back in, the kernel suddently wakes up and detects all newly attached devices. Maybe it is related to some power management? Any idea how to debug this? Dmesg from the system is attached. The kernels I've tested with (both behave the same way) are 4.18.11 kernel and also openSUSE Leap 15 kernel which is 4.12-based. Thanks in advance for any help.
Quoted 2 lines
Are you running laptop mode tools or similar that would enable runtime suspend D3 state for xhci controller?
It is openSUSE Leap 15 installation with xfce4 desktop so I assume there is some power-management going on. Not sure what I should look for but there's xfce4-power-manager running, also upowerd is running.
Quoted 1 line
what does lspci -vv say?
Attached.
Quoted 3 lines
check the content of the following files while running on battery:
cat /sys/bus/pci/devices/0000:00:10.0/firmware_node/power_state
D0
Quoted 9 lines
Quoted 1 line
cat /sys/bus/pci/devices/0000:00:10.0/power/control
auto - when on battery, on - when on AC.
Quoted 2 lines
try: echo on > /sys/bus/pci/devices/0000:00:10.0/power/control before pluggin in a usb device, does it help?
Yes, USB device gets recognized after this.
To me this looks like xhci is runtime suspended, but controller is still in a PCI D0 state.
Normally the xHC should be put to PCI D3 in runtime suspend, and woken up by a PCI PME# when a device is plugged in, but PME# is not enabled in D0 so in this case nothing wakes up the xHC.
Quoted 8 lines
The xhci runtime suspend code already stopped the controller, so probably you're not getting an interrupt either.
PCI code looks at firmware ACPI tables to choose the suspend D state, if something is off in the tables it's possible the wrong state is chosen. worth checking.
Could you dump the DSDT ACPI table form
/sys/firmware/acpi/tables/DSDTSure. Attached.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
As a quick temporary workaround you could find and prevent the powersaving program from enabling runtime suspend. (make sure it won't write "auto" to /sys/bus/pci/devices/0000:00:10.0/power/control)
OK, thanks for the hint.
Any news here? Are really ACPI tables wrong on this laptop?
Can't say for sure
There might be differences how Windows and Linux parse ACPI tables.
If
_PR0or_PS0is present for a device in ACPI tables then Linux will assume the device is ACPI power manageable, and select PCI D states from ACPI tables.
_S3Wshould return the highest D-value (deepest sleep state) device can wake up from S3 (system suspend)_S0Wshould return the highest D-value (deepest sleep state) device can wake up from S0 (Runtime suspend)Your ACPI DSDT table shows:
Scope (_SB.PCI0.XHC0) { Name (_PR0, Package (0x01) // _PR0: Power Resources for D0 { P0U3 }) Name (_PR3, Package (0x01) // _PR3: Power Resources for D3hot { P3U3 }) Method (_S0W, 0, NotSerialized) // _S0W: S0 Device Wake State { If ((XHCD == One)) { Return (0x04) } Else { Return (Zero) } } Method (_S3W, 0, NotSerialized) // _S3W: S3 Device Wake State { Return (0x04) }
Quoted 3 lines
Those with better APCI and PCI knowledge might know more details, or better debugging for this, but it at least would be possible to check which D state is chosen by adding the below code, and recompiling the kernel:
Thanks for the patch and suggestiong. As expected this hack has fixed the problem with the USB on that laptop. The messages in the logs are:
[ 96.433856] xhci_hcd 0000:00:10.0: HACK: device 0x7914: ACPI selected D0 state, Force D3
Interestingly, when plugging the device for the first time there was also a message:
[ 96.451576] acpi device:19: Cannot transition from D3cold to D3hot
When I unplugged and plugged the USB stick again, there was just:
[ 141.620436] xhci_hcd 0000:00:10.0: HACK: device 0x7914: ACPI selected D0 state, Force D3
Full dmesg is attached.
I have also added linux-acpi to CC for more ACPI knowledge and attached DSDT dump again so that ACPI people don't have to look it up on linux-usb.
Honza