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

[Xen-changelog] [xen-unstable] [POWERPC][XEN] Restore sanity to the memory allocated for the OFD devtree



# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Date 1180879345 14400
# Node ID dca7528ef9f16c331854d0b2c4fedb6dd8976b67
# Parent  bb02de55017ba1f9eb255330c1f75c15c99f467f
[POWERPC][XEN] Restore sanity to the memory allocated for the OFD devtree
 - Allocate less memory
 - Size the grub module to the actual OFD size

Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
---
 xen/arch/powerpc/boot_of.c |   27 ++++++++++++++++++---------
 1 files changed, 18 insertions(+), 9 deletions(-)

diff -r bb02de55017b -r dca7528ef9f1 xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.c        Sat Jun 02 22:01:45 2007 -0400
+++ b/xen/arch/powerpc/boot_of.c        Sun Jun 03 10:02:25 2007 -0400
@@ -1073,31 +1073,40 @@ static void * __init boot_of_devtree(mod
 static void * __init boot_of_devtree(module_t *mod, multiboot_info_t *mbi)
 {
     void *oft;
-    ulong oft_sz = 48 * PAGE_SIZE;
+    ulong alloc_sz = 32 << 10;    /* 32KiB should be plenty */
+    ulong sz;
 
     /* snapshot the tree */
-    oft = (void *)boot_of_alloc(oft_sz);
+    oft = (void *)boot_of_alloc(alloc_sz);
     if (oft == NULL)
         of_panic("Could not allocate OFD tree\n");
 
     of_printf("creating oftree at: 0x%p\n", oft);
     of_test("package-to-path");
-    oft = ofd_create(oft, oft_sz);
+    oft = ofd_create(oft, alloc_sz);
     pkg_save(oft);
-
-    if (ofd_size(oft) > oft_sz)
-         of_panic("Could not fit all of native devtree\n");
+    sz = ofd_size(oft);
+
+    if (sz > alloc_sz)
+        of_panic("Could not fit all of native devtree in 0x%lx of memory\n",
+            alloc_sz);
 
     boot_of_fixup_refs(oft);
     boot_of_fixup_chosen(oft);
 
-    if (ofd_size(oft) > oft_sz)
-         of_panic("Could not fit all devtree fixups\n");
+    if (sz > alloc_sz)
+         of_panic("Could not fit all devtree fixupsin 0x%lx of memory\n",
+            alloc_sz);
 
     ofd_walk(oft, __func__, OFD_ROOT, /* add_hype_props */ NULL, 2);
 
     mod->mod_start = (ulong)oft;
-    mod->mod_end = mod->mod_start + oft_sz;
+    mod->mod_end = ALIGN_UP(mod->mod_start + sz, PAGE_SIZE);
+
+    if (mod->mod_end -mod->mod_start > alloc_sz)
+        of_panic("Could not fit all devtree module in 0x%lx of memory\n",
+            alloc_sz);
+
     of_printf("%s: devtree mod @ 0x%016x - 0x%016x\n", __func__,
               mod->mod_start, mod->mod_end);
 

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