On Tue, Oct 03, 2023 at 01:06:48PM -0500, Mario Limonciello wrote:
On 10/3/2023 12:24, Bjorn Helgaas wrote:
On Mon, Oct 02, 2023 at 01:09:06PM -0500, Mario Limonciello wrote:
Iain reports that USB devices can't be used to wake a Lenovo Z13 from suspend. This occurs because on some AMD platforms, even though the Root Ports advertise PME_Support for D3hot and D3cold, they don't handle PME messages and generate wakeup interrupts from those states when amd-pmc has put the platform in a hardware sleep state.
...
Two questions:
- PME also doesn't work in D3hot, right?
Right.
IMO pci_d3cold_*() is poorly named. It's going to prevent D3 on the bridge.
I agree, that name is super irritating. I don't even know how to figure out or verify that pci_d3cold_disable() also disables D3hot.
- Is it OK to use D3hot and D3cold if we don't have a wakeup device below the Root Port? I assume that scenario is possible?
Yes; it's "fine to do that" if there is no wakeup device below the root port.
If a user intentionally turns off power/wakeup for the child devices (which as said before was USB4 and XHCI PCIe devices) then wakeup won't be set.
So in this case as the quirk is implemented I expect the root port will be left in D0 even if a user intentionally turns off power/wakeup for the USB4 and XHCI devices.
Even if users don't intentionally turn off wakeup, there are devices like mass storage and NICs without wake-on-LAN that don't require wakeup.
I assume that if there's no downstream device that needs wakeup, this quirk means we will keep the Root Port in D0 even though we could safely put it in D3hot or D3cold.
That's one thing I liked about the v20 iteration -- instead of pci_d3cold_disable(), we changed dev->pme_support, which should mean that we only avoid D3hot/D3cold if we need PMEs while in those states, so I assumed that we *could* use D3 when we don't need the wakeups.
Bjorn