alistair23-linux/arch/mips
James Hogan 58cae9b0f0 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>
2016-09-13 14:13:26 +02:00
..
alchemy
ar7
ath25
ath79 MIPS: ath79: Fix test for error return of clk_register_fixed_factor(). 2016-09-13 14:13:26 +02:00
bcm47xx
bcm63xx
bmips MIPS: store the appended dtb address in a variable 2016-08-02 14:00:16 +02:00
boot MIPS: tools: Fix relocs tool compiler warnings 2016-08-03 09:00:55 +02:00
cavium-octeon Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2016-08-06 09:13:11 -04:00
cobalt MIPS: Cobalt: Fix typo 2016-08-03 08:16:30 +02:00
configs Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2016-08-06 09:13:11 -04:00
dec
emma
fw
include treewide: replace config_enabled() with IS_ENABLED() (2nd round) 2016-08-26 17:39:35 -07:00
jazz
jz4740 tree-wide: replace config_enabled() with IS_ENABLED() 2016-08-04 08:50:07 -04:00
kernel MIPS: Fix memory regions reaching top of physical 2016-09-13 14:13:26 +02:00
kvm MIPS: KVM: Check for pfn noslot case 2016-08-19 17:22:26 +02:00
lantiq Merge branch '4.7-fixes' into mips-for-linux-next 2016-08-03 12:55:49 +02:00
lasat MIPS: Lasat: A couple off by one bugs in picvue_proc.c 2016-05-28 12:35:06 +02:00
lib MIPS: lib: Mark intrinsics notrace 2016-05-28 12:35:11 +02:00
loongson32
loongson64 Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2016-08-06 09:13:11 -04:00
math-emu Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2016-08-06 09:13:11 -04:00
mm Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2016-08-06 09:13:11 -04:00
mti-malta tree-wide: replace config_enabled() with IS_ENABLED() 2016-08-04 08:50:07 -04:00
mti-sead3 mips: Remove unnecessary of_platform_populate with default match table 2016-06-23 15:00:29 -05:00
net Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2016-08-06 09:13:11 -04:00
netlogic dma-mapping: use unsigned long for dma_attrs 2016-08-04 08:50:07 -04:00
oprofile MIPS/Loongson-3: Convert oprofile to hotplug state machine 2016-07-15 10:40:29 +02:00
paravirt
pci MIPS/PCI: Claim bus resources on PCI_PROBE_ONLY set-ups 2016-06-23 16:32:20 -05:00
pic32 Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2016-08-06 09:13:11 -04:00
pistachio Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2016-08-06 09:13:11 -04:00
pmcs-msp71xx
pnx833x
power
ralink Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2016-08-06 09:13:11 -04:00
rb532
sgi-ip22 rtc: ds1286: move header to linux/rtc 2016-07-08 16:23:11 +02:00
sgi-ip27 MIPS: Spelling fix lets -> let's 2016-05-28 12:35:09 +02:00
sgi-ip32
sibyte
sni char/genrtc: remove asm-generic/rtc.h from mips 2016-06-04 00:23:36 +02:00
txx9 treewide: replace obsolete _refok by __ref 2016-08-02 17:31:41 -04:00
vdso MIPS: Build microMIPS VDSO for microMIPS kernels 2016-05-28 12:35:12 +02:00
vr41xx MIPS: VR41xx: Fix typo 2016-05-28 12:35:09 +02:00
xilfpga mips: Remove unnecessary of_platform_populate with default match table 2016-06-23 15:00:29 -05:00
Kbuild
Kbuild.platforms
Kconfig Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2016-08-06 09:13:11 -04:00
Kconfig.debug
Makefile