MIPS: Fix memory regions reaching top of physical
authorJames Hogan <james.hogan@imgtec.com>
Tue, 9 Aug 2016 12:21:48 +0000 (13:21 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Tue, 16 Aug 2016 16:08:42 +0000 (18:08 +0200)
commit8bb9216dfca4ee56ec423f32285e7bfaf450652e
tree09a00ddb2145a7ed44b3c1962774cc4d0046b0e5
parent911773320d7589b9a3c8d5bed7590e7fe9686bd1
MIPS: Fix memory regions reaching top of physical

Memory regions added with add_memory_region() at the top of the physical
address space will have their end address overflow to 0. This causes
them to be rejected as invalid, and would cause various other issues
later on.

This causes issues on Malta and Boston platforms when wanting to use all
2GB of RAM on a 32-bit kernel, either via highmem (using physical
addresses 0x90000000..0xFFFFFFFF), or with the Malta Enhanced Virtual
Addressing (EVA) layout which exposes the whole 0x80000000..0xFFFFFFFF
physical address range to kernel mode at 0x00000000..0x7FFFFFFF.

Due to the abundance of these non-overflow assumptions and the fact that
memblock already avoids the arithmetic overflow by limiting the size of
new memory regions without the arch code knowing it (in particular
mem_init_free_highmem() will trigger a page dump due to nonzero mapcount
on the last page), it is simpler and safer to just limit the size of the
region in a similar way to memblock but at the arch level to allow most
of the RAM to be used without arithmetic overflows.

Therefore we detect this case specifically and reduce the size of the
region slightly to avoid the arithmetic overflows and cause the last
page to be ignored.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/13857/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/kernel/setup.c
This page took 0.024629 seconds and 5 git commands to generate.