Commit 6101be5a authored by Vineet Gupta's avatar Vineet Gupta

ARC: mm: preps ahead of HIGHMEM support #2

Explicit'ify that all memory added so far is low memory
Nothing semantical
Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
parent 336e2136
...@@ -24,16 +24,16 @@ pgd_t swapper_pg_dir[PTRS_PER_PGD] __aligned(PAGE_SIZE); ...@@ -24,16 +24,16 @@ pgd_t swapper_pg_dir[PTRS_PER_PGD] __aligned(PAGE_SIZE);
char empty_zero_page[PAGE_SIZE] __aligned(PAGE_SIZE); char empty_zero_page[PAGE_SIZE] __aligned(PAGE_SIZE);
EXPORT_SYMBOL(empty_zero_page); EXPORT_SYMBOL(empty_zero_page);
/* Default tot mem from .config */ static const unsigned long low_mem_start = CONFIG_LINUX_LINK_BASE;
static unsigned long arc_mem_sz = 0x20000000; /* some default */ static unsigned long low_mem_sz;
/* User can over-ride above with "mem=nnn[KkMm]" in cmdline */ /* User can over-ride above with "mem=nnn[KkMm]" in cmdline */
static int __init setup_mem_sz(char *str) static int __init setup_mem_sz(char *str)
{ {
arc_mem_sz = memparse(str, NULL) & PAGE_MASK; low_mem_sz = memparse(str, NULL) & PAGE_MASK;
/* early console might not be setup yet - it will show up later */ /* early console might not be setup yet - it will show up later */
pr_info("\"mem=%s\": mem sz set to %ldM\n", str, TO_MB(arc_mem_sz)); pr_info("\"mem=%s\": mem sz set to %ldM\n", str, TO_MB(low_mem_sz));
return 0; return 0;
} }
...@@ -41,10 +41,10 @@ early_param("mem", setup_mem_sz); ...@@ -41,10 +41,10 @@ early_param("mem", setup_mem_sz);
void __init early_init_dt_add_memory_arch(u64 base, u64 size) void __init early_init_dt_add_memory_arch(u64 base, u64 size)
{ {
arc_mem_sz = size & PAGE_MASK; low_mem_sz = size;
pr_info("Memory size set via devicetree %ldM\n", TO_MB(arc_mem_sz)); BUG_ON(base != low_mem_start);
BUG_ON(base != CONFIG_LINUX_LINK_BASE); pr_info("Memory @ %llx of %ldM\n", base, TO_MB(size));
} }
#ifdef CONFIG_BLK_DEV_INITRD #ifdef CONFIG_BLK_DEV_INITRD
...@@ -74,46 +74,34 @@ early_param("initrd", early_initrd); ...@@ -74,46 +74,34 @@ early_param("initrd", early_initrd);
void __init setup_arch_memory(void) void __init setup_arch_memory(void)
{ {
unsigned long zones_size[MAX_NR_ZONES]; unsigned long zones_size[MAX_NR_ZONES];
unsigned long end_mem = CONFIG_LINUX_LINK_BASE + arc_mem_sz;
init_mm.start_code = (unsigned long)_text; init_mm.start_code = (unsigned long)_text;
init_mm.end_code = (unsigned long)_etext; init_mm.end_code = (unsigned long)_etext;
init_mm.end_data = (unsigned long)_edata; init_mm.end_data = (unsigned long)_edata;
init_mm.brk = (unsigned long)_end; init_mm.brk = (unsigned long)_end;
/*
* We do it here, so that memory is correctly instantiated
* even if "mem=xxx" cmline over-ride is given and/or
* DT has memory node. Each causes an update to @arc_mem_sz
* and we finally add memory one here
*/
memblock_add(CONFIG_LINUX_LINK_BASE, arc_mem_sz);
/*------------- externs in mm need setting up ---------------*/
/* first page of system - kernel .vector starts here */ /* first page of system - kernel .vector starts here */
min_low_pfn = ARCH_PFN_OFFSET; min_low_pfn = ARCH_PFN_OFFSET;
/* Last usable page of low mem (no HIGHMEM yet for ARC port) */ /* Last usable page of low mem */
max_low_pfn = max_pfn = PFN_DOWN(end_mem); max_low_pfn = max_pfn = PFN_DOWN(low_mem_start + low_mem_sz);
max_mapnr = max_low_pfn - min_low_pfn; max_mapnr = max_low_pfn - min_low_pfn;
/*------------- reserve kernel image -----------------------*/ /*------------- bootmem allocator setup -----------------------*/
memblock_reserve(CONFIG_LINUX_LINK_BASE, memblock_add(low_mem_start, low_mem_sz);
__pa(_end) - CONFIG_LINUX_LINK_BASE); memblock_reserve(low_mem_start, __pa(_end) - low_mem_start);
#ifdef CONFIG_BLK_DEV_INITRD #ifdef CONFIG_BLK_DEV_INITRD
/*------------- reserve initrd image -----------------------*/
if (initrd_start) if (initrd_start)
memblock_reserve(__pa(initrd_start), initrd_end - initrd_start); memblock_reserve(__pa(initrd_start), initrd_end - initrd_start);
#endif #endif
memblock_dump_all(); memblock_dump_all();
/*-------------- node setup --------------------------------*/ /*----------------- node/zones setup --------------------------*/
memset(zones_size, 0, sizeof(zones_size)); memset(zones_size, 0, sizeof(zones_size));
zones_size[ZONE_NORMAL] = max_mapnr; zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn;
/* /*
* We can't use the helper free_area_init(zones[]) because it uses * We can't use the helper free_area_init(zones[]) because it uses
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment