[PATCH 1/4] PCI: Allow device quirks to exclude D3->D0 PM reset
From: Alex Williamson
Date: Fri Nov 21 2014 - 13:24:19 EST
The PCI PM spec indicates that when No_Soft_Reset is clear
(NoSoftRst-) that the device performs an internal reset when
transitioning From D3hot to D0. 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. For some devices, setting
NoSoftRst- appears arbitrary and no obvious "internal reset" occurs
on D3hot to D0 transition.
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
doesn't perform any significant "internal reset" of the device.
Signed-off-by: Alex Williamson <alex.williamson@xxxxxxxxxx>
---
drivers/pci/pci.c | 2 +-
include/linux/pci.h | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 625a4ac..ba54a5a 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -3206,7 +3206,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);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5be8db4..aea347d 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -175,6 +175,8 @@ enum pci_dev_flags {
PCI_DEV_FLAGS_DMA_ALIAS_DEVFN = (__force pci_dev_flags_t) (1 << 4),
/* Use a PCIe-to-PCI bridge alias even if !pci_is_pcie */
PCI_DEV_FLAG_PCIE_BRIDGE_ALIAS = (__force pci_dev_flags_t) (1 << 5),
+ /* Do not use PM reset even if device advertises NoSoftRst- */
+ PCI_DEV_FLAGS_NO_PM_RESET = (__force pci_dev_flags_t) (1 << 6),
};
enum pci_irq_reroute_variant {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/