riscv: Parse all memory blocks to remove unusable memory
authorAtish Patra <atish.patra@wdc.com>
Wed, 15 Jul 2020 23:30:09 +0000 (16:30 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Aug 2020 07:58:51 +0000 (09:58 +0200)
commit0c5a62853895ceb51c7990a272ade1121ed2a632
tree7d2e2a557100fbc38517c111c8ae45fffa7fc213
parentec8409608c8da009fa2d45d7d30842de3f199777
riscv: Parse all memory blocks to remove unusable memory

[ Upstream commit fa5a198359053c8e21dcc2b39c0e13871059bc9f ]

Currently, maximum physical memory allowed is equal to -PAGE_OFFSET.
That's why we remove any memory blocks spanning beyond that size. However,
it is done only for memblock containing linux kernel which will not work
if there are multiple memblocks.

Process all memory blocks to figure out how much memory needs to be removed
and remove at the end instead of updating the memblock list in place.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/riscv/mm/init.c