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] PCI: pass ARI and SR-IOV device infor

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [linux-2.6.18-xen] PCI: pass ARI and SR-IOV device information to the hypervisor
From: "Xen patchbot-linux-2.6.18-xen" <patchbot-linux-2.6.18-xen@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 19 Mar 2009 10:05:14 -0700
Delivery-date: Thu, 19 Mar 2009 10:06:03 -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 1237458106 0
# Node ID 558c390e3d9285d747b56cad88055f53feca24c6
# Parent  5ad6b350e4aba36680b42624755b7fdac80fbb15
PCI: pass ARI and SR-IOV device information to the hypervisor

PCIe Alternative Routing-ID Interpretation (ARI) ECN defines the Extended
Function -- a function whose function number is greater than 7 within an
ARI Device. Intel VT-d spec 1.2 section 8.3.2 specifies that the Extended
Function is under the scope of the same remapping unit as the traditional
function. The hypervisor needs to know if a function is Extended
Function so it can find proper DMAR for it.

And section 8.3.3 specifies that the SR-IOV Virtual Function is under the
scope of the same remapping unit as the Physical Function. The hypervisor
also needs to know if a function is the Virtual Function and which
Physical Function it's associated with for same reason.

Signed-off-by: Yu Zhao <yu.zhao@xxxxxxxxx>
---
 drivers/xen/core/pci.c          |   27 ++++++++++++++++++++++++---
 include/xen/interface/physdev.h |   16 ++++++++++++++++
 2 files changed, 40 insertions(+), 3 deletions(-)

diff -r 5ad6b350e4ab -r 558c390e3d92 drivers/xen/core/pci.c
--- a/drivers/xen/core/pci.c    Thu Mar 19 10:21:21 2009 +0000
+++ b/drivers/xen/core/pci.c    Thu Mar 19 10:21:46 2009 +0000
@@ -6,6 +6,7 @@
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <xen/interface/physdev.h>
+#include "../../pci/pci.h"
 
 static int (*pci_bus_probe)(struct device *dev);
 static int (*pci_bus_remove)(struct device *dev);
@@ -15,10 +16,30 @@ static int pci_bus_probe_wrapper(struct 
        int r;
        struct pci_dev *pci_dev = to_pci_dev(dev);
        struct physdev_manage_pci manage_pci;
-       manage_pci.bus = pci_dev->bus->number;
-       manage_pci.devfn = pci_dev->devfn;
+       struct physdev_manage_pci_ext manage_pci_ext;
 
-       r = HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_add, &manage_pci);
+       if (pci_dev->is_virtfn) {
+               memset(&manage_pci_ext, 0, sizeof(manage_pci_ext));
+               manage_pci_ext.bus = pci_dev->bus->number;
+               manage_pci_ext.devfn = pci_dev->devfn;
+               manage_pci_ext.is_virtfn = 1;
+               manage_pci_ext.physfn.bus = pci_dev->physfn->bus->number;
+               manage_pci_ext.physfn.devfn = pci_dev->physfn->devfn;
+               r = HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_add_ext,
+                                         &manage_pci_ext);
+       } else if (pci_ari_enabled(pci_dev->bus) && PCI_SLOT(pci_dev->devfn)) {
+               memset(&manage_pci_ext, 0, sizeof(manage_pci_ext));
+               manage_pci_ext.bus = pci_dev->bus->number;
+               manage_pci_ext.devfn = pci_dev->devfn;
+               manage_pci_ext.is_extfn = 1;
+               r = HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_add_ext,
+                                         &manage_pci_ext);
+       } else {
+               manage_pci.bus = pci_dev->bus->number;
+               manage_pci.devfn = pci_dev->devfn;
+               r = HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_add,
+                                         &manage_pci);
+       }
        if (r && r != -ENOSYS)
                return r;
 
diff -r 5ad6b350e4ab -r 558c390e3d92 include/xen/interface/physdev.h
--- a/include/xen/interface/physdev.h   Thu Mar 19 10:21:21 2009 +0000
+++ b/include/xen/interface/physdev.h   Thu Mar 19 10:21:46 2009 +0000
@@ -192,6 +192,22 @@ typedef struct physdev_restore_msi physd
 typedef struct physdev_restore_msi physdev_restore_msi_t;
 DEFINE_XEN_GUEST_HANDLE(physdev_restore_msi_t);
 
+#define PHYSDEVOP_manage_pci_add_ext   20
+struct physdev_manage_pci_ext {
+    /* IN */
+    uint8_t bus;
+    uint8_t devfn;
+    unsigned is_extfn;
+    unsigned is_virtfn;
+    struct {
+        uint8_t bus;
+        uint8_t devfn;
+    } physfn;
+};
+
+typedef struct physdev_manage_pci_ext physdev_manage_pci_ext_t;
+DEFINE_XEN_GUEST_HANDLE(physdev_manage_pci_ext_t);
+
 /*
  * Argument to physdev_op_compat() hypercall. Superceded by new physdev_op()
  * hypercall since 0x00030202.

_______________________________________________
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] PCI: pass ARI and SR-IOV device information to the hypervisor, Xen patchbot-linux-2.6.18-xen <=