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

Re: [Xen-devel] [PATCH] conditionalize PCI reassign code

To: Jan Beulich <jbeulich@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] conditionalize PCI reassign code
From: "Zhao, Yu" <yu.zhao@xxxxxxxxx>
Date: Fri, 17 Oct 2008 10:43:53 +0800
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx ; keir.fraser@xxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 16 Oct 2008 19:44:29 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <48F4BD46.76E4.0078.0@xxxxxxxxxx>
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>
References: <48F4BD46.76E4.0078.0@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.17 (Windows/20080914)
There is build error (c/s 701) with this patch, please take a look.

Thanks.

Jan Beulich wrote:
... by a config option, selected only from privileged Xen configurations.

Also eliminate the pointless new macro ROUND_UP_TO_PAGESIZE().

Finally, I'm not really understanding the need for two command line
options (reassigndev= and reassign_resources) here - wouldn't the
former suffice? Specifying one without the other doesn't seem to make
much sense...

As usual, written and tested on 2.6.27 and made apply to the 2.6.18
tree without further testing.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: head-2008-10-13/drivers/pci/Kconfig
===================================================================
--- head-2008-10-13.orig/drivers/pci/Kconfig    2008-10-13 15:11:33.000000000 
+0200
+++ head-2008-10-13/drivers/pci/Kconfig 2008-10-13 15:14:53.000000000 +0200
@@ -21,6 +21,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
Index: head-2008-10-13/drivers/pci/Makefile
===================================================================
--- head-2008-10-13.orig/drivers/pci/Makefile   2008-10-13 15:11:33.000000000 
+0200
+++ head-2008-10-13/drivers/pci/Makefile        2008-10-13 15:14:53.000000000 
+0200
@@ -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
Index: head-2008-10-13/drivers/pci/pci.h
===================================================================
--- head-2008-10-13.orig/drivers/pci/pci.h      2008-10-13 15:11:33.000000000 
+0200
+++ head-2008-10-13/drivers/pci/pci.h   2008-10-13 15:14:53.000000000 +0200
@@ -144,8 +144,11 @@ struct pci_slot_attribute {
        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
Index: head-2008-10-13/drivers/pci/setup-bus.c
===================================================================
--- head-2008-10-13.orig/drivers/pci/setup-bus.c        2008-10-13 
15:11:33.000000000 +0200
+++ head-2008-10-13/drivers/pci/setup-bus.c     2008-10-13 15:14:53.000000000 
+0200
@@ -354,9 +354,8 @@ static int pbus_size_mem(struct pci_bus
                                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;
Index: head-2008-10-13/drivers/pci/setup-res.c
===================================================================
--- head-2008-10-13.orig/drivers/pci/setup-res.c        2008-10-13 
15:11:33.000000000 +0200
+++ head-2008-10-13/drivers/pci/setup-res.c     2008-10-13 15:14:53.000000000 
+0200
@@ -126,7 +126,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];
@@ -193,6 +194,7 @@ pci_update_bridge(struct pci_dev *dev, i
                break;
        }
 }
+#endif

 int pci_assign_resource(struct pci_dev *dev, int resno)
 {
@@ -215,7 +217,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;
@@ -242,9 +244,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);
        }

Index: head-2008-10-13/drivers/xen/Kconfig
===================================================================
--- head-2008-10-13.orig/drivers/xen/Kconfig    2008-10-13 15:14:34.000000000 
+0200
+++ head-2008-10-13/drivers/xen/Kconfig 2008-10-13 15:16:22.000000000 +0200
@@ -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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


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