Skip to content

Commit 77f73a2

Browse files
wildea01ctmarinas
authored andcommitted
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: Will Deacon <will.deacon@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Nicolas Pitre <nico@linaro.org>
1 parent ae2de10 commit 77f73a2

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

‎arch/arm/mm/mmu.c‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,9 @@ void __init sanity_check_meminfo(void)
799799
struct membank *bank = &meminfo.bank[j];
800800
*bank = meminfo.bank[i];
801801

802+
if (bank->start > ULONG_MAX)
803+
highmem = 1;
804+
802805
#ifdef CONFIG_HIGHMEM
803806
if (__va(bank->start) >= vmalloc_min ||
804807
__va(bank->start) < (void *)PAGE_OFFSET)
@@ -810,7 +813,7 @@ void __init sanity_check_meminfo(void)
810813
* Split those memory banks which are partially overlapping
811814
* the vmalloc area greatly simplifying things later.
812815
*/
813-
if (__va(bank->start) < vmalloc_min &&
816+
if (!highmem && __va(bank->start) < vmalloc_min &&
814817
bank->size > vmalloc_min - __va(bank->start)) {
815818
if (meminfo.nr_banks >= NR_BANKS) {
816819
printk(KERN_CRIT "NR_BANKS too low, "
@@ -830,6 +833,17 @@ void __init sanity_check_meminfo(void)
830833
#else
831834
bank->highmem = highmem;
832835

836+
/*
837+
* Highmem banks not allowed with !CONFIG_HIGHMEM.
838+
*/
839+
if (highmem) {
840+
printk(KERN_NOTICE "Ignoring RAM at %.8llx-%.8llx "
841+
"(!CONFIG_HIGHMEM).\n",
842+
(unsigned long long)bank->start,
843+
(unsigned long long)bank->start + bank->size - 1);
844+
continue;
845+
}
846+
833847
/*
834848
* Check whether this memory bank would entirely overlap
835849
* the vmalloc area.

0 commit comments

Comments
 (0)