diff options
author | Keith Busch <keith.busch@intel.com> | 2017-03-30 05:48:59 +0200 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-03-30 05:54:46 +0200 |
commit | 89ee9f7680031d7df91a1a27abac69e034c2e892 (patch) | |
tree | 4e874d870f8fd310aa954153c590f6ae93517868 /drivers/pci/pci.h | |
parent | PCI: Export PCI device config accessors (diff) | |
download | linux-89ee9f7680031d7df91a1a27abac69e034c2e892.tar.xz linux-89ee9f7680031d7df91a1a27abac69e034c2e892.zip |
PCI: Add device disconnected state
Add a new state to pci_dev to be set when it is unexpectedly disconnected.
The PCI driver tear down functions can observe this new device state so
they may skip operations that will fail.
The pciehp and pcie-dpc drivers are aware when the link is down, so these
set the flag when their handlers detect the device is disconnected.
Tested-by: Krishna Dhulipala <krishnad@fb.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Wei Zhang <wzhang@fb.com>
Diffstat (limited to 'drivers/pci/pci.h')
-rw-r--r-- | drivers/pci/pci.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 8dd38e69d6f2..245719c3e409 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -274,6 +274,20 @@ struct pci_sriov { resource_size_t barsz[PCI_SRIOV_NUM_BARS]; /* VF BAR size */ }; +/* pci_dev priv_flags */ +#define PCI_DEV_DISCONNECTED 0 + +static inline int pci_dev_set_disconnected(struct pci_dev *dev, void *unused) +{ + set_bit(PCI_DEV_DISCONNECTED, &dev->priv_flags); + return 0; +} + +static inline bool pci_dev_is_disconnected(const struct pci_dev *dev) +{ + return test_bit(PCI_DEV_DISCONNECTED, &dev->priv_flags); +} + #ifdef CONFIG_PCI_ATS void pci_restore_ats_state(struct pci_dev *dev); #else |