On Wed, Aug 28, 2019 at 10:34 AM Daniel Drake <drake@xxxxxxxxxxxx> wrote: > > On Tue, Aug 27, 2019 at 3:48 PM Rafael J. Wysocki <rafael@xxxxxxxxxx> wrote: > > That depends on what exactly happens when you try to do the D0-D3-D0 > > with setpci. If the device becomes unreachable (or worse) after that, > > it indicates a platform issue. It should not do any harm at the > > least. > > > > However, in principle D0-D3-D0 at the PCI level alone may not be > > sufficient, because ACPI may need to be involved. > > After using setpci to do D0-D3-D0 transitions, the xhci module fails to probe. > > xhci_hcd 0000:03:00.3: WARN: xHC restore state timeout > xhci_hcd 0000:03:00.3: PCI post-resume error -110! > > But maybe it's not a great test; as you say I'm not involving ACPI, > and also if Linux has a reason for not runtime suspending PCI devices > without drivers present then maybe I should also not be doing this. > > > I think that PM-runtime should suspend XHCI controllers without > > anything on the bus under them, so I wonder what happens if > > ".../power/control" is set to "on" and then to "auto" for that device, > > with the driver loaded. > > Good hint. > > # echo on > /sys/bus/pci/devices/0000\:03\:00.3/power/control > # echo auto > /sys/bus/pci/devices/0000\:03\:00.3/power/control > # echo 1 > /sys/bus/usb/devices/1-4/remove > # cat /sys/bus/pci/devices/0000\:03\:00.3/power/runtime_status > suspended > # echo on > /sys/bus/pci/devices/0000\:03\:00.3/power/control > > The final command there triggers these messages (including a printk I > added in pci_raw_set_power_state): > xhci_hcd 0000:03:00.3: pci_raw_set_power_state from 3 to 0 > xhci_hcd 0000:03:00.3: Refused to change power state, currently in D3 > xhci_hcd 0000:03:00.3: pci_raw_set_power_state from 3 to 0 > xhci_hcd 0000:03:00.3: enabling device (0000 -> 0002) > xhci_hcd 0000:03:00.3: WARN: xHC restore state timeout > xhci_hcd 0000:03:00.3: PCI post-resume error -110! > xhci_hcd 0000:03:00.3: HC died; cleaning up > > So we just reproduced the same issue using runtime PM, without having > to go through the whole suspend path. > > I guess that points towards a platform issue, although the weird thing > is that Windows presumably does the D3-D0-D3 transition during > suspend/resume and that appears to work fine. It looks like the platform expects the OS to do something that our generic XHCI driver and the PCI/ACPI layer don't do. A quirk or similar may be needed to address that. > I'll report it to the vendor, Yes, please. At least try to get the information on what the exact platform expectations with respect to the OS are. Quite evidently, they aren't just "do the usual thing". > but if you have any other debug ideas they would be much appreciated. With the git branch mentioned previously merged in, you can enable dynamic debug in device_pm.c, repeat the PM-runtime test and collect the log. There should be some additional messages from the ACPI layer in it. > > Daniel