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

[Xen-changelog] [xen-unstable] vtd: Fix iommu_inclusive_mapping to map all under 4GB.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1236264924 0
# Node ID 5dee49f3a86e8620042ed575c04306d9a8367fe2
# Parent  3673926b2375a10c55dafb1a6c478e22ee0b08f2
vtd: Fix iommu_inclusive_mapping to map all under 4GB.

Signed-off-by: Ross Philipson <ross.philipson@xxxxxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/drivers/passthrough/vtd/x86/vtd.c |   33 +++++++++++++++++----------------
 1 files changed, 17 insertions(+), 16 deletions(-)

diff -r 3673926b2375 -r 5dee49f3a86e xen/drivers/passthrough/vtd/x86/vtd.c
--- a/xen/drivers/passthrough/vtd/x86/vtd.c     Thu Mar 05 09:32:37 2009 +0000
+++ b/xen/drivers/passthrough/vtd/x86/vtd.c     Thu Mar 05 14:55:24 2009 +0000
@@ -27,8 +27,11 @@
 #include "../dmar.h"
 #include "../vtd.h"
 
-/* iommu_inclusive_mapping: when set, all memory below 4GB is included in dom0 
1-1 iommu mappings except xen and unusable regions */
-static int iommu_inclusive_mapping = 0;
+/*
+ * iommu_inclusive_mapping: when set, all memory below 4GB is included in dom0
+ * 1:1 iommu mappings except xen and unusable regions.
+ */
+static int iommu_inclusive_mapping;
 boolean_param("iommu_inclusive_mapping", iommu_inclusive_mapping);
 
 void *map_vtd_domain_page(u64 maddr)
@@ -151,25 +154,23 @@ void iommu_set_dom0_mapping(struct domai
 void iommu_set_dom0_mapping(struct domain *d)
 {
     u64 i, j, tmp;
+    unsigned long max_pfn = max(max_page, 0x100000000ul >> PAGE_SHIFT);
     extern int xen_in_range(paddr_t start, paddr_t end);
 
     BUG_ON(d->domain_id != 0);
 
-    for ( i = 0; i < max_page; i++ )
+    for ( i = 0; i < max_pfn; i++ )
     {
-        /* Set up 1:1 mapping for dom0 */
-        if ( !page_is_ram_type(i, RAM_TYPE_CONVENTIONAL) )
-        {
-            /* Default it to use only conventional RAM areas and let RMRRs 
include needed reserved regions */
-            if (iommu_inclusive_mapping)
-            {
-                /* When set, the inclusive mapping maps in everything below 
4GB except unusable ranges */
-                if ( (i >= 0x100000) || page_is_ram_type(i, RAM_TYPE_UNUSABLE) 
)
-                    continue;
-            }
-            else
-                continue;
-        }
+        /*
+         * Set up 1:1 mapping for dom0. Default to use only conventional RAM 
+         * areas and let RMRRs include needed reserved regions. When set, the 
+         * inclusive mapping maps in everything below 4GB except unusable
+         * ranges. 
+         */
+        if ( !page_is_ram_type(i, RAM_TYPE_CONVENTIONAL) &&
+             (!iommu_inclusive_mapping ||
+              page_is_ram_type(i, RAM_TYPE_UNUSABLE)) )
+            continue;
 
         /* Exclude Xen bits */
         if ( xen_in_range(i << PAGE_SHIFT, (i + 1) << PAGE_SHIFT) )

_______________________________________________
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®.