aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2015-10-28 09:18:17 -0400
committerVineet Gupta <vgupta@synopsys.com>2015-10-28 10:19:00 -0400
commit6101be5ad439806c70b54bdd083e7db9e3affb3d (patch)
tree4d950167134bbffa8a4cefebc97b3b5a4a48fec6
parent336e2136e1353db8e9e731c27381ee0735656a8a (diff)
ARC: mm: preps ahead of HIGHMEM support #2
Explicit'ify that all memory added so far is low memory Nothing semantical Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
-rw-r--r--arch/arc/mm/init.c40
1 files changed, 14 insertions, 26 deletions
diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
index 5121b9b16ba8..a726a229baf6 100644
--- a/arch/arc/mm/init.c
+++ b/arch/arc/mm/init.c
@@ -24,16 +24,16 @@ pgd_t swapper_pg_dir[PTRS_PER_PGD] __aligned(PAGE_SIZE);
24char empty_zero_page[PAGE_SIZE] __aligned(PAGE_SIZE); 24char empty_zero_page[PAGE_SIZE] __aligned(PAGE_SIZE);
25EXPORT_SYMBOL(empty_zero_page); 25EXPORT_SYMBOL(empty_zero_page);
26 26
27/* Default tot mem from .config */ 27static const unsigned long low_mem_start = CONFIG_LINUX_LINK_BASE;
28static unsigned long arc_mem_sz = 0x20000000; /* some default */ 28static unsigned long low_mem_sz;
29 29
30/* User can over-ride above with "mem=nnn[KkMm]" in cmdline */ 30/* User can over-ride above with "mem=nnn[KkMm]" in cmdline */
31static int __init setup_mem_sz(char *str) 31static int __init setup_mem_sz(char *str)
32{ 32{
33 arc_mem_sz = memparse(str, NULL) & PAGE_MASK; 33 low_mem_sz = memparse(str, NULL) & PAGE_MASK;
34 34
35 /* early console might not be setup yet - it will show up later */ 35 /* early console might not be setup yet - it will show up later */
36 pr_info("\"mem=%s\": mem sz set to %ldM\n", str, TO_MB(arc_mem_sz)); 36 pr_info("\"mem=%s\": mem sz set to %ldM\n", str, TO_MB(low_mem_sz));
37 37
38 return 0; 38 return 0;
39} 39}
@@ -41,10 +41,10 @@ early_param("mem", setup_mem_sz);
41 41
42void __init early_init_dt_add_memory_arch(u64 base, u64 size) 42void __init early_init_dt_add_memory_arch(u64 base, u64 size)
43{ 43{
44 arc_mem_sz = size & PAGE_MASK; 44 low_mem_sz = size;
45 pr_info("Memory size set via devicetree %ldM\n", TO_MB(arc_mem_sz)); 45 BUG_ON(base != low_mem_start);
46 46
47 BUG_ON(base != CONFIG_LINUX_LINK_BASE); 47 pr_info("Memory @ %llx of %ldM\n", base, TO_MB(size));
48} 48}
49 49
50#ifdef CONFIG_BLK_DEV_INITRD 50#ifdef CONFIG_BLK_DEV_INITRD
@@ -74,46 +74,34 @@ early_param("initrd", early_initrd);
74void __init setup_arch_memory(void) 74void __init setup_arch_memory(void)
75{ 75{
76 unsigned long zones_size[MAX_NR_ZONES]; 76 unsigned long zones_size[MAX_NR_ZONES];
77 unsigned long end_mem = CONFIG_LINUX_LINK_BASE + arc_mem_sz;
78 77
79 init_mm.start_code = (unsigned long)_text; 78 init_mm.start_code = (unsigned long)_text;
80 init_mm.end_code = (unsigned long)_etext; 79 init_mm.end_code = (unsigned long)_etext;
81 init_mm.end_data = (unsigned long)_edata; 80 init_mm.end_data = (unsigned long)_edata;
82 init_mm.brk = (unsigned long)_end; 81 init_mm.brk = (unsigned long)_end;
83 82
84 /*
85 * We do it here, so that memory is correctly instantiated
86 * even if "mem=xxx" cmline over-ride is given and/or
87 * DT has memory node. Each causes an update to @arc_mem_sz
88 * and we finally add memory one here
89 */
90 memblock_add(CONFIG_LINUX_LINK_BASE, arc_mem_sz);
91
92 /*------------- externs in mm need setting up ---------------*/
93
94 /* first page of system - kernel .vector starts here */ 83 /* first page of system - kernel .vector starts here */
95 min_low_pfn = ARCH_PFN_OFFSET; 84 min_low_pfn = ARCH_PFN_OFFSET;
96 85
97 /* Last usable page of low mem (no HIGHMEM yet for ARC port) */ 86 /* Last usable page of low mem */
98 max_low_pfn = max_pfn = PFN_DOWN(end_mem); 87 max_low_pfn = max_pfn = PFN_DOWN(low_mem_start + low_mem_sz);
99 88
100 max_mapnr = max_low_pfn - min_low_pfn; 89 max_mapnr = max_low_pfn - min_low_pfn;
101 90
102 /*------------- reserve kernel image -----------------------*/ 91 /*------------- bootmem allocator setup -----------------------*/
103 memblock_reserve(CONFIG_LINUX_LINK_BASE, 92 memblock_add(low_mem_start, low_mem_sz);
104 __pa(_end) - CONFIG_LINUX_LINK_BASE); 93 memblock_reserve(low_mem_start, __pa(_end) - low_mem_start);
105 94
106#ifdef CONFIG_BLK_DEV_INITRD 95#ifdef CONFIG_BLK_DEV_INITRD
107 /*------------- reserve initrd image -----------------------*/
108 if (initrd_start) 96 if (initrd_start)
109 memblock_reserve(__pa(initrd_start), initrd_end - initrd_start); 97 memblock_reserve(__pa(initrd_start), initrd_end - initrd_start);
110#endif 98#endif
111 99
112 memblock_dump_all(); 100 memblock_dump_all();
113 101
114 /*-------------- node setup --------------------------------*/ 102 /*----------------- node/zones setup --------------------------*/
115 memset(zones_size, 0, sizeof(zones_size)); 103 memset(zones_size, 0, sizeof(zones_size));
116 zones_size[ZONE_NORMAL] = max_mapnr; 104 zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn;
117 105
118 /* 106 /*
119 * We can't use the helper free_area_init(zones[]) because it uses 107 * We can't use the helper free_area_init(zones[]) because it uses