aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm/init.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-23 21:34:03 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-23 21:34:03 -0500
commitf341535193c338b4ce4af8e32be51e6aae7f22a6 (patch)
treed054a10be84681b93ce53c348cde0d764e1e24a2 /arch/arm/mm/init.c
parent13c789a6b219aa23f917466c7e630566106b14c2 (diff)
parent857989a7fdd2f6de42272578b8aaa413ed6e63e4 (diff)
Merge branch 'for-linus' of git://ftp.arm.linux.org.uk/~rmk/linux-arm
Pull ARM updates from Russell King: "In this set, we have: - Refactoring of some of the old StrongARM-1100 GPIO code to make things simpler by Dmitry Eremin-Solenikov - Read-only and non-executable support for modules on ARM from Laura Abbot - Removal of unnecessary set_drvdata() calls in AMBA code - Some non-executable support for kernel lowmem mappings at the 1MB section granularity, and dumping of kernel page tables via debugfs - Some improvements for the timer/clock code on Footbridge platforms, and cleanup some of the LED code there - Fix fls/ffs() signatures to match x86 to prevent build warnings, particularly where these are used with min/max() macros - Avoid using the bootmem allocator on ARM (patches from Santosh Shilimkar) - Various asid/unaligned access updates from Will Deacon" * 'for-linus' of git://ftp.arm.linux.org.uk/~rmk/linux-arm: (51 commits) ARM: SMP implementations are not supposed to return from smp_ops.cpu_die() ARM: ignore memory below PHYS_OFFSET Fix select-induced Kconfig warning for ZBOOT_ROM ARM: fix ffs/fls implementations to match x86 ARM: 7935/1: sa1100: collie: add gpio-keys configuration ARM: 7932/1: bcm: Add DEBUG_LL console support ARM: 7929/1: Remove duplicate SCHED_HRTICK config option ARM: 7928/1: kconfig: select HAVE_EFFICIENT_UNALIGNED_ACCESS for CPUv6+ && MMU ARM: 7927/1: dcache: select DCACHE_WORD_ACCESS for big-endian CPUs ARM: 7926/1: mm: flesh out and fix the comments in the ASID allocator ARM: 7925/1: mm: keep track of last ASID allocation to improve bitmap searching ARM: 7924/1: mm: don't bother with reserved ttbr0 when running with LPAE ARM: PCI: add legacy IDE IRQ implementation ARM: footbridge: cleanup LEDs code ARM: pgd allocation: retry on failure ARM: footbridge: add one-shot mode for DC21285 timer ARM: footbridge: add sched_clock implementation ARM: 7922/1: l2x0: add Marvell Tauros3 support ARM: 7877/1: use built-in byte swap function ARM: 7921/1: mcpm: remove redundant dsb instructions prior to sev ...
Diffstat (limited to 'arch/arm/mm/init.c')
-rw-r--r--arch/arm/mm/init.c62
1 files changed, 4 insertions, 58 deletions
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 11eb8add7820..f57fb338cc8a 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -142,58 +142,6 @@ static void __init find_limits(unsigned long *min, unsigned long *max_low,
142 *max_high = bank_pfn_end(&mi->bank[mi->nr_banks - 1]); 142 *max_high = bank_pfn_end(&mi->bank[mi->nr_banks - 1]);
143} 143}
144 144
145static void __init arm_bootmem_init(unsigned long start_pfn,
146 unsigned long end_pfn)
147{
148 struct memblock_region *reg;
149 unsigned int boot_pages;
150 phys_addr_t bitmap;
151 pg_data_t *pgdat;
152
153 /*
154 * Allocate the bootmem bitmap page. This must be in a region
155 * of memory which has already been mapped.
156 */
157 boot_pages = bootmem_bootmap_pages(end_pfn - start_pfn);
158 bitmap = memblock_alloc_base(boot_pages << PAGE_SHIFT, L1_CACHE_BYTES,
159 __pfn_to_phys(end_pfn));
160
161 /*
162 * Initialise the bootmem allocator, handing the
163 * memory banks over to bootmem.
164 */
165 node_set_online(0);
166 pgdat = NODE_DATA(0);
167 init_bootmem_node(pgdat, __phys_to_pfn(bitmap), start_pfn, end_pfn);
168
169 /* Free the lowmem regions from memblock into bootmem. */
170 for_each_memblock(memory, reg) {
171 unsigned long start = memblock_region_memory_base_pfn(reg);
172 unsigned long end = memblock_region_memory_end_pfn(reg);
173
174 if (end >= end_pfn)
175 end = end_pfn;
176 if (start >= end)
177 break;
178
179 free_bootmem(__pfn_to_phys(start), (end - start) << PAGE_SHIFT);
180 }
181
182 /* Reserve the lowmem memblock reserved regions in bootmem. */
183 for_each_memblock(reserved, reg) {
184 unsigned long start = memblock_region_reserved_base_pfn(reg);
185 unsigned long end = memblock_region_reserved_end_pfn(reg);
186
187 if (end >= end_pfn)
188 end = end_pfn;
189 if (start >= end)
190 break;
191
192 reserve_bootmem(__pfn_to_phys(start),
193 (end - start) << PAGE_SHIFT, BOOTMEM_DEFAULT);
194 }
195}
196
197#ifdef CONFIG_ZONE_DMA 145#ifdef CONFIG_ZONE_DMA
198 146
199phys_addr_t arm_dma_zone_size __read_mostly; 147phys_addr_t arm_dma_zone_size __read_mostly;
@@ -233,7 +181,7 @@ void __init setup_dma_zone(const struct machine_desc *mdesc)
233#endif 181#endif
234} 182}
235 183
236static void __init arm_bootmem_free(unsigned long min, unsigned long max_low, 184static void __init zone_sizes_init(unsigned long min, unsigned long max_low,
237 unsigned long max_high) 185 unsigned long max_high)
238{ 186{
239 unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES]; 187 unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES];
@@ -381,7 +329,6 @@ void __init arm_memblock_init(struct meminfo *mi,
381 dma_contiguous_reserve(min(arm_dma_limit, arm_lowmem_limit)); 329 dma_contiguous_reserve(min(arm_dma_limit, arm_lowmem_limit));
382 330
383 arm_memblock_steal_permitted = false; 331 arm_memblock_steal_permitted = false;
384 memblock_allow_resize();
385 memblock_dump_all(); 332 memblock_dump_all();
386} 333}
387 334
@@ -389,12 +336,11 @@ void __init bootmem_init(void)
389{ 336{
390 unsigned long min, max_low, max_high; 337 unsigned long min, max_low, max_high;
391 338
339 memblock_allow_resize();
392 max_low = max_high = 0; 340 max_low = max_high = 0;
393 341
394 find_limits(&min, &max_low, &max_high); 342 find_limits(&min, &max_low, &max_high);
395 343
396 arm_bootmem_init(min, max_low);
397
398 /* 344 /*
399 * Sparsemem tries to allocate bootmem in memory_present(), 345 * Sparsemem tries to allocate bootmem in memory_present(),
400 * so must be done after the fixed reservations 346 * so must be done after the fixed reservations
@@ -411,7 +357,7 @@ void __init bootmem_init(void)
411 * the sparse mem_map arrays initialized by sparse_init() 357 * the sparse mem_map arrays initialized by sparse_init()
412 * for memmap_init_zone(), otherwise all PFNs are invalid. 358 * for memmap_init_zone(), otherwise all PFNs are invalid.
413 */ 359 */
414 arm_bootmem_free(min, max_low, max_high); 360 zone_sizes_init(min, max_low, max_high);
415 361
416 /* 362 /*
417 * This doesn't seem to be used by the Linux memory manager any 363 * This doesn't seem to be used by the Linux memory manager any
@@ -584,7 +530,7 @@ void __init mem_init(void)
584 extern u32 itcm_end; 530 extern u32 itcm_end;
585#endif 531#endif
586 532
587 max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map; 533 set_max_mapnr(pfn_to_page(max_pfn) - mem_map);
588 534
589 /* this will put all unused low memory onto the freelists */ 535 /* this will put all unused low memory onto the freelists */
590 free_unused_memmap(&meminfo); 536 free_unused_memmap(&meminfo);