On Thursday, June 6, 2019 4:36:06 PM CEST Mika Westerberg wrote: > On Thu, Jun 06, 2019 at 04:27:21PM +0200, Rafael J. Wysocki wrote: > > On Thu, Jun 6, 2019 at 4:17 PM Mika Westerberg > > <mika.westerberg@xxxxxxxxxxxxxxx> wrote: > > > > > > On Thu, Jun 06, 2019 at 04:08:11PM +0200, Rafael J. Wysocki wrote: > > > > That isn't necessary IMO as long as the device are not accessed. If > > > > the kernel thinks that a given device is in D3cold and doesn't access > > > > it, then it really doesn't matter too much what state the device is in > > > > physically. On the first access the device should be reinitialized > > > > anyway. > > > > > > But if the device is configured to wake. For example when it detects a > > > hotplug that state is gone when it goes to D0unitialized. > > > > For this we'll need a pm_runtime_resume() of the dependent device on > > the resource going "on". > > > > That means we need a list of devices to resume when the resource goes > > "on" after being taken "off". > > OK, thanks. Basically, at the pci_acpi_setup() time dev and adev need to be passed to a function that will add dev as a "dependent device" for each of the power resources in the adev's D0 list. Next whenever a power resource with a list of "dependent devices" goes _ON successfully, pm_request_resume() needs to be called for each device in that list. Finally, at the pci_acpi_cleanup() time, dev needs to be removed from the lists of "dependent devices" for all power resources in its ACPI companion's D0 list. At least that's how I see that.