Skip to content

Commit

Permalink
openrisc: Reserve memblock for initrd
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
stffrdhrn committed Sep 7, 2020
1 parent d012a71 commit 141d170
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions arch/openrisc/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ static void __init setup_memory(void)
*/
memblock_reserve(__pa(_stext), _end - _stext);

#ifdef CONFIG_BLK_DEV_INITRD
/* Then reserve the initrd, if any */
if (initrd_start && (initrd_end > initrd_start)) {
unsigned long aligned_start = ALIGN_DOWN(initrd_start, PAGE_SIZE);
unsigned long aligned_end = ALIGN(initrd_end, PAGE_SIZE);

memblock_reserve(__pa(aligned_start), aligned_end - aligned_start);
}
#endif /* CONFIG_BLK_DEV_INITRD */

early_init_fdt_reserve_self();
early_init_fdt_scan_reserved_mem();

Expand Down

0 comments on commit 141d170

Please sign in to comment.