direct-io.hg

changeset 15486:dca7528ef9f1

[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@watson.ibm.com>
author Jimi Xenidis <jimix@watson.ibm.com>
date Sun Jun 03 10:02:25 2007 -0400 (2007-06-03)
parents bb02de55017b
children cb40299a0733
files xen/arch/powerpc/boot_of.c
line diff
     1.1 --- a/xen/arch/powerpc/boot_of.c	Sat Jun 02 22:01:45 2007 -0400
     1.2 +++ b/xen/arch/powerpc/boot_of.c	Sun Jun 03 10:02:25 2007 -0400
     1.3 @@ -1073,31 +1073,40 @@ static int __init boot_of_rtas(module_t 
     1.4  static void * __init boot_of_devtree(module_t *mod, multiboot_info_t *mbi)
     1.5  {
     1.6      void *oft;
     1.7 -    ulong oft_sz = 48 * PAGE_SIZE;
     1.8 +    ulong alloc_sz = 32 << 10;    /* 32KiB should be plenty */
     1.9 +    ulong sz;
    1.10  
    1.11      /* snapshot the tree */
    1.12 -    oft = (void *)boot_of_alloc(oft_sz);
    1.13 +    oft = (void *)boot_of_alloc(alloc_sz);
    1.14      if (oft == NULL)
    1.15          of_panic("Could not allocate OFD tree\n");
    1.16  
    1.17      of_printf("creating oftree at: 0x%p\n", oft);
    1.18      of_test("package-to-path");
    1.19 -    oft = ofd_create(oft, oft_sz);
    1.20 +    oft = ofd_create(oft, alloc_sz);
    1.21      pkg_save(oft);
    1.22 +    sz = ofd_size(oft);
    1.23  
    1.24 -    if (ofd_size(oft) > oft_sz)
    1.25 -         of_panic("Could not fit all of native devtree\n");
    1.26 +    if (sz > alloc_sz)
    1.27 +        of_panic("Could not fit all of native devtree in 0x%lx of memory\n",
    1.28 +            alloc_sz);
    1.29  
    1.30      boot_of_fixup_refs(oft);
    1.31      boot_of_fixup_chosen(oft);
    1.32  
    1.33 -    if (ofd_size(oft) > oft_sz)
    1.34 -         of_panic("Could not fit all devtree fixups\n");
    1.35 +    if (sz > alloc_sz)
    1.36 +         of_panic("Could not fit all devtree fixupsin 0x%lx of memory\n",
    1.37 +            alloc_sz);
    1.38  
    1.39      ofd_walk(oft, __func__, OFD_ROOT, /* add_hype_props */ NULL, 2);
    1.40  
    1.41      mod->mod_start = (ulong)oft;
    1.42 -    mod->mod_end = mod->mod_start + oft_sz;
    1.43 +    mod->mod_end = ALIGN_UP(mod->mod_start + sz, PAGE_SIZE);
    1.44 +
    1.45 +    if (mod->mod_end -mod->mod_start > alloc_sz)
    1.46 +        of_panic("Could not fit all devtree module in 0x%lx of memory\n",
    1.47 +            alloc_sz);
    1.48 +
    1.49      of_printf("%s: devtree mod @ 0x%016x - 0x%016x\n", __func__,
    1.50                mod->mod_start, mod->mod_end);
    1.51