diff options
author | Stafford Horne <shorne@gmail.com> | 2020-08-30 13:58:11 +0200 |
---|---|---|
committer | Stafford Horne <shorne@gmail.com> | 2020-09-07 14:01:46 +0200 |
commit | 141d170495beb4772fad653312364dac6f4716f5 (patch) | |
tree | b64d47ec1fe91fa13e0b906eb2051481977aad47 /arch/openrisc | |
parent | Linux 5.9-rc2 (diff) | |
download | linux-141d170495beb4772fad653312364dac6f4716f5.tar.xz linux-141d170495beb4772fad653312364dac6f4716f5.zip |
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: ff6c923dbec3 ("openrisc: Add support for external initrd images")
Signed-off-by: Stafford Horne <shorne@gmail.com>
Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>
Diffstat (limited to 'arch/openrisc')
-rw-r--r-- | arch/openrisc/kernel/setup.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c index b18e775f8be3..13c87f1f872b 100644 --- a/arch/openrisc/kernel/setup.c +++ b/arch/openrisc/kernel/setup.c @@ -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(); |