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-devel

[Xen-devel] [PATCH 5/9] dom0 PCI: reserve bus range for SR-IOV device

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 5/9] dom0 PCI: reserve bus range for SR-IOV device
From: "Zhao, Yu" <yu.zhao@xxxxxxxxx>
Date: Sat, 27 Sep 2008 16:59:19 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Delivery-date: Sat, 27 Sep 2008 02:03:21 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Ackgf1PCw03mVbJnRpapIxeETA35DA==
Thread-topic: [PATCH 5/9] dom0 PCI: reserve bus range for SR-IOV device
Reserve bus range for SR-IOV at device scanning stage.

Signed-off-by: Yu Zhao <yu.zhao@xxxxxxxxx>

diff -r 75504b97c0ab -r f9bb37cf38ed drivers/pci/iov.c
--- a/drivers/pci/iov.c Sat Sep 27 01:27:01 2008 -0400
+++ b/drivers/pci/iov.c Sat Sep 27 01:27:42 2008 -0400
@@ -582,6 +582,30 @@
        kfree(iov->ve);
 }

+/**
+ * pci_iov_bus_range - find bus range used by SR-IOV capability
+ * @bus: the PCI bus
+ *
+ * Returns max number of buses (exclude current one) used by Virtual
+ * Functions.
+ */
+int pci_iov_bus_range(struct pci_bus *bus)
+{
+       int max = 0;
+       u8 busnr, devfn;
+       struct pci_dev *dev;
+
+       list_for_each_entry(dev, &bus->devices, bus_list) {
+               if (!dev->iov)
+                       continue;
+               vf_rid(dev, dev->iov->totalvfs - 1, &busnr, &devfn);
+               if (busnr > max)
+                       max = busnr;
+       }
+
+       return max ? max - bus->number : 0;
+}
+
 int pci_iov_resource_align(struct pci_dev *dev, int resno)
 {
        if (resno < PCI_IOV_RESOURCES || resno > PCI_IOV_RESOURCES_END)
diff -r 75504b97c0ab -r f9bb37cf38ed drivers/pci/pci.h
--- a/drivers/pci/pci.h Sat Sep 27 01:27:01 2008 -0400
+++ b/drivers/pci/pci.h Sat Sep 27 01:27:42 2008 -0400
@@ -160,6 +160,7 @@
 extern void pci_iov_release(struct pci_dev *dev);
 void pci_iov_create_sysfs(struct pci_dev *dev);
 void pci_iov_remove_sysfs(struct pci_dev *dev);
+extern int pci_iov_bus_range(struct pci_bus *bus);
 extern int pci_iov_resource_align(struct pci_dev *dev, int resno);
 extern int pci_iov_resource_bar(struct pci_dev *dev, int resno,
                                enum pci_bar_type *type);
@@ -177,6 +178,10 @@
 static inline void pci_iov_remove_sysfs(struct pci_dev *dev)
 {
 }
+extern inline int pci_iov_bus_range(struct pci_bus *bus)
+{
+       return 0;
+}
 static inline int pci_iov_resource_align(struct pci_dev *dev, int resno)
 {
        return 0;
diff -r 75504b97c0ab -r f9bb37cf38ed drivers/pci/probe.c
--- a/drivers/pci/probe.c       Sat Sep 27 01:27:01 2008 -0400
+++ b/drivers/pci/probe.c       Sat Sep 27 01:27:42 2008 -0400
@@ -969,6 +969,9 @@
        for (devfn = 0; devfn < 0x100; devfn += 8)
                pci_scan_slot(bus, devfn);

+       /* Reserve buses for SR-IOV capability. */
+       max += pci_iov_bus_range(bus);
+
        /*
         * After performing arch-dependent fixup of the bus, look behind
         * all PCI-to-PCI bridges on this bus.

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 5/9] dom0 PCI: reserve bus range for SR-IOV device, Zhao, Yu <=