]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
ARM: 7067/1: mm: keep significant bits in pfn_valid
authorMark Rutland <mark.rutland@arm.com>
Tue, 30 Aug 2011 16:45:10 +0000 (17:45 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sun, 4 Sep 2011 09:50:03 +0000 (10:50 +0100)
When ARCH_HAS_HOLES_MEMORYMODEL is selected, pfn_valid calls
memblock_is_memory to test validity of a pfn:

> memblock_is_memory(pfn << PAGE_SHIFT);

On LPAE systems this cuts off the top bits, as the shift occurs before
the value is promoted to a phys_addr_t.

This patch replaces the shift with a call to __pfn_to_phys (which casts
pfn to phys_addr_t before shifting), preventing the loss of significant
bits.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mm/init.c

index 91bca355cd3105462bdb4c6756d094910ecd0c81..cc7e2d8be9aa6f55cd1f670c998e1c065acec75e 100644 (file)
@@ -298,7 +298,7 @@ static void __init arm_bootmem_free(unsigned long min, unsigned long max_low,
 #ifdef CONFIG_HAVE_ARCH_PFN_VALID
 int pfn_valid(unsigned long pfn)
 {
-       return memblock_is_memory(pfn << PAGE_SHIFT);
+       return memblock_is_memory(__pfn_to_phys(pfn));
 }
 EXPORT_SYMBOL(pfn_valid);
 #endif