diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2011-10-03 17:16:33 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2011-10-14 12:05:31 -0400 |
commit | 379021d5c0899fcf9410cae4ca7a59a5a94ca769 (patch) | |
tree | 9c91ffb80fcb143b94c20922cb27d60d2c7e6654 /drivers/pci/pcie | |
parent | 3e309cdf07c930f29a4e0f233e47d399bea34c68 (diff) |
PCI / PM: Extend PME polling to all PCI devices
The land of PCI power management is a land of sorrow and ugliness,
especially in the area of signaling events by devices. There are
devices that set their PME Status bits, but don't really bother
to send a PME message or assert PME#. There are hardware vendors
who don't connect PME# lines to the system core logic (they know
who they are). There are PCI Express Root Ports that don't bother
to trigger interrupts when they receive PME messages from the devices
below. There are ACPI BIOSes that forget to provide _PRW methods for
devices capable of signaling wakeup. Finally, there are BIOSes that
do provide _PRW methods for such devices, but then don't bother to
call Notify() for those devices from the corresponding _Lxx/_Exx
GPE-handling methods. In all of these cases the kernel doesn't have
a chance to receive a proper notification that it should wake up a
device, so devices stay in low-power states forever. Worse yet, in
some cases they continuously send PME Messages that are silently
ignored, because the kernel simply doesn't know that it should clear
the device's PME Status bit.
This problem was first observed for "parallel" (non-Express) PCI
devices on add-on cards and Matthew Garrett addressed it by adding
code that polls PME Status bits of such devices, if they are enabled
to signal PME, to the kernel. Recently, however, it has turned out
that PCI Express devices are also affected by this issue and that it
is not limited to add-on devices, so it seems necessary to extend
the PME polling to all PCI devices, including PCI Express and planar
ones. Still, it would be wasteful to poll the PME Status bits of
devices that are known to receive proper PME notifications, so make
the kernel (1) poll the PME Status bits of all PCI and PCIe devices
enabled to signal PME and (2) disable the PME Status polling for
devices for which correct PME notifications are received.
Tested-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/pcie')
-rw-r--r-- | drivers/pci/pcie/pme.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c index 0057344a3fcb..001f1b78f39c 100644 --- a/drivers/pci/pcie/pme.c +++ b/drivers/pci/pcie/pme.c | |||
@@ -84,6 +84,9 @@ static bool pcie_pme_walk_bus(struct pci_bus *bus) | |||
84 | list_for_each_entry(dev, &bus->devices, bus_list) { | 84 | list_for_each_entry(dev, &bus->devices, bus_list) { |
85 | /* Skip PCIe devices in case we started from a root port. */ | 85 | /* Skip PCIe devices in case we started from a root port. */ |
86 | if (!pci_is_pcie(dev) && pci_check_pme_status(dev)) { | 86 | if (!pci_is_pcie(dev) && pci_check_pme_status(dev)) { |
87 | if (dev->pme_poll) | ||
88 | dev->pme_poll = false; | ||
89 | |||
87 | pci_wakeup_event(dev); | 90 | pci_wakeup_event(dev); |
88 | pm_request_resume(&dev->dev); | 91 | pm_request_resume(&dev->dev); |
89 | ret = true; | 92 | ret = true; |
@@ -142,6 +145,9 @@ static void pcie_pme_handle_request(struct pci_dev *port, u16 req_id) | |||
142 | 145 | ||
143 | /* First, check if the PME is from the root port itself. */ | 146 | /* First, check if the PME is from the root port itself. */ |
144 | if (port->devfn == devfn && port->bus->number == busnr) { | 147 | if (port->devfn == devfn && port->bus->number == busnr) { |
148 | if (port->pme_poll) | ||
149 | port->pme_poll = false; | ||
150 | |||
145 | if (pci_check_pme_status(port)) { | 151 | if (pci_check_pme_status(port)) { |
146 | pm_request_resume(&port->dev); | 152 | pm_request_resume(&port->dev); |
147 | found = true; | 153 | found = true; |
@@ -187,6 +193,9 @@ static void pcie_pme_handle_request(struct pci_dev *port, u16 req_id) | |||
187 | /* The device is there, but we have to check its PME status. */ | 193 | /* The device is there, but we have to check its PME status. */ |
188 | found = pci_check_pme_status(dev); | 194 | found = pci_check_pme_status(dev); |
189 | if (found) { | 195 | if (found) { |
196 | if (dev->pme_poll) | ||
197 | dev->pme_poll = false; | ||
198 | |||
190 | pci_wakeup_event(dev); | 199 | pci_wakeup_event(dev); |
191 | pm_request_resume(&dev->dev); | 200 | pm_request_resume(&dev->dev); |
192 | } | 201 | } |