[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190402091741.11298-1-anup.patel@wdc.com>
Date: Tue, 2 Apr 2019 09:18:02 +0000
From: Anup Patel <Anup.Patel@....com>
To: Palmer Dabbelt <palmer@...ive.com>,
Albert Ou <aou@...s.berkeley.edu>
CC: Atish Patra <Atish.Patra@....com>,
Christoph Hellwig <hch@...radead.org>,
Paul Walmsley <paul.walmsley@...ive.com>,
Mike Rapoport <rppt@...ux.ibm.com>,
"linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Anup Patel <Anup.Patel@....com>
Subject: [PATCH v2] 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@....com>
---
Changes since v1:
- Use memblock_remove() instead of memblock_reserve()
---
arch/riscv/mm/init.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index 5fd8c922e1c2..b5038a121005 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);
--
2.17.1
Powered by blists - more mailing lists