WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [linux-2.6.18-xen] Backport: PCI: fix ARI code to be com

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [linux-2.6.18-xen] Backport: PCI: fix ARI code to be compatible with mixed ARI/non-ARI
From: "Xen patchbot-linux-2.6.18-xen" <patchbot-linux-2.6.18-xen@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 13 Mar 2009 00:50:20 -0700
Delivery-date: Fri, 13 Mar 2009 00:51:33 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1236930083 0
# Node ID 44fd32e157f23d0a620b22ec32705fa0f5e04295
# Parent  36d8c23b75745c2bd8dd906eb7d2294df3d966b2
Backport: PCI: fix ARI code to be compatible with mixed ARI/non-ARI
systems

    commit 8113587c2d14d3be2414190845b2e2617c0aa33b
    Author: Zhao, Yu <yu.zhao@xxxxxxxxx>
    Date:   Thu Oct 23 13:15:39 2008 +0800

    PCI: fix ARI code to be compatible with mixed ARI/non-ARI systems

    The original ARI support code has a compatibility problem with
    non-ARI
    devices.  If a device doesn't support ARI, turning on ARI
    forwarding on
    its upper level bridge will cause undefined behavior.

    This fix turns on ARI forwarding only when the subordinate devices
    support it.

    Tested-by: Suresh Siddha <suresh.b.siddha@xxxxxxxxx>
    Signed-off-by: Yu Zhao <yu.zhao@xxxxxxxxx>
    Signed-off-by: Jesse Barnes <jbarnes@xxxxxxxxxxxxxxxx>

Signed-off-by: Yu Zhao <yu.zhao@xxxxxxxxx>
---
 drivers/pci/pci.c |   29 +++++++++++++++++------------
 1 files changed, 17 insertions(+), 12 deletions(-)

diff -r 36d8c23b7574 -r 44fd32e157f2 drivers/pci/pci.c
--- a/drivers/pci/pci.c Fri Mar 13 07:40:54 2009 +0000
+++ b/drivers/pci/pci.c Fri Mar 13 07:41:23 2009 +0000
@@ -638,27 +638,32 @@ void pci_enable_ari(struct pci_dev *dev)
        int pos;
        u32 cap;
        u16 ctrl;
-
-       if (!dev->is_pcie)
+       struct pci_dev *bridge;
+
+       if (dev->devfn)
                return;
 
-       if (dev->pcie_type != PCI_EXP_TYPE_ROOT_PORT &&
-           dev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM)
-               return;
-
-       pos = pci_find_capability(dev, PCI_CAP_ID_EXP);
+       pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ARI);
        if (!pos)
                return;
 
-       pci_read_config_dword(dev, pos + PCI_EXP_DEVCAP2, &cap);
+       bridge = dev->bus->self;
+       if (!bridge)
+               return;
+
+       pos = pci_find_capability(bridge, PCI_CAP_ID_EXP);
+       if (!pos)
+               return;
+
+       pci_read_config_dword(bridge, pos + PCI_EXP_DEVCAP2, &cap);
        if (!(cap & PCI_EXP_DEVCAP2_ARI))
                return;
 
-       pci_read_config_word(dev, pos + PCI_EXP_DEVCTL2, &ctrl);
+       pci_read_config_word(bridge, pos + PCI_EXP_DEVCTL2, &ctrl);
        ctrl |= PCI_EXP_DEVCTL2_ARI;
-       pci_write_config_word(dev, pos + PCI_EXP_DEVCTL2, ctrl);
-
-       dev->ari_enabled = 1;
+       pci_write_config_word(bridge, pos + PCI_EXP_DEVCTL2, ctrl);
+
+       bridge->ari_enabled = 1;
 }
 
 int

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [linux-2.6.18-xen] Backport: PCI: fix ARI code to be compatible with mixed ARI/non-ARI, Xen patchbot-linux-2.6.18-xen <=