summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAnup Patel <Anup.Patel@wdc.com>2019-04-05 05:49:34 +0000
committerPalmer Dabbelt <palmer@sifive.com>2019-04-10 09:41:40 -0700
commitf05badde4e20d2e0f8c39d07a6873b2bfb0754f8 (patch)
treebf43cde7dbc80911ccd86c3a87170ba1d2a68ee2 /arch
parent6ec4bae178d8a1e9814eb3bfdd321b0475de0468 (diff)
downloadlinux-f05badde4e20d2e0f8c39d07a6873b2bfb0754f8.tar.gz
linux-f05badde4e20d2e0f8c39d07a6873b2bfb0754f8.tar.bz2
linux-f05badde4e20d2e0f8c39d07a6873b2bfb0754f8.zip
RISC-V: Fix Maximum Physical Memory 2GiB option for 64bit systems
The Maximum Physical Memory 2GiB option for 64bit systems is currently broken because kernel hangs at boot-time when this option is enabled and the underlying system has more than 2GiB memory. This issue can be easily reproduced on SiFive Unleashed board where we have 8GiB of memory. This patch fixes above issue by removing unusable memory region in setup_bootmem(). Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/riscv/mm/init.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index 5fd8c922e1c2..bc7b77e34d09 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -121,6 +121,14 @@ void __init setup_bootmem(void)
*/
memblock_reserve(reg->base, vmlinux_end - reg->base);
mem_size = min(reg->size, (phys_addr_t)-PAGE_OFFSET);
+
+ /*
+ * Remove memblock from the end of usable area to the
+ * end of region
+ */
+ if (reg->base + mem_size < end)
+ memblock_remove(reg->base + mem_size,
+ end - reg->base - mem_size);
}
}
BUG_ON(mem_size == 0);