aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm/mmu.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mm/mmu.c')
-rw-r--r--arch/arm/mm/mmu.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 05dbb956175b..833a6c3f70c0 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -11,9 +11,9 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/bootmem.h>
15#include <linux/mman.h> 14#include <linux/mman.h>
16#include <linux/nodemask.h> 15#include <linux/nodemask.h>
16#include <linux/memblock.h>
17#include <linux/sort.h> 17#include <linux/sort.h>
18 18
19#include <asm/cputype.h> 19#include <asm/cputype.h>
@@ -489,7 +489,9 @@ static void __init build_mem_type_table(void)
489 489
490static void __init *early_alloc(unsigned long sz) 490static void __init *early_alloc(unsigned long sz)
491{ 491{
492 return alloc_bootmem_low_pages(sz); 492 void *ptr = __va(memblock_alloc(sz, sz));
493 memset(ptr, 0, sz);
494 return ptr;
493} 495}
494 496
495static pte_t * __init early_pte_alloc(pmd_t *pmd, unsigned long addr, unsigned long prot) 497static pte_t * __init early_pte_alloc(pmd_t *pmd, unsigned long addr, unsigned long prot)
@@ -705,10 +707,14 @@ static int __init early_vmalloc(char *arg)
705} 707}
706early_param("vmalloc", early_vmalloc); 708early_param("vmalloc", early_vmalloc);
707 709
710phys_addr_t lowmem_end_addr;
711
708static void __init sanity_check_meminfo(void) 712static void __init sanity_check_meminfo(void)
709{ 713{
710 int i, j, highmem = 0; 714 int i, j, highmem = 0;
711 715
716 lowmem_end_addr = __pa(vmalloc_min - 1) + 1;
717
712 for (i = 0, j = 0; i < meminfo.nr_banks; i++) { 718 for (i = 0, j = 0; i < meminfo.nr_banks; i++) {
713 struct membank *bank = &meminfo.bank[j]; 719 struct membank *bank = &meminfo.bank[j];
714 *bank = meminfo.bank[i]; 720 *bank = meminfo.bank[i];
@@ -834,34 +840,22 @@ static inline void prepare_page_table(void)
834} 840}
835 841
836/* 842/*
837 * Reserve the various regions 843 * Reserve the special regions of memory
838 */ 844 */
839void __init reserve_special_regions(void) 845void __init arm_mm_memblock_reserve(void)
840{ 846{
841 /* 847 /*
842 * Register the kernel text and data with bootmem.
843 * Note that this can only be in node 0.
844 */
845#ifdef CONFIG_XIP_KERNEL
846 reserve_bootmem(__pa(_data), _end - _data, BOOTMEM_DEFAULT);
847#else
848 reserve_bootmem(__pa(_stext), _end - _stext, BOOTMEM_DEFAULT);
849#endif
850
851 /*
852 * Reserve the page tables. These are already in use, 848 * Reserve the page tables. These are already in use,
853 * and can only be in node 0. 849 * and can only be in node 0.
854 */ 850 */
855 reserve_bootmem(__pa(swapper_pg_dir), 851 memblock_reserve(__pa(swapper_pg_dir), PTRS_PER_PGD * sizeof(pgd_t));
856 PTRS_PER_PGD * sizeof(pgd_t), BOOTMEM_DEFAULT);
857 852
858#ifdef CONFIG_SA1111 853#ifdef CONFIG_SA1111
859 /* 854 /*
860 * Because of the SA1111 DMA bug, we want to preserve our 855 * Because of the SA1111 DMA bug, we want to preserve our
861 * precious DMA-able memory... 856 * precious DMA-able memory...
862 */ 857 */
863 reserve_bootmem(PHYS_OFFSET, __pa(swapper_pg_dir) - PHYS_OFFSET, 858 memblock_reserve(PHYS_OFFSET, __pa(swapper_pg_dir) - PHYS_OFFSET);
864 BOOTMEM_DEFAULT);
865#endif 859#endif
866} 860}
867 861
@@ -1004,7 +998,6 @@ void __init paging_init(struct machine_desc *mdesc)
1004 sanity_check_meminfo(); 998 sanity_check_meminfo();
1005 prepare_page_table(); 999 prepare_page_table();
1006 map_lowmem(); 1000 map_lowmem();
1007 bootmem_init(mdesc);
1008 devicemaps_init(mdesc); 1001 devicemaps_init(mdesc);
1009 kmap_init(); 1002 kmap_init();
1010 1003
@@ -1012,6 +1005,9 @@ void __init paging_init(struct machine_desc *mdesc)
1012 1005
1013 /* allocate the zero page. */ 1006 /* allocate the zero page. */
1014 zero_page = early_alloc(PAGE_SIZE); 1007 zero_page = early_alloc(PAGE_SIZE);
1008
1009 bootmem_init(mdesc);
1010
1015 empty_zero_page = virt_to_page(zero_page); 1011 empty_zero_page = virt_to_page(zero_page);
1016 __flush_dcache_page(NULL, empty_zero_page); 1012 __flush_dcache_page(NULL, empty_zero_page);
1017} 1013}