linux-hardened/drivers/pci
Lukas Wunner 2a4d2c4240 PCI: Make pci_wakeup_bus() & pci_bus_set_current_state() public
There are PCI devices which are power-manageable by a nonstandard means,
such as a custom ACPI method.  One example are discrete GPUs in hybrid
graphics laptops, another are Thunderbolt controllers in Macs.

Such devices can't be put into D3cold with pci_set_power_state() because
pci_platform_power_transition() fails with -ENODEV.  Instead they're put
into D3hot by pci_set_power_state() and subsequently into D3cold by
invoking the nonstandard means.  However as a consequence the cached
current_state is incorrectly left at D3hot.

What we need to do is walk the hierarchy below such a PCI device on
powerdown and update the current_state to D3cold.  On powerup the PCI
device itself and the hierarchy below it is in D0uninitialized, so we
need to walk the hierarchy again and wake all devices, causing them to
be put into D0active and then letting them autosuspend as they see fit.

To this end make pci_wakeup_bus() & pci_bus_set_current_state() public
so PCI drivers don't have to reinvent the wheel.

Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Link: https://patchwork.freedesktop.org/patch/msgid/2962443259e7faec577274b4ef8c54aad66f9a94.1520068884.git.lukas@wunner.de
2018-03-13 22:57:36 +01:00
..
cadence PCI: cadence: Add EndPoint Controller driver for Cadence PCIe controller 2018-01-31 11:13:27 +00:00
dwc Merge branch 'pci/spdx' into next 2018-02-01 11:40:07 -06:00
endpoint Merge branch 'pci/spdx' into next 2018-02-01 11:40:07 -06:00
host pci-v4.16-changes 2018-02-06 09:59:40 -08:00
hotplug More ACPI updates for v4.16-rc1 2018-02-09 09:44:25 -08:00
pcie pci-v4.16-changes 2018-02-06 09:59:40 -08:00
switch vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
access.c Merge branch 'pci/spdx' into next 2018-02-01 11:40:07 -06:00
ats.c PCI: Add SPDX GPL-2.0 when no license was specified 2018-01-26 11:45:16 -06:00
bus.c Merge branch 'pci/spdx' into next 2018-02-01 11:40:07 -06:00
ecam.c PCI: Add SPDX GPL-2.0 to replace GPL v2 boilerplate 2018-01-28 15:48:29 -06:00
host-bridge.c PCI: Add SPDX GPL-2.0 when no license was specified 2018-01-26 11:45:16 -06:00
iov.c pci-v4.16-changes 2018-02-06 09:59:40 -08:00
irq.c PCI: Add wrappers for dev_printk() 2018-01-18 12:55:24 -06:00
Kconfig Merge branch 'pci/spdx' into next 2018-02-01 11:40:07 -06:00
Makefile PCI: cadence: Add EndPoint Controller driver for Cadence PCIe controller 2018-01-31 11:13:27 +00:00
mmap.c PCI: Add SPDX GPL-2.0 to replace GPL v2 boilerplate 2018-01-28 15:48:29 -06:00
msi.c Merge branch 'pci/spdx' into next 2018-02-01 11:40:07 -06:00
of.c Merge branch 'pci/spdx' into next 2018-02-01 11:40:07 -06:00
pci-acpi.c Merge branch 'pci/spdx' into next 2018-02-01 11:40:07 -06:00
pci-driver.c PCI: Restore config space on runtime resume despite being unbound 2018-03-13 22:56:44 +01:00
pci-label.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci-mid.c PCI: Add SPDX GPL-2.0 to replace GPL v2 boilerplate 2018-01-28 15:48:29 -06:00
pci-stub.c Merge branch 'pci/spdx' into next 2018-02-01 11:40:07 -06:00
pci-sysfs.c Merge branch 'pci/virtualization' into next 2018-01-31 10:13:09 -06:00
pci.c PCI: Make pci_wakeup_bus() & pci_bus_set_current_state() public 2018-03-13 22:57:36 +01:00
pci.h Merge branch 'pci/trivial' into next 2018-01-31 10:13:07 -06:00
probe.c Merge branch 'pci/spdx' into next 2018-02-01 11:40:07 -06:00
proc.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
quirks.c Merge branch 'pci/virtualization' into next 2018-01-31 10:13:09 -06:00
remove.c PCI: Add SPDX GPL-2.0 when no license was specified 2018-01-26 11:45:16 -06:00
rom.c Merge branch 'pci/spdx' into next 2018-02-01 11:40:07 -06:00
search.c PCI: Add SPDX GPL-2.0 when no license was specified 2018-01-26 11:45:16 -06:00
setup-bus.c Merge branch 'pci/spdx' into next 2018-02-01 11:40:07 -06:00
setup-irq.c Merge branch 'pci/spdx' into next 2018-02-01 11:40:07 -06:00
setup-res.c PCI: Add wrappers for dev_printk() 2018-01-18 12:55:24 -06:00
slot.c PCI: Add SPDX GPL-2.0 when no license was specified 2018-01-26 11:45:16 -06:00
syscall.c PCI: Deprecate pci_get_bus_and_slot() 2018-01-17 08:16:46 -06:00
vc.c Merge branch 'pci/spdx' into next 2018-02-01 11:40:07 -06:00
vpd.c PCI: Add SPDX GPL-2.0 when no license was specified 2018-01-26 11:45:16 -06:00
xen-pcifront.c Merge branch 'pci/spdx' into next 2018-02-01 11:40:07 -06:00