]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
PCI: Add flag for devices that don't reset on D3hot->D0 transition
authorAlex Williamson <alex.williamson@redhat.com>
Fri, 21 Nov 2014 18:24:08 +0000 (11:24 -0700)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 16 Jan 2015 16:06:48 +0000 (10:06 -0600)
Per the PCI Power Management spec r1.2, sec 3.2.4, a device that advertises
No_Soft_Reset == 0 in the PMCSR register (reported by lspci as "NoSoftRst-")
should perform an internal reset when transitioning from D3hot to D0 via
software control.  Configuration context is lost and the device requires a
full reinitialization sequence.

Unfortunately the definition of "internal reset", beyond the application of
the configuration context, is largely left to the interpretation of the
specific device.  Some devices don't seem to perform an "internal reset"
even if they report No_Soft_Reset == 0.

We still need to honor the PCI specification and restore PCI config context
in the event that we do a PM reset, so we don't cache and modify the
PCI_PM_CTRL_NO_SOFT_RESET bit for the device, but for interfaces where the
intention is to reset the device, like pci_reset_function(), we need a
mechanism to flag that PM reset (a D3hot->D0 transition) doesn't perform
any significant "internal reset" of the device.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/pci.c
include/linux/pci.h

index e9d4fd861ba1c84a82f9561841d4e1da26715a2a..422bc0179e908122c6093b3e56e2c42e18bf188e 100644 (file)
@@ -3197,7 +3197,7 @@ static int pci_pm_reset(struct pci_dev *dev, int probe)
 {
        u16 csr;
 
-       if (!dev->pm_cap)
+       if (!dev->pm_cap || dev->dev_flags & PCI_DEV_FLAGS_NO_PM_RESET)
                return -ENOTTY;
 
        pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &csr);
index 44627f1df4caad4fac490add16bd012bd27e69fc..7bed32b3fd5433c3a07d6365e9c023306161e56d 100644 (file)
@@ -177,6 +177,8 @@ enum pci_dev_flags {
        PCI_DEV_FLAG_PCIE_BRIDGE_ALIAS = (__force pci_dev_flags_t) (1 << 5),
        /* Do not use bus resets for device */
        PCI_DEV_FLAGS_NO_BUS_RESET = (__force pci_dev_flags_t) (1 << 6),
+       /* Do not use PM reset even if device advertises NoSoftRst- */
+       PCI_DEV_FLAGS_NO_PM_RESET = (__force pci_dev_flags_t) (1 << 7),
 };
 
 enum pci_irq_reroute_variant {