diff options
author | Alex Williamson <alex.williamson@redhat.com> | 2014-01-06 18:07:45 +1100 |
---|---|---|
committer | Eli Qiao <taget@linux.vnet.ibm.com> | 2014-01-06 15:58:11 +0800 |
commit | da06515f7cf0d703b8c19e26ee48a603b6c09649 (patch) | |
tree | 0672631c80efd5b64ee161d13be4a1ac77ebc32b | |
parent | a6e3aaa031ea96479574df24531f65d7d679eeef (diff) | |
download | powerkvm-da06515f7cf0d703b8c19e26ee48a603b6c09649.tar.gz |
PCI: Wake-up devices before saving config space for reset
Devices come out of reset in D0. Restoring a device to a different
post-reset state takes more smarts than our simple config space
restore, which can leave devices in an inconsistent state. For
example, if a device is reset in D3, but the restore doesn't
successfully return the device to D3, then the actual state of the
device and dev->current_state are contradictory. Put everything
in D0 going into the reset, then we don't need to do anything
special on the way out.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
(cherry picked from commit a6cbaadea0af9b4aa6eee2882f2aa761ab91a4f8)
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
-rw-r--r-- | drivers/pci/pci.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index dcec84291e5712..d1759e47253300 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -3322,6 +3322,13 @@ static void pci_dev_unlock(struct pci_dev *dev) static void pci_dev_save_and_disable(struct pci_dev *dev) { + /* + * Wake-up device prior to save. PM registers default to D0 after + * reset and a simple register restore doesn't reliably return + * to a non-D0 state anyway. + */ + pci_set_power_state(dev, PCI_D0); + pci_save_state(dev); /* * Disable the device by clearing the Command register, except for |