diff options
author | Yinghai Lu <yinghai@kernel.org> | 2010-10-12 17:07:09 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2010-10-12 18:37:51 -0400 |
commit | c7fc2de0c83dbd2eaf759c5cd0e2b9cf1eb4df3a (patch) | |
tree | c4413e9b3bc164394c2daccf34e18e0b1d6c8811 /arch/arm/mm | |
parent | 8e4029ee3517084ae00fbfbcb51cc365d8857061 (diff) |
memblock, bootmem: Round pfn properly for memory and reserved regions
We need to round memory regions correctly -- specifically, we need to
round reserved region in the more expansive direction (lower limit
down, upper limit up) whereas usable memory regions need to be rounded
in the more restrictive direction (lower limit up, upper limit down).
This introduces two set of inlines:
memblock_region_memory_base_pfn()
memblock_region_memory_end_pfn()
memblock_region_reserved_base_pfn()
memblock_region_reserved_end_pfn()
Although they are antisymmetric (and therefore are technically
duplicates) the use of the different inlines explicitly documents the
programmer's intention.
The lack of proper rounding caused a bug on ARM, which was then found
to also affect other architectures.
Reported-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
LKML-Reference: <4CB4CDFD.4020105@kernel.org>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/arm/mm')
-rw-r--r-- | arch/arm/mm/init.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index d6022d1f51d1..63f441797c96 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -182,8 +182,8 @@ static void __init arm_bootmem_init(struct meminfo *mi, | |||
182 | * Reserve the memblock reserved regions in bootmem. | 182 | * Reserve the memblock reserved regions in bootmem. |
183 | */ | 183 | */ |
184 | for_each_memblock(reserved, reg) { | 184 | for_each_memblock(reserved, reg) { |
185 | phys_addr_t start = memblock_region_base_pfn(reg); | 185 | phys_addr_t start = memblock_region_reserved_base_pfn(reg); |
186 | phys_addr_t end = memblock_region_end_pfn(reg); | 186 | phys_addr_t end = memblock_region_reserved_end_pfn(reg); |
187 | if (start >= start_pfn && end <= end_pfn) | 187 | if (start >= start_pfn && end <= end_pfn) |
188 | reserve_bootmem_node(pgdat, __pfn_to_phys(start), | 188 | reserve_bootmem_node(pgdat, __pfn_to_phys(start), |
189 | (end - start) << PAGE_SHIFT, | 189 | (end - start) << PAGE_SHIFT, |
@@ -251,8 +251,8 @@ static void arm_memory_present(void) | |||
251 | struct memblock_region *reg; | 251 | struct memblock_region *reg; |
252 | 252 | ||
253 | for_each_memblock(memory, reg) | 253 | for_each_memblock(memory, reg) |
254 | memory_present(0, memblock_region_base_pfn(reg), | 254 | memory_present(0, memblock_region_memory_base_pfn(reg), |
255 | memblock_region_end_pfn(reg)); | 255 | memblock_region_memory_end_pfn(reg)); |
256 | } | 256 | } |
257 | #endif | 257 | #endif |
258 | 258 | ||