• Benjamin Herrenschmidt's avatar
    powerpc: Force page alignment for initrd reserved memory · 307cfe71
    Benjamin Herrenschmidt authored
    When using 64K pages with a separate cpio rootfs, U-Boot will align
    the rootfs on a 4K page boundary. When the memory is reserved, and
    subsequent early memblock_alloc is called, it will allocate memory
    between the 64K page alignment and reserved memory. When the reserved
    memory is subsequently freed, it is done so by pages, causing the
    early memblock_alloc requests to be re-used, which in my case, caused
    the device-tree to be clobbered.
    
    This patch forces the reserved memory for initrd to be kernel page
    aligned, and will move the device tree if it overlaps with the range
    extension of initrd. This patch will also consolidate the identical
    function free_initrd_mem() from mm/init_32.c, init_64.c to mm/mem.c,
    and adds the same range extension when freeing initrd. free_initrd_mem()
    is also moved to the __init section.
    
    Many thanks to Milton Miller for his input on this patch.
    
    [BenH: Fixed build without CONFIG_BLK_DEV_INITRD]
    Signed-off-by: default avatarDave Carroll <dcarroll@astekcorp.com>
    Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
    307cfe71
mem.c 14.2 KB