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] Mark all non-RAM pages as I/O holes in the frame_table.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Mark all non-RAM pages as I/O holes in the frame_table.
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Thu, 19 May 2005 13:49:14 +0000
Delivery-date: Thu, 19 May 2005 14:02:48 +0000
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/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Mark all non-RAM pages as I/O holes in the frame_table., BitKeeper Bot <=