diff options
author | Keith Busch <keith.busch@intel.com> | 2017-03-29 22:49:11 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-03-29 22:55:07 -0500 |
commit | 0170591bb06788034ae72bfa56e42f283ab3de5a (patch) | |
tree | a973d7ad933e06c89f39368f86fc33ef9b759648 /drivers/pci/msi.c | |
parent | 4b103883473964bbb7b0b6934999b283ee234a8a (diff) | |
download | lwn-0170591bb06788034ae72bfa56e42f283ab3de5a.tar.gz lwn-0170591bb06788034ae72bfa56e42f283ab3de5a.zip |
PCI/MSI: Skip disabling disconnected devices
Check the device connected state prior to executing device shutdown
operations or writing MSI messages so that tear down on disconnected
devices completes quicker.
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/msi.c')
-rw-r--r-- | drivers/pci/msi.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index d571bc330686..33e766a9dd91 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -298,7 +298,7 @@ void __pci_write_msi_msg(struct msi_desc *entry, struct msi_msg *msg) { struct pci_dev *dev = msi_desc_to_pci_dev(entry); - if (dev->current_state != PCI_D0) { + if (dev->current_state != PCI_D0 || pci_dev_is_disconnected(dev)) { /* Don't touch the hardware now */ } else if (entry->msi_attrib.is_msix) { void __iomem *base = pci_msix_desc_addr(entry); @@ -1001,6 +1001,11 @@ void pci_msix_shutdown(struct pci_dev *dev) if (!pci_msi_enable || !dev || !dev->msix_enabled) return; + if (pci_dev_is_disconnected(dev)) { + dev->msix_enabled = 0; + return; + } + /* Return the device with MSI-X masked as initial states */ for_each_pci_msi_entry(entry, dev) { /* Keep cached states to be restored */ |