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] dom0 linux: Fix and cleanup reassigni

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [linux-2.6.18-xen] dom0 linux: Fix and cleanup reassigning memory resource code.
From: "Xen patchbot-linux-2.6.18-xen" <patchbot-linux-2.6.18-xen@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 28 Nov 2008 10:50:08 -0800
Delivery-date: Fri, 28 Nov 2008 10:49:51 -0800
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 1227877656 0
# Node ID 2268be46c75ec6eddb7cd387af8a236a565f6140
# Parent  0b859c9516ba7831904d5437c7cdc0da07ecf12a
dom0 linux: Fix and cleanup reassigning memory resource code.

When we use PCI pass-through, we have to assign page-aligned resources
to device. To do this, we round up the alignment to PAGE_SIZE, if
device is specified by "reassigndev=" boot parameter.

"pdev_sort_resources" function uses the alignment. But it does not
round up the alignment to PAGE_SIZE. This patch makes
"pdev_sort_resources" function round up the alignment to PAGE_SIZE.

"pbus_size_mem" function round up the alignment of bridge's resource
window as well as that of normal resource. But we don't need to do
this. This patch makes "pbus_size_mem" function exclude bridges's
resource window.

This patch also cleanups code of reassigning memory resource.

Signed-off-by: Yuji Shimada <shimada-yxb@xxxxxxxxxxxxxxx>
---
 drivers/pci/pci.h       |    1 -
 drivers/pci/quirks.c    |    3 ++-
 drivers/pci/setup-bus.c |    2 +-
 drivers/pci/setup-res.c |   10 ++++++++++
 4 files changed, 13 insertions(+), 3 deletions(-)

diff -r 0b859c9516ba -r 2268be46c75e drivers/pci/pci.h
--- a/drivers/pci/pci.h Wed Nov 26 11:13:49 2008 +0000
+++ b/drivers/pci/pci.h Fri Nov 28 13:07:36 2008 +0000
@@ -104,5 +104,4 @@ extern void pci_disable_bridge_window(st
 extern void pci_disable_bridge_window(struct pci_dev *dev);
 #else
 #define is_reassigndev(dev) 0
-static inline void pci_disable_bridge_window(struct pci_dev *dev) {}
 #endif
diff -r 0b859c9516ba -r 2268be46c75e drivers/pci/quirks.c
--- a/drivers/pci/quirks.c      Wed Nov 26 11:13:49 2008 +0000
+++ b/drivers/pci/quirks.c      Fri Nov 28 13:07:36 2008 +0000
@@ -24,6 +24,7 @@
 #include "pci.h"
 
 
+#ifdef CONFIG_PCI_REASSIGN
 /*
  * This quirk function disables the device and releases resources
  * which is specified by kernel's boot parameter 'reassigndev'.
@@ -66,10 +67,10 @@ static void __devinit quirk_release_reso
                    (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
                        pci_disable_bridge_window(dev);
                }
-               return;
        }
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, quirk_release_resources);
+#endif  /* CONFIG_PCI_REASSIGN */
 
 /* The Mellanox Tavor device gives false positive parity errors
  * Mark this device with a broken_parity_status, to allow
diff -r 0b859c9516ba -r 2268be46c75e drivers/pci/setup-bus.c
--- a/drivers/pci/setup-bus.c   Wed Nov 26 11:13:49 2008 +0000
+++ b/drivers/pci/setup-bus.c   Fri Nov 28 13:07:36 2008 +0000
@@ -355,7 +355,7 @@ pbus_size_mem(struct pci_bus *bus, unsig
                                continue;
                        r_size = r->end - r->start + 1;
 
-                       if (reassign)
+                       if ((i < PCI_BRIDGE_RESOURCES) && reassign)
                                r_size = ALIGN(r_size, PAGE_SIZE);
 
                        /* For bridges size != alignment */
diff -r 0b859c9516ba -r 2268be46c75e drivers/pci/setup-res.c
--- a/drivers/pci/setup-res.c   Wed Nov 26 11:13:49 2008 +0000
+++ b/drivers/pci/setup-res.c   Fri Nov 28 13:07:36 2008 +0000
@@ -234,6 +234,7 @@ pdev_sort_resources(struct pci_dev *dev,
 pdev_sort_resources(struct pci_dev *dev, struct resource_list *head)
 {
        int i;
+       int reassigndev = is_reassigndev(dev);
 
        for (i = 0; i < PCI_NUM_RESOURCES; i++) {
                struct resource *r;
@@ -245,6 +246,11 @@ pdev_sort_resources(struct pci_dev *dev,
                
                if (!(r->flags) || r->parent)
                        continue;
+               
+               if (i < PCI_BRIDGE_RESOURCES && (r->flags & IORESOURCE_MEM) &&
+                   reassigndev)
+                       r_align = ALIGN(r_align, PAGE_SIZE);
+
                if (!r_align) {
                        printk(KERN_WARNING "PCI: Ignore bogus resource %d "
                                "[%llx:%llx] of %s\n",
@@ -263,6 +269,10 @@ pdev_sort_resources(struct pci_dev *dev,
                                align = (idx < PCI_BRIDGE_RESOURCES) ?
                                        ln->res->end - ln->res->start + 1 :
                                        ln->res->start;
+                               if ((idx < PCI_BRIDGE_RESOURCES) &&
+                                   (ln->res->flags & IORESOURCE_MEM) &&
+                                   is_reassigndev(ln->dev))
+                                       align = ALIGN(align, PAGE_SIZE);
                        }
                        if (r_align > align) {
                                tmp = kmalloc(sizeof(*tmp), GFP_KERNEL);

_______________________________________________
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] dom0 linux: Fix and cleanup reassigning memory resource code., Xen patchbot-linux-2.6.18-xen <=