[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] xen: conditionalize PCI reassign code by a config option, selected



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1223992688 -3600
# Node ID 16c549b3ba59e21c36f03a1e499e7908417ecca1
# Parent  70fb735a8e2847d0365952bd7ce0debee6c1a9d7
xen: conditionalize PCI reassign code by a config option, selected
only from privileged Xen configurations.

Also eliminate the pointless new macro ROUND_UP_TO_PAGESIZE().

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 drivers/pci/Kconfig     |    3 +++
 drivers/pci/Makefile    |    4 ++--
 drivers/pci/pci.h       |    7 +++++--
 drivers/pci/setup-bus.c |    5 ++---
 drivers/pci/setup-res.c |   14 +++++++++-----
 drivers/xen/Kconfig     |    1 +
 6 files changed, 22 insertions(+), 12 deletions(-)

diff -r 70fb735a8e28 -r 16c549b3ba59 drivers/pci/Kconfig
--- a/drivers/pci/Kconfig       Tue Oct 14 14:57:26 2008 +0100
+++ b/drivers/pci/Kconfig       Tue Oct 14 14:58:08 2008 +0100
@@ -17,6 +17,9 @@ config PCI_MSI
 
           If you don't know what to do here, say N.
 
+config PCI_REASSIGN
+       bool
+
 config PCI_DEBUG
        bool "PCI Debugging"
        depends on PCI && DEBUG_KERNEL
diff -r 70fb735a8e28 -r 16c549b3ba59 drivers/pci/Makefile
--- a/drivers/pci/Makefile      Tue Oct 14 14:57:26 2008 +0100
+++ b/drivers/pci/Makefile      Tue Oct 14 14:58:08 2008 +0100
@@ -3,8 +3,8 @@
 #
 
 obj-y          += access.o bus.o probe.o remove.o pci.o quirks.o \
-                       pci-driver.o search.o pci-sysfs.o rom.o setup-res.o \
-                       reassigndev.o
+                       pci-driver.o search.o pci-sysfs.o rom.o setup-res.o
+obj-$(CONFIG_PCI_REASSIGN) += reassigndev.o
 obj-$(CONFIG_PROC_FS) += proc.o
 
 # Build PCI Express stuff if needed
diff -r 70fb735a8e28 -r 16c549b3ba59 drivers/pci/pci.h
--- a/drivers/pci/pci.h Tue Oct 14 14:57:26 2008 +0100
+++ b/drivers/pci/pci.h Tue Oct 14 14:58:08 2008 +0100
@@ -99,8 +99,11 @@ pci_match_one_device(const struct pci_de
        return NULL;
 }
 
-#define ROUND_UP_TO_PAGESIZE(size) ((size + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
-
+#ifdef CONFIG_PCI_REASSIGN
 extern int reassign_resources;
 extern int is_reassigndev(struct pci_dev *dev);
 extern void pci_update_bridge(struct pci_dev *dev, int resno);
+#else
+#define reassign_resources 0
+#define is_reassigndev(dev) 0
+#endif
diff -r 70fb735a8e28 -r 16c549b3ba59 drivers/pci/setup-bus.c
--- a/drivers/pci/setup-bus.c   Tue Oct 14 14:57:26 2008 +0100
+++ b/drivers/pci/setup-bus.c   Tue Oct 14 14:58:08 2008 +0100
@@ -355,9 +355,8 @@ pbus_size_mem(struct pci_bus *bus, unsig
                                continue;
                        r_size = r->end - r->start + 1;
 
-                       if (reassign) {
-                               r_size = ROUND_UP_TO_PAGESIZE(r_size);
-                       }
+                       if (reassign)
+                               r_size = ALIGN(r_size, PAGE_SIZE);
 
                        /* For bridges size != alignment */
                        align = (i < PCI_BRIDGE_RESOURCES) ? r_size : r->start;
diff -r 70fb735a8e28 -r 16c549b3ba59 drivers/pci/setup-res.c
--- a/drivers/pci/setup-res.c   Tue Oct 14 14:57:26 2008 +0100
+++ b/drivers/pci/setup-res.c   Tue Oct 14 14:58:08 2008 +0100
@@ -117,7 +117,8 @@ pci_claim_resource(struct pci_dev *dev, 
 }
 EXPORT_SYMBOL_GPL(pci_claim_resource);
 
-void 
+#ifdef CONFIG_PCI_REASSIGN
+void
 pci_update_bridge(struct pci_dev *dev, int resno)
 {
        struct resource *res = &dev->resource[resno]; 
@@ -184,6 +185,7 @@ pci_update_bridge(struct pci_dev *dev, i
                break;
        }
 }
+#endif
 
 int pci_assign_resource(struct pci_dev *dev, int resno)
 {
@@ -202,7 +204,7 @@ int pci_assign_resource(struct pci_dev *
                align = size;
                if ((reassigndev) &&
                    (res->flags & IORESOURCE_MEM)) {
-                       align = ROUND_UP_TO_PAGESIZE(align);
+                       align = ALIGN(align, PAGE_SIZE);
                }
        } else {
                align = res->start;
@@ -231,9 +233,11 @@ int pci_assign_resource(struct pci_dev *
                        resno, (unsigned long long)size,
                        (unsigned long long)res->start, pci_name(dev));
        } else if (resno < PCI_BRIDGE_RESOURCES) {
-               printk(KERN_DEBUG "PCI: Assign resource(%d) on %s "
-                       "%016llx - %016llx\n", resno, pci_name(dev),
-                       (u64)res->start, (u64)res->end);
+               if (reassign_resources && is_reassigndev(dev))
+                       printk(KERN_DEBUG "PCI: Assign resource(%d) on %s "
+                               "%016llx - %016llx\n", resno, pci_name(dev),
+                                (unsigned long long)res->start,
+                                (unsigned long long)res->end);
                pci_update_resource(dev, res, resno);
        }
 
diff -r 70fb735a8e28 -r 16c549b3ba59 drivers/xen/Kconfig
--- a/drivers/xen/Kconfig       Tue Oct 14 14:57:26 2008 +0100
+++ b/drivers/xen/Kconfig       Tue Oct 14 14:58:08 2008 +0100
@@ -16,6 +16,7 @@ menu "XEN"
 
 config XEN_PRIVILEGED_GUEST
        bool "Privileged Guest (domain 0)"
+       select PCI_REASSIGN if PCI
        help
          Support for privileged operation (domain 0)
 

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.