summaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci.c
diff options
context:
space:
mode:
authorBjorn Helgaas2013-01-27 01:27:36 +0100
committerBjorn Helgaas2013-01-27 01:27:36 +0100
commit14b5cb37cc6172a54ce920c61784f44422ae306d (patch)
tree53e500c8aec98e645079e025c2525ce399052e1d /drivers/pci/pci.c
parentMerge branch 'pci/rafael-set-root-bridge-handle' into next (diff)
parentPCI: shpchp: Iterate over all devices in slot, not functions 0-7 (diff)
downloadkernel-qcow2-linux-14b5cb37cc6172a54ce920c61784f44422ae306d.tar.gz
kernel-qcow2-linux-14b5cb37cc6172a54ce920c61784f44422ae306d.tar.xz
kernel-qcow2-linux-14b5cb37cc6172a54ce920c61784f44422ae306d.zip
Merge branch 'pci/yijing-ari' into next
* pci/yijing-ari: PCI: shpchp: Iterate over all devices in slot, not functions 0-7 PCI: sgihp: Iterate over all devices in slot, not functions 0-7 PCI: cpcihp: Iterate over all devices in slot, not functions 0-7 PCI: pciehp: Iterate over all devices in slot, not functions 0-7 PCI: Consolidate "next-function" functions PCI: Rename pci_enable_ari() to pci_configure_ari() PCI: Enable ARI if dev and upstream bridge support it; disable otherwise
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r--drivers/pci/pci.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 89dc8ac096ba..177a50ff6454 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2042,10 +2042,13 @@ void pci_free_cap_save_buffers(struct pci_dev *dev)
}
/**
- * pci_enable_ari - enable ARI forwarding if hardware support it
+ * pci_configure_ari - enable or disable ARI forwarding
* @dev: the PCI device
+ *
+ * If @dev and its upstream bridge both support ARI, enable ARI in the
+ * bridge. Otherwise, disable ARI in the bridge.
*/
-void pci_enable_ari(struct pci_dev *dev)
+void pci_configure_ari(struct pci_dev *dev)
{
u32 cap;
struct pci_dev *bridge;
@@ -2053,9 +2056,6 @@ void pci_enable_ari(struct pci_dev *dev)
if (pcie_ari_disabled || !pci_is_pcie(dev) || dev->devfn)
return;
- if (!pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ARI))
- return;
-
bridge = dev->bus->self;
if (!bridge)
return;
@@ -2064,8 +2064,15 @@ void pci_enable_ari(struct pci_dev *dev)
if (!(cap & PCI_EXP_DEVCAP2_ARI))
return;
- pcie_capability_set_word(bridge, PCI_EXP_DEVCTL2, PCI_EXP_DEVCTL2_ARI);
- bridge->ari_enabled = 1;
+ if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ARI)) {
+ pcie_capability_set_word(bridge, PCI_EXP_DEVCTL2,
+ PCI_EXP_DEVCTL2_ARI);
+ bridge->ari_enabled = 1;
+ } else {
+ pcie_capability_clear_word(bridge, PCI_EXP_DEVCTL2,
+ PCI_EXP_DEVCTL2_ARI);
+ bridge->ari_enabled = 0;
+ }
}
/**