OSDN Git Service

powerpc: Force page alignment for initrd reserved memory
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 9 Jun 2011 06:52:38 +0000 (16:52 +1000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 9 Jun 2011 06:52:38 +0000 (16:52 +1000)
commit307cfe715344e15eda12dad3bb14f794115ca823
tree1069c883a4abf9230b510821de3359e9d83b29a8
parentd660474e840a8ec5dc770f1a15d44e0045d411a6
powerpc: Force page alignment for initrd reserved memory

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: Dave Carroll <dcarroll@astekcorp.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kernel/prom.c
arch/powerpc/mm/init_32.c
arch/powerpc/mm/init_64.c
arch/powerpc/mm/mem.c