diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2014-01-21 16:26:51 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2014-01-21 16:26:51 -0500 |
commit | 857989a7fdd2f6de42272578b8aaa413ed6e63e4 (patch) | |
tree | 21c941d63000fdaa0ea32d34087b53d41b5919f8 /arch/arm/mm/init.c | |
parent | 6f14d778c15fe08b6d98e759cf7e3893ed67b238 (diff) | |
parent | 7990ac9cb25d378b6311f3591f010e53a9967066 (diff) |
Merge branch 'devel-stable' into for-next
Diffstat (limited to 'arch/arm/mm/init.c')
-rw-r--r-- | arch/arm/mm/init.c | 62 |
1 files changed, 4 insertions, 58 deletions
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 3e8f106ee5fe..6dd66a999d9f 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -145,58 +145,6 @@ static void __init find_limits(unsigned long *min, unsigned long *max_low, | |||
145 | *max_high = bank_pfn_end(&mi->bank[mi->nr_banks - 1]); | 145 | *max_high = bank_pfn_end(&mi->bank[mi->nr_banks - 1]); |
146 | } | 146 | } |
147 | 147 | ||
148 | static void __init arm_bootmem_init(unsigned long start_pfn, | ||
149 | unsigned long end_pfn) | ||
150 | { | ||
151 | struct memblock_region *reg; | ||
152 | unsigned int boot_pages; | ||
153 | phys_addr_t bitmap; | ||
154 | pg_data_t *pgdat; | ||
155 | |||
156 | /* | ||
157 | * Allocate the bootmem bitmap page. This must be in a region | ||
158 | * of memory which has already been mapped. | ||
159 | */ | ||
160 | boot_pages = bootmem_bootmap_pages(end_pfn - start_pfn); | ||
161 | bitmap = memblock_alloc_base(boot_pages << PAGE_SHIFT, L1_CACHE_BYTES, | ||
162 | __pfn_to_phys(end_pfn)); | ||
163 | |||
164 | /* | ||
165 | * Initialise the bootmem allocator, handing the | ||
166 | * memory banks over to bootmem. | ||
167 | */ | ||
168 | node_set_online(0); | ||
169 | pgdat = NODE_DATA(0); | ||
170 | init_bootmem_node(pgdat, __phys_to_pfn(bitmap), start_pfn, end_pfn); | ||
171 | |||
172 | /* Free the lowmem regions from memblock into bootmem. */ | ||
173 | for_each_memblock(memory, reg) { | ||
174 | unsigned long start = memblock_region_memory_base_pfn(reg); | ||
175 | unsigned long end = memblock_region_memory_end_pfn(reg); | ||
176 | |||
177 | if (end >= end_pfn) | ||
178 | end = end_pfn; | ||
179 | if (start >= end) | ||
180 | break; | ||
181 | |||
182 | free_bootmem(__pfn_to_phys(start), (end - start) << PAGE_SHIFT); | ||
183 | } | ||
184 | |||
185 | /* Reserve the lowmem memblock reserved regions in bootmem. */ | ||
186 | for_each_memblock(reserved, reg) { | ||
187 | unsigned long start = memblock_region_reserved_base_pfn(reg); | ||
188 | unsigned long end = memblock_region_reserved_end_pfn(reg); | ||
189 | |||
190 | if (end >= end_pfn) | ||
191 | end = end_pfn; | ||
192 | if (start >= end) | ||
193 | break; | ||
194 | |||
195 | reserve_bootmem(__pfn_to_phys(start), | ||
196 | (end - start) << PAGE_SHIFT, BOOTMEM_DEFAULT); | ||
197 | } | ||
198 | } | ||
199 | |||
200 | #ifdef CONFIG_ZONE_DMA | 148 | #ifdef CONFIG_ZONE_DMA |
201 | 149 | ||
202 | phys_addr_t arm_dma_zone_size __read_mostly; | 150 | phys_addr_t arm_dma_zone_size __read_mostly; |
@@ -236,7 +184,7 @@ void __init setup_dma_zone(const struct machine_desc *mdesc) | |||
236 | #endif | 184 | #endif |
237 | } | 185 | } |
238 | 186 | ||
239 | static void __init arm_bootmem_free(unsigned long min, unsigned long max_low, | 187 | static void __init zone_sizes_init(unsigned long min, unsigned long max_low, |
240 | unsigned long max_high) | 188 | unsigned long max_high) |
241 | { | 189 | { |
242 | unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES]; | 190 | unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES]; |
@@ -384,7 +332,6 @@ void __init arm_memblock_init(struct meminfo *mi, | |||
384 | dma_contiguous_reserve(min(arm_dma_limit, arm_lowmem_limit)); | 332 | dma_contiguous_reserve(min(arm_dma_limit, arm_lowmem_limit)); |
385 | 333 | ||
386 | arm_memblock_steal_permitted = false; | 334 | arm_memblock_steal_permitted = false; |
387 | memblock_allow_resize(); | ||
388 | memblock_dump_all(); | 335 | memblock_dump_all(); |
389 | } | 336 | } |
390 | 337 | ||
@@ -392,12 +339,11 @@ void __init bootmem_init(void) | |||
392 | { | 339 | { |
393 | unsigned long min, max_low, max_high; | 340 | unsigned long min, max_low, max_high; |
394 | 341 | ||
342 | memblock_allow_resize(); | ||
395 | max_low = max_high = 0; | 343 | max_low = max_high = 0; |
396 | 344 | ||
397 | find_limits(&min, &max_low, &max_high); | 345 | find_limits(&min, &max_low, &max_high); |
398 | 346 | ||
399 | arm_bootmem_init(min, max_low); | ||
400 | |||
401 | /* | 347 | /* |
402 | * Sparsemem tries to allocate bootmem in memory_present(), | 348 | * Sparsemem tries to allocate bootmem in memory_present(), |
403 | * so must be done after the fixed reservations | 349 | * so must be done after the fixed reservations |
@@ -414,7 +360,7 @@ void __init bootmem_init(void) | |||
414 | * the sparse mem_map arrays initialized by sparse_init() | 360 | * the sparse mem_map arrays initialized by sparse_init() |
415 | * for memmap_init_zone(), otherwise all PFNs are invalid. | 361 | * for memmap_init_zone(), otherwise all PFNs are invalid. |
416 | */ | 362 | */ |
417 | arm_bootmem_free(min, max_low, max_high); | 363 | zone_sizes_init(min, max_low, max_high); |
418 | 364 | ||
419 | /* | 365 | /* |
420 | * This doesn't seem to be used by the Linux memory manager any | 366 | * This doesn't seem to be used by the Linux memory manager any |
@@ -587,7 +533,7 @@ void __init mem_init(void) | |||
587 | extern u32 itcm_end; | 533 | extern u32 itcm_end; |
588 | #endif | 534 | #endif |
589 | 535 | ||
590 | max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map; | 536 | set_max_mapnr(pfn_to_page(max_pfn) - mem_map); |
591 | 537 | ||
592 | /* this will put all unused low memory onto the freelists */ | 538 | /* this will put all unused low memory onto the freelists */ |
593 | free_unused_memmap(&meminfo); | 539 | free_unused_memmap(&meminfo); |