diff options
author | Alex Williamson <alex.williamson@redhat.com> | 2014-01-06 18:07:48 +1100 |
---|---|---|
committer | Eli Qiao <taget@linux.vnet.ibm.com> | 2014-01-06 15:58:13 +0800 |
commit | fe135283f7a17e0649161c196de54367b86ffe47 (patch) | |
tree | 62a140c18a8dc14bf5e26001d72e6902a4f2f3dc | |
parent | c4f1040c404b34a17c4b12f4d8c686db36a06ec1 (diff) | |
download | powerkvm-fe135283f7a17e0649161c196de54367b86ffe47.tar.gz |
PCI: Add pci_probe_reset_slot() and pci_probe_reset_bus()
Users of pci_reset_bus() and pci_reset_slot() need a way to probe
whether the bus or slot supports reset. Add trivial helper functions
and export them as vfio-pci will make use of these.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
(cherry picked from commit 9a3d2b9beefd5b07c1d8f70ded01b88f203ee304)
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
-rw-r--r-- | drivers/pci/pci.c | 24 | ||||
-rw-r--r-- | include/linux/pci.h | 2 |
2 files changed, 26 insertions, 0 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 6533043fba3e6..aef4604f9af56 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -3600,6 +3600,18 @@ static int pci_slot_reset(struct pci_slot *slot, int probe) } /** + * pci_probe_reset_slot - probe whether a PCI slot can be reset + * @slot: PCI slot to probe + * + * Return 0 if slot can be reset, negative if a slot reset is not supported. + */ +int pci_probe_reset_slot(struct pci_slot *slot) +{ + return pci_slot_reset(slot, 1); +} +EXPORT_SYMBOL_GPL(pci_probe_reset_slot); + +/** * pci_reset_slot - reset a PCI slot * @slot: PCI slot to reset * @@ -3652,6 +3664,18 @@ static int pci_bus_reset(struct pci_bus *bus, int probe) } /** + * pci_probe_reset_bus - probe whether a PCI bus can be reset + * @bus: PCI bus to probe + * + * Return 0 if bus can be reset, negative if a bus reset is not supported. + */ +int pci_probe_reset_bus(struct pci_bus *bus) +{ + return pci_bus_reset(bus, 1); +} +EXPORT_SYMBOL_GPL(pci_probe_reset_bus); + +/** * pci_reset_bus - reset a PCI bus * @bus: top level PCI bus to reset * diff --git a/include/linux/pci.h b/include/linux/pci.h index 2d127bedda27b..da6a0d0c4cb14 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -923,7 +923,9 @@ int pcie_set_mps(struct pci_dev *dev, int mps); int __pci_reset_function(struct pci_dev *dev); int __pci_reset_function_locked(struct pci_dev *dev); int pci_reset_function(struct pci_dev *dev); +int pci_probe_reset_slot(struct pci_slot *slot); int pci_reset_slot(struct pci_slot *slot); +int pci_probe_reset_bus(struct pci_bus *bus); int pci_reset_bus(struct pci_bus *bus); void pci_reset_bridge_secondary_bus(struct pci_dev *dev); void pci_update_resource(struct pci_dev *dev, int resno); |