@@ -24,27 +24,27 @@ pgd_t swapper_pg_dir[PTRS_PER_PGD] __aligned(PAGE_SIZE);
2424char empty_zero_page [PAGE_SIZE ] __aligned (PAGE_SIZE );
2525EXPORT_SYMBOL (empty_zero_page );
2626
27- /* Default tot mem from .config */
28- static unsigned long arc_mem_sz = 0x20000000 ; /* some default */
27+ static const unsigned long low_mem_start = CONFIG_LINUX_LINK_BASE ;
28+ static unsigned long low_mem_sz ;
2929
3030/* User can over-ride above with "mem=nnn[KkMm]" in cmdline */
3131static int __init setup_mem_sz (char * str )
3232{
33- arc_mem_sz = memparse (str , NULL ) & PAGE_MASK ;
33+ low_mem_sz = memparse (str , NULL ) & PAGE_MASK ;
3434
3535 /* 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 ));
3737
3838 return 0 ;
3939}
4040early_param ("mem" , setup_mem_sz );
4141
4242void __init early_init_dt_add_memory_arch (u64 base , u64 size )
4343{
44- arc_mem_sz = size & PAGE_MASK ;
45- pr_info ( "Memory size set via devicetree %ldM\n" , TO_MB ( arc_mem_sz ) );
44+ low_mem_sz = size ;
45+ BUG_ON ( base != low_mem_start );
4646
47- BUG_ON ( base != CONFIG_LINUX_LINK_BASE );
47+ pr_info ( "Memory @ %llx of %ldM\n" , base , TO_MB ( size ) );
4848}
4949
5050#ifdef CONFIG_BLK_DEV_INITRD
@@ -74,46 +74,34 @@ early_param("initrd", early_initrd);
7474void __init setup_arch_memory (void )
7575{
7676 unsigned long zones_size [MAX_NR_ZONES ];
77- unsigned long end_mem = CONFIG_LINUX_LINK_BASE + arc_mem_sz ;
7877
7978 init_mm .start_code = (unsigned long )_text ;
8079 init_mm .end_code = (unsigned long )_etext ;
8180 init_mm .end_data = (unsigned long )_edata ;
8281 init_mm .brk = (unsigned long )_end ;
8382
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-
9483 /* first page of system - kernel .vector starts here */
9584 min_low_pfn = ARCH_PFN_OFFSET ;
9685
97- /* Last usable page of low mem (no HIGHMEM yet for ARC port) */
98- max_low_pfn = max_pfn = PFN_DOWN (end_mem );
86+ /* Last usable page of low mem */
87+ max_low_pfn = max_pfn = PFN_DOWN (low_mem_start + low_mem_sz );
9988
10089 max_mapnr = max_low_pfn - min_low_pfn ;
10190
102- /*------------- reserve kernel image -----------------------*/
103- memblock_reserve ( CONFIG_LINUX_LINK_BASE ,
104- __pa (_end ) - CONFIG_LINUX_LINK_BASE );
91+ /*------------- bootmem allocator setup -----------------------*/
92+ memblock_add ( low_mem_start , low_mem_sz );
93+ memblock_reserve ( low_mem_start , __pa (_end ) - low_mem_start );
10594
10695#ifdef CONFIG_BLK_DEV_INITRD
107- /*------------- reserve initrd image -----------------------*/
10896 if (initrd_start )
10997 memblock_reserve (__pa (initrd_start ), initrd_end - initrd_start );
11098#endif
11199
112100 memblock_dump_all ();
113101
114- /*-------------- node setup ------ --------------------------*/
102+ /*----------------- node/zones setup --------------------------*/
115103 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 ;
117105
118106 /*
119107 * We can't use the helper free_area_init(zones[]) because it uses
0 commit comments