Commit 77f73a2c authored by Will Deacon's avatar Will Deacon Committed by Catalin Marinas

ARM: LPAE: mark memory banks with start > ULONG_MAX as highmem

Memory banks living outside of the 32-bit physical address
space do not have a 1:1 pa <-> va mapping and therefore the
__va macro may wrap.

This patch ensures that such banks are marked as highmem so
that the Kernel doesn't try to split them up when it sees that
the wrapped virtual address overlaps the vmalloc space.
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Acked-by: default avatarNicolas Pitre <nico@linaro.org>
parent ae2de101
...@@ -799,6 +799,9 @@ void __init sanity_check_meminfo(void) ...@@ -799,6 +799,9 @@ void __init sanity_check_meminfo(void)
struct membank *bank = &meminfo.bank[j]; struct membank *bank = &meminfo.bank[j];
*bank = meminfo.bank[i]; *bank = meminfo.bank[i];
if (bank->start > ULONG_MAX)
highmem = 1;
#ifdef CONFIG_HIGHMEM #ifdef CONFIG_HIGHMEM
if (__va(bank->start) >= vmalloc_min || if (__va(bank->start) >= vmalloc_min ||
__va(bank->start) < (void *)PAGE_OFFSET) __va(bank->start) < (void *)PAGE_OFFSET)
...@@ -810,7 +813,7 @@ void __init sanity_check_meminfo(void) ...@@ -810,7 +813,7 @@ void __init sanity_check_meminfo(void)
* Split those memory banks which are partially overlapping * Split those memory banks which are partially overlapping
* the vmalloc area greatly simplifying things later. * the vmalloc area greatly simplifying things later.
*/ */
if (__va(bank->start) < vmalloc_min && if (!highmem && __va(bank->start) < vmalloc_min &&
bank->size > vmalloc_min - __va(bank->start)) { bank->size > vmalloc_min - __va(bank->start)) {
if (meminfo.nr_banks >= NR_BANKS) { if (meminfo.nr_banks >= NR_BANKS) {
printk(KERN_CRIT "NR_BANKS too low, " printk(KERN_CRIT "NR_BANKS too low, "
...@@ -830,6 +833,17 @@ void __init sanity_check_meminfo(void) ...@@ -830,6 +833,17 @@ void __init sanity_check_meminfo(void)
#else #else
bank->highmem = highmem; bank->highmem = highmem;
/*
* Highmem banks not allowed with !CONFIG_HIGHMEM.
*/
if (highmem) {
printk(KERN_NOTICE "Ignoring RAM at %.8llx-%.8llx "
"(!CONFIG_HIGHMEM).\n",
(unsigned long long)bank->start,
(unsigned long long)bank->start + bank->size - 1);
continue;
}
/* /*
* Check whether this memory bank would entirely overlap * Check whether this memory bank would entirely overlap
* the vmalloc area. * the vmalloc area.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment