]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
PCI: Wake-up devices before saving config space for reset
authorAlex Williamson <alex.williamson@redhat.com>
Thu, 8 Aug 2013 20:10:02 +0000 (14:10 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Wed, 14 Aug 2013 21:24:41 +0000 (15:24 -0600)
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>
drivers/pci/pci.c

index 12fccc24925cd7ebcf6a740651bb2b3059031a84..deb7fa9cc638c4225bd5c89a4d580ab2462d6263 100644 (file)
@@ -3332,6 +3332,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