aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorChris Wright <chrisw@sous-sol.org>2011-07-13 13:14:33 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2011-07-22 11:41:51 -0400
commit864d296cf948aef0fa32b81407541572583f7572 (patch)
tree67d2cee99f6a5f591bcd6a19bb5333f6c4234598 /drivers/pci
parenta8c7ef3187a266d201af887fd48afbef3598825a (diff)
PCI: ARI is a PCIe v2 feature
The function pci_enable_ari() may mistakenly set the downstream port of a v1 PCIe switch in ARI Forwarding mode. This is a PCIe v2 feature, and with an SR-IOV device on that switch port believing the switch above is ARI capable it may attempt to use functions 8-255, translating into invalid (non-zero) device numbers for that bus. This has been seen to cause Completion Timeouts and general misbehaviour including hangs and panics. Cc: stable@kernel.org Acked-by: Don Dutile <ddutile@redhat.com> Tested-by: Don Dutile <ddutile@redhat.com> Signed-off-by: Chris Wright <chrisw@sous-sol.org> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pci.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 692671b11667..d549bbc93cdd 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1905,7 +1905,7 @@ void pci_enable_ari(struct pci_dev *dev)
1905{ 1905{
1906 int pos; 1906 int pos;
1907 u32 cap; 1907 u32 cap;
1908 u16 ctrl; 1908 u16 flags, ctrl;
1909 struct pci_dev *bridge; 1909 struct pci_dev *bridge;
1910 1910
1911 if (!pci_is_pcie(dev) || dev->devfn) 1911 if (!pci_is_pcie(dev) || dev->devfn)
@@ -1923,6 +1923,11 @@ void pci_enable_ari(struct pci_dev *dev)
1923 if (!pos) 1923 if (!pos)
1924 return; 1924 return;
1925 1925
1926 /* ARI is a PCIe v2 feature */
1927 pci_read_config_word(bridge, pos + PCI_EXP_FLAGS, &flags);
1928 if ((flags & PCI_EXP_FLAGS_VERS) < 2)
1929 return;
1930
1926 pci_read_config_dword(bridge, pos + PCI_EXP_DEVCAP2, &cap); 1931 pci_read_config_dword(bridge, pos + PCI_EXP_DEVCAP2, &cap);
1927 if (!(cap & PCI_EXP_DEVCAP2_ARI)) 1932 if (!(cap & PCI_EXP_DEVCAP2_ARI))
1928 return; 1933 return;