On Tue, Aug 06, 2024 at 08:53:01AM +0200, Lukas Wunner wrote: > On Mon, Aug 05, 2024 at 07:05:55PM +0530, Manivannan Sadhasivam wrote: > > On Fri, Aug 02, 2024 at 12:13:31PM +0200, Lukas Wunner wrote: > > > The PCI core cannot put devices into D3cold without help from the > > > platform. Checking whether D3cold is possible (or allowed or > > > whatever) thus requires asking platform support code via > > > platform_pci_power_manageable(), platform_pci_choose_state() etc. > > > > > > I think patch [3/4] is a little confusing because it creates > > > infrastructure to decide whether D3cold is supported (allowed?) > > > but we already have that in the platform_pci_*() functions. > > > So I'm not sure if patch [3/4] adds value. I think generally > > > speaking if D3hot isn't possible (allowed?), D3cold is assumed > > > to not be possible either. > > > > Why? D3Hot is useful for runtime PM and if the platform doesn't want to do > > runtime PM, it can always skip D3Hot (not ideal though). > > AFAICS we always program the device to go to D3hot and the platform > then cuts power, thereby putting it into D3cold. So D3hot is never > skipped. See __pci_set_power_state(): > > if (state == PCI_D3cold) { > /* > * To put the device in D3cold, put it into D3hot in the native > * way, then put it into D3cold using platform ops. > */ > error = pci_set_low_power_state(dev, PCI_D3hot, locked); > > if (pci_platform_power_transition(dev, PCI_D3cold)) > return error; > This is applicable only to pci_set_power_state(), but AFAIK PCIe spec doesn't mandate switching to D3Hot for entering D3Cold. So the PCIe host controller drivers (especically non-ACPI platforms) may just send PME_Turn_Off followed by removing the slot power (which again is not controlled by pci_set_power_state()) as there are no non-ACPI related hooks as of now. - Mani -- மணிவண்ணன் சதாசிவம்