]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.0.1/pci-ari-is-a-pcie-v2-feature.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.0.1 / pci-ari-is-a-pcie-v2-feature.patch
1 From 864d296cf948aef0fa32b81407541572583f7572 Mon Sep 17 00:00:00 2001
2 From: Chris Wright <chrisw@sous-sol.org>
3 Date: Wed, 13 Jul 2011 10:14:33 -0700
4 Subject: PCI: ARI is a PCIe v2 feature
5
6 From: Chris Wright <chrisw@sous-sol.org>
7
8 commit 864d296cf948aef0fa32b81407541572583f7572 upstream.
9
10 The function pci_enable_ari() may mistakenly set the downstream port
11 of a v1 PCIe switch in ARI Forwarding mode. This is a PCIe v2 feature,
12 and with an SR-IOV device on that switch port believing the switch above
13 is ARI capable it may attempt to use functions 8-255, translating into
14 invalid (non-zero) device numbers for that bus. This has been seen
15 to cause Completion Timeouts and general misbehaviour including hangs
16 and panics.
17
18 Acked-by: Don Dutile <ddutile@redhat.com>
19 Tested-by: Don Dutile <ddutile@redhat.com>
20 Signed-off-by: Chris Wright <chrisw@sous-sol.org>
21 Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
22 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
23
24 ---
25 drivers/pci/pci.c | 7 ++++++-
26 1 file changed, 6 insertions(+), 1 deletion(-)
27
28 --- a/drivers/pci/pci.c
29 +++ b/drivers/pci/pci.c
30 @@ -1905,7 +1905,7 @@ void pci_enable_ari(struct pci_dev *dev)
31 {
32 int pos;
33 u32 cap;
34 - u16 ctrl;
35 + u16 flags, ctrl;
36 struct pci_dev *bridge;
37
38 if (!pci_is_pcie(dev) || dev->devfn)
39 @@ -1923,6 +1923,11 @@ void pci_enable_ari(struct pci_dev *dev)
40 if (!pos)
41 return;
42
43 + /* ARI is a PCIe v2 feature */
44 + pci_read_config_word(bridge, pos + PCI_EXP_FLAGS, &flags);
45 + if ((flags & PCI_EXP_FLAGS_VERS) < 2)
46 + return;
47 +
48 pci_read_config_dword(bridge, pos + PCI_EXP_DEVCAP2, &cap);
49 if (!(cap & PCI_EXP_DEVCAP2_ARI))
50 return;