Commit 0ce74a3b authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by Bjorn Helgaas

PCI/PM: Do not restore BARs if device is not in D0

Do not attempt to restore the device's BARs in
pci_set_full_power_state() if the actual current
power state of the device is not D0.

Link: https://lore.kernel.org/r/1849718.CQOukoFCf9@kreacherSigned-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent e200904b
......@@ -1273,10 +1273,10 @@ static int pci_set_full_power_state(struct pci_dev *dev)
pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
dev->current_state = pmcsr & PCI_PM_CTRL_STATE_MASK;
if (dev->current_state != PCI_D0)
if (dev->current_state != PCI_D0) {
pci_info_ratelimited(dev, "Refused to change power state from %s to D0\n",
pci_power_name(dev->current_state));
} else if (ret > 0) {
/*
* According to section 5.4.1 of the "PCI BUS POWER MANAGEMENT
* INTERFACE SPECIFICATION, REV. 1.2", a device transitioning
......@@ -1290,8 +1290,8 @@ static int pci_set_full_power_state(struct pci_dev *dev)
* restore at least the BARs so that the device will be
* accessible to its driver.
*/
if (ret > 0)
pci_restore_bars(dev);
}
if (dev->bus->self)
pcie_aspm_pm_state_change(dev->bus->self);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment