# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 7a20fed8be73857abe33d308ed27099efbff4a3c
# Parent  1d9c135673e4db41789d730d843c9e5f8de3a4eb
[POWERPC][TOOLS] flatdevtree requires us to reserve the ramdisk

The following patch solves the DomU:
  Freeing initrd memory: 3137k freed
  Bad page state in process 'swapper'

error message that was cause by not reserving the memory in the
flattened device tree.

We have to pre-reserve these entries when we create the tree in
FlatDeviceTree.py and fix it later because there appears to be no way
to add a reservation in libxc.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 tools/libxc/powerpc64/xc_linux_build.c  |    8 +++++++-
 tools/python/xen/xend/FlatDeviceTree.py |    8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff -r 1d9c135673e4 -r 7a20fed8be73 tools/libxc/powerpc64/xc_linux_build.c
--- a/tools/libxc/powerpc64/xc_linux_build.c    Fri Sep 15 18:20:55 2006 -0400
+++ b/tools/libxc/powerpc64/xc_linux_build.c    Sat Sep 16 09:34:26 2006 -0400
@@ -208,6 +208,12 @@ static int load_devtree(
         return rc;
     }
 
+    rc = ft_set_rsvmap(devtree, 1, initrd_base, initrd_len);
+    if (rc < 0) {
+        DPRINTF("couldn't set initrd reservation\n");
+        return ~0UL;
+    }
+
     /* start-info (XXX being removed soon) */
     rc = ft_set_prop(&devtree, xen, "start-info",
             start_info, sizeof(start_info));
@@ -379,7 +385,7 @@ static unsigned long create_start_info(v
 
     rc = ft_set_rsvmap(devtree, 0, si_addr, 4*PAGE_SIZE);
     if (rc < 0) {
-        DPRINTF("couldn't set first reservation\n");
+        DPRINTF("couldn't set start_info reservation\n");
         return ~0UL;
     }
 
diff -r 1d9c135673e4 -r 7a20fed8be73 tools/python/xen/xend/FlatDeviceTree.py
--- a/tools/python/xen/xend/FlatDeviceTree.py   Fri Sep 15 18:20:55 2006 -0400
+++ b/tools/python/xen/xend/FlatDeviceTree.py   Sat Sep 16 09:34:26 2006 -0400
@@ -271,8 +271,14 @@ def build(imghandler):
     the host's device tree.'''
     root = Tree()
 
-    # 4 pages: start_info, console, store, shared_info
+    # 1st reseravtion entry used for start_info, console, store, shared_info
     root.reserve(0x3ffc000, 0x4000)
+
+    # 2nd reservation enrty used for initrd, later on when we load the
+    # initrd we may fill this in with zeroes which signifies the end
+    # of the reservation map.  So as to avoid adding a zero map now we
+    # put some bogus yet sensible numbers here.
+    root.reserve(0x1000000, 0x1000)
 
     root.addprop('device_type', 'chrp-but-not-really\0')
     root.addprop('#size-cells', 2)

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

Reply via email to