aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSantosh Shilimkar <santosh.shilimkar@ti.com>2013-06-30 00:28:46 -0400
committerSantosh Shilimkar <santosh.shilimkar@ti.com>2013-11-23 17:58:35 -0500
commit84f452b1e8fc73ac0e31254c66e3e2260ce5263d (patch)
tree8feffc74d51e6005e164f6e24befae3eec256378 /arch
parent8e58caefd96c8ee249ab26a2fe00aab3785df9ea (diff)
ARM: mm: Remove bootmem code and switch to NO_BOOTMEM
Now with dma_mask series merged and max*pfn has consistent meaning on ARM as rest of the arch's thanks to RMK's mega series, lets switch ARM code to NO_BOOTMEM. With NO_BOOTMEM change, now we use memblock allocator to reserve space for crash kernel to have one less dependency with nobootmem allocator wrapper. Tested with both flat memory and sparse (faked) memory models with highmem enabled. Cc: Russell King <linux@arm.linux.org.uk> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Nicolas Pitre <nicolas.pitre@linaro.org> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/kernel/setup.c2
-rw-r--r--arch/arm/mm/init.c58
3 files changed, 4 insertions, 57 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c1f1a7eee953..51411dbff402 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -62,6 +62,7 @@ config ARM
62 select IRQ_FORCED_THREADING 62 select IRQ_FORCED_THREADING
63 select KTIME_SCALAR 63 select KTIME_SCALAR
64 select MODULES_USE_ELF_REL 64 select MODULES_USE_ELF_REL
65 select NO_BOOTMEM
65 select OLD_SIGACTION 66 select OLD_SIGACTION
66 select OLD_SIGSUSPEND3 67 select OLD_SIGSUSPEND3
67 select PERF_USE_VMALLOC 68 select PERF_USE_VMALLOC
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 6a1b8a81b1ae..e9f629f21769 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -817,7 +817,7 @@ static void __init reserve_crashkernel(void)
817 if (ret) 817 if (ret)
818 return; 818 return;
819 819
820 ret = reserve_bootmem(crash_base, crash_size, BOOTMEM_EXCLUSIVE); 820 ret = memblock_reserve(crash_base, crash_size);
821 if (ret < 0) { 821 if (ret < 0) {
822 printk(KERN_WARNING "crashkernel reservation failed - " 822 printk(KERN_WARNING "crashkernel reservation failed - "
823 "memory is in use (0x%lx)\n", (unsigned long)crash_base); 823 "memory is in use (0x%lx)\n", (unsigned long)crash_base);
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index ea66341779d4..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
148static 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
202phys_addr_t arm_dma_zone_size __read_mostly; 150phys_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
239static void __init arm_bootmem_free(unsigned long min, unsigned long max_low, 187static 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];
@@ -396,8 +344,6 @@ void __init bootmem_init(void)
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