ARM: only consider memblocks with NOMAP cleared for linear mapping
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 1 Oct 2015 15:58:11 +0000 (17:58 +0200)
committerard <ard.biesheuvel@linaro.org>
Sun, 13 Dec 2015 18:18:29 +0000 (19:18 +0100)
Take the new memblock attribute MEMBLOCK_NOMAP into account when
deciding whether a certain region is or should be covered by the
kernel direct mapping.

Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
arch/arm/mm/init.c
arch/arm/mm/mmu.c

index 8a63b4cdc0f27d0fa7cf69f0bb1ffa51b6289e39..16104b1e266126ae95f688e05012138cb8352fca 100644 (file)
@@ -191,7 +191,7 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max_low,
 #ifdef CONFIG_HAVE_ARCH_PFN_VALID
 int pfn_valid(unsigned long pfn)
 {
-       return memblock_is_memory(__pfn_to_phys(pfn));
+       return memblock_is_map_memory(__pfn_to_phys(pfn));
 }
 EXPORT_SYMBOL(pfn_valid);
 #endif
@@ -432,6 +432,9 @@ static void __init free_highpages(void)
                if (end <= max_low)
                        continue;
 
+               if (memblock_is_nomap(mem))
+                       continue;
+
                /* Truncate partial highmem entries */
                if (start < max_low)
                        start = max_low;
index 8c69830e791ac6da64874712224255a920aa74a6..c615d2eb92327cf14ea7ae90896cd4a05370cd30 100644 (file)
@@ -1435,6 +1435,9 @@ static void __init map_lowmem(void)
                phys_addr_t end = start + reg->size;
                struct map_desc map;
 
+               if (memblock_is_nomap(reg))
+                       continue;
+
                if (end > arm_lowmem_limit)
                        end = arm_lowmem_limit;
                if (start >= end)