Skip to content

Commit 141d170

Browse files
committed
openrisc: Reserve memblock for initrd
Recently OpenRISC added support for external initrd images, but I found some instability when using larger buildroot initrd images. It turned out that I forgot to reserve the memblock space for the initrd image. This patch fixes the instability issue by reserving memblock space. Fixes: ff6c923 ("openrisc: Add support for external initrd images") Signed-off-by: Stafford Horne <[email protected]> Reviewed-by: Mike Rapoport <[email protected]>
1 parent d012a71 commit 141d170

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

arch/openrisc/kernel/setup.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ static void __init setup_memory(void)
8080
*/
8181
memblock_reserve(__pa(_stext), _end - _stext);
8282

83+
#ifdef CONFIG_BLK_DEV_INITRD
84+
/* Then reserve the initrd, if any */
85+
if (initrd_start && (initrd_end > initrd_start)) {
86+
unsigned long aligned_start = ALIGN_DOWN(initrd_start, PAGE_SIZE);
87+
unsigned long aligned_end = ALIGN(initrd_end, PAGE_SIZE);
88+
89+
memblock_reserve(__pa(aligned_start), aligned_end - aligned_start);
90+
}
91+
#endif /* CONFIG_BLK_DEV_INITRD */
92+
8393
early_init_fdt_reserve_self();
8494
early_init_fdt_scan_reserved_mem();
8595

0 commit comments

Comments
 (0)