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

[Xen-changelog] Mark all non-RAM pages as I/O holes in the frame_table.



ChangeSet 1.1464, 2005/05/19 14:49:14+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Mark all non-RAM pages as I/O holes in the frame_table.
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 mm.c    |   25 +++++++++++++------------
 setup.c |    4 ++--
 2 files changed, 15 insertions(+), 14 deletions(-)


diff -Nru a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c 2005-05-19 10:03:26 -04:00
+++ b/xen/arch/x86/mm.c 2005-05-19 10:03:26 -04:00
@@ -174,7 +174,7 @@
 {
     extern void subarch_init_memory(struct domain *);
 
-    unsigned long i, j, pfn, nr_pfns;
+    unsigned long i, pfn, rstart_pfn, rend_pfn;
     struct pfn_info *page;
 
     memset(percpu_info, 0, sizeof(percpu_info));
@@ -206,25 +206,26 @@
         page_set_owner(page, dom_io);
     }
  
-    /* Any non-RAM areas in the e820 map are considered to be for I/O. */
-    for ( i = 0; i < e820.nr_map; i++ )
+    /* Any areas not specified as RAM by the e820 map are considered I/O. */
+    for ( i = 0, pfn = 0; i < e820.nr_map; i++ )
     {
-        if ( e820.map[i].type == E820_RAM )
+        if ( e820.map[i].type != E820_RAM )
             continue;
-        pfn = e820.map[i].addr >> PAGE_SHIFT;
-        nr_pfns = (e820.map[i].size +
-                   (e820.map[i].addr & ~PAGE_MASK) +
-                   ~PAGE_MASK) >> PAGE_SHIFT;
-        for ( j = 0; j < nr_pfns; j++ )
+        /* Every page from cursor to start of next RAM region is I/O. */
+        rstart_pfn = PFN_UP(e820.map[i].addr);
+        rend_pfn   = PFN_DOWN(e820.map[i].addr + e820.map[i].size);
+        while ( pfn < rstart_pfn )
         {
-            if ( !pfn_valid(pfn+j) )
-                continue;
-            page = &frame_table[pfn+j];
+            BUG_ON(!pfn_valid(pfn));
+            page = &frame_table[pfn++];
             page->count_info        = PGC_allocated | 1;
             page->u.inuse.type_info = PGT_writable_page | PGT_validated | 1;
             page_set_owner(page, dom_io);
         }
+        /* Skip the RAM region. */
+        pfn = rend_pfn;
     }
+    BUG_ON(pfn != max_page);
 
     subarch_init_memory(dom_xen);
 }
diff -Nru a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      2005-05-19 10:03:26 -04:00
+++ b/xen/arch/x86/setup.c      2005-05-19 10:03:26 -04:00
@@ -582,8 +582,8 @@
         {
             /* Calculate page-frame range, discarding partial frames. */
             unsigned long start, end;
-            start = (e820.map[i].addr + PAGE_SIZE - 1) >> PAGE_SHIFT;
-            end   = (e820.map[i].addr + e820.map[i].size) >> PAGE_SHIFT;
+            start = PFN_UP(e820.map[i].addr);
+            end   = PFN_DOWN(e820.map[i].addr + e820.map[i].size);
             /* Clip the range to above 64MB. */
             if ( end < (64UL << (20-PAGE_SHIFT)) )
                 continue;

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