Thread (18 messages) 18 messages, 4 authors, 2011-06-11

RE: [PATCH v2]powerpc: Force page alignment for initrd

From: Dave Carroll <hidden>
Date: 2011-05-20 23:24:01
Also in: lkml
Subsystem: linux for powerpc (32-bit and 64-bit), the rest · Maintainers: Madhavan Srinivasan, Michael Ellerman, Linus Torvalds

When using 64K pages with a separate cpio rootfs, U-Boot will align the roo=
tfs
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 alig=
nment
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 initrd to be kernel page aligned, to match the mechanism =
used
to free reserved memory.

Signed-off-by: Dave Carroll <redacted>
---
 arch/powerpc/kernel/prom.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 48aeb55..7e58f6b 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -555,7 +555,8 @@ static void __init early_reserve_mem(void)
 #ifdef CONFIG_BLK_DEV_INITRD
        /* then reserve the initrd, if any */
        if (initrd_start && (initrd_end > initrd_start))
-               memblock_reserve(__pa(initrd_start), initrd_end - initrd_st=
art);
+               memblock_reserve(_ALIGN_DOWN(__pa(initrd_start), PAGE_SIZE)=
,
+                       PAGE_ALIGN(initrd_end) - _ALIGN_DOWN(initrd_start, =
PAGE_SIZE));
 #endif /* CONFIG_BLK_DEV_INITRD */

 #ifdef CONFIG_PPC32
--
1.7.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help