On 12.1.2023 18.18, Oliver Neukum wrote:
Hi, this is my new laptop and I am fishing for ideas. If the port has no device attached and the laptop is on battery power The device in question is: linux:/usr/lib/udev/rules.d # lspci -vvvn -s 06:00.3 06:00.3 0c03: 1022:15e0 (prog-if 30 [XHCI]) Subsystem: 17aa:5125 Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+ Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 0, Cache Line Size: 32 bytes Interrupt: pin D routed to IRQ 41 IOMMU group: 16 Region 0: Memory at d0200000 (64-bit, non-prefetchable) [size=1M] Capabilities: [48] Vendor Specific Information: Len=08 <?> Capabilities: [50] Power Management version 3 Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+) Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME- Capabilities: [64] Express (v2) Endpoint, MSI 00 DevCap: MaxPayload 256 bytes, PhantFunc 0, Latency L0s <4us, L1 unlimited ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset- SlotPowerLimit 0W DevCtl: CorrErr- NonFatalErr- FatalErr- UnsupReq- RlxdOrd+ ExtTag+ PhantFunc- AuxPwr- NoSnoop+ MaxPayload 128 bytes, MaxReadReq 512 bytes DevSta: CorrErr- NonFatalErr- FatalErr- UnsupReq- AuxPwr- TransPend- LnkCap: Port #0, Speed 8GT/s, Width x16, ASPM L0s L1, Exit Latency L0s <64ns, L1 <1us ClockPM- Surprise- LLActRep- BwNot- ASPMOptComp+ LnkCtl: ASPM Disabled; RCB 64 bytes, Disabled- CommClk+ ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt- LnkSta: Speed 8GT/s, Width x16 TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt- DevCap2: Completion Timeout: Not Supported, TimeoutDis- NROPrPrP- LTR+ 10BitTagComp- 10BitTagReq- OBFF Not Supported, ExtFmt+ EETLPPrefix+, MaxEETLPPrefixes 1 EmergencyPowerReduction Not Supported, EmergencyPowerReductionInit- FRS- TPHComp- ExtTPHComp- AtomicOpsCap: 32bit- 64bit- 128bitCAS- DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis- LTR- 10BitTagReq- OBFF Disabled, AtomicOpsCtl: ReqEn- LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete- EqualizationPhase1- EqualizationPhase2- EqualizationPhase3- LinkEqualizationRequest- Retimer- 2Retimers- CrosslinkRes: unsupported Capabilities: [a0] MSI: Enable- Count=1/8 Maskable- 64bit+ Address: 0000000000000000 Data: 0000 Capabilities: [c0] MSI-X: Enable+ Count=8 Masked- Vector table: BAR=0 offset=000fe000 PBA: BAR=0 offset=000ff000 Capabilities: [100 v1] Vendor Specific Information: ID=0001 Rev=1 Len=010 <?> Kernel driver in use: xhci_hcd Kernel modules: xhci_pci When I disconnect the device on the port I get: [ 417.723677] usb 2-2: USB disconnect, device number 3 [ 417.961659] xhci_hcd 0000:06:00.3: saving config space at offset 0x0 (reading 0x15e01022) [ 417.961676] xhci_hcd 0000:06:00.3: saving config space at offset 0x4 (reading 0x100403) [ 417.961681] xhci_hcd 0000:06:00.3: saving config space at offset 0x8 (reading 0xc033000) [ 417.961684] xhci_hcd 0000:06:00.3: saving config space at offset 0xc (reading 0x800008) [ 417.961687] xhci_hcd 0000:06:00.3: saving config space at offset 0x10 (reading 0xd0200004) [ 417.961691] xhci_hcd 0000:06:00.3: saving config space at offset 0x14 (reading 0x0) [ 417.961694] xhci_hcd 0000:06:00.3: saving config space at offset 0x18 (reading 0x0) [ 417.961697] xhci_hcd 0000:06:00.3: saving config space at offset 0x1c (reading 0x0) [ 417.961701] xhci_hcd 0000:06:00.3: saving config space at offset 0x20 (reading 0x0) [ 417.961704] xhci_hcd 0000:06:00.3: saving config space at offset 0x24 (reading 0x0) [ 417.961708] xhci_hcd 0000:06:00.3: saving config space at offset 0x28 (reading 0x0) [ 417.961711] xhci_hcd 0000:06:00.3: saving config space at offset 0x2c (reading 0x512517aa) [ 417.961714] xhci_hcd 0000:06:00.3: saving config space at offset 0x30 (reading 0x0) [ 417.961717] xhci_hcd 0000:06:00.3: saving config space at offset 0x34 (reading 0x48) [ 417.961720] xhci_hcd 0000:06:00.3: saving config space at offset 0x38 (reading 0x0) [ 417.961723] xhci_hcd 0000:06:00.3: saving config space at offset 0x3c (reading 0x4ff) [ 417.961840] xhci_hcd 0000:06:00.3: PME# enabled This looks right to me I added } else { error = pci_set_low_power_state(dev, state); + pci_dbg(dev, "Gone into state %d\n", state); to pci_set_power_state() and get: [ 417.961840] xhci_hcd 0000:06:00.3: PME# enabled [ 417.961853] xhci_hcd 0000:06:00.3: Requested to go to 0 _That_ I do not understand I can trigger the same effect by putting a connected mouse (usbhid) into autosuspend while and only while the laptop is on battery. The port works if I prevent a suspend. This looked like an ACPI issue to me, but I do not understand why there is a request to put the HC into D0. Any ideas?
_S0W in ACPI tables should return maximum (lowest power) D state xHC can go to in S0 while still being able to generate wake. I guess if _S0W is missing or returning zero then host might end up in D0. Also your xHC says it supports PME wake in D0. I think It's more common that hosts only support PME wake in D3hot and D3cold. Could be part of the issue. -Mathias