@@ -63,18 +63,25 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
63
63
64
64
low_mem_sz = size ;
65
65
in_use = 1 ;
66
+ memblock_add_node (base , size , 0 );
66
67
} else {
67
68
#ifdef CONFIG_HIGHMEM
68
69
high_mem_start = base ;
69
70
high_mem_sz = size ;
70
71
in_use = 1 ;
72
+ memblock_add_node (base , size , 1 );
71
73
#endif
72
74
}
73
75
74
76
pr_info ("Memory @ %llx [%lldM] %s\n" ,
75
77
base , TO_MB (size ), !in_use ? "Not used" :"" );
76
78
}
77
79
80
+ bool arch_has_descending_max_zone_pfns (void )
81
+ {
82
+ return !IS_ENABLED (CONFIG_ARC_HAS_PAE40 );
83
+ }
84
+
78
85
/*
79
86
* First memory setup routine called from setup_arch()
80
87
* 1. setup swapper's mm @init_mm
@@ -83,8 +90,7 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
83
90
*/
84
91
void __init setup_arch_memory (void )
85
92
{
86
- unsigned long zones_size [MAX_NR_ZONES ];
87
- unsigned long zones_holes [MAX_NR_ZONES ];
93
+ unsigned long max_zone_pfn [MAX_NR_ZONES ] = { 0 };
88
94
89
95
init_mm .start_code = (unsigned long )_text ;
90
96
init_mm .end_code = (unsigned long )_etext ;
@@ -115,7 +121,6 @@ void __init setup_arch_memory(void)
115
121
* the crash
116
122
*/
117
123
118
- memblock_add_node (low_mem_start , low_mem_sz , 0 );
119
124
memblock_reserve (CONFIG_LINUX_LINK_BASE ,
120
125
__pa (_end ) - CONFIG_LINUX_LINK_BASE );
121
126
@@ -133,22 +138,7 @@ void __init setup_arch_memory(void)
133
138
memblock_dump_all ();
134
139
135
140
/*----------------- node/zones setup --------------------------*/
136
- memset (zones_size , 0 , sizeof (zones_size ));
137
- memset (zones_holes , 0 , sizeof (zones_holes ));
138
-
139
- zones_size [ZONE_NORMAL ] = max_low_pfn - min_low_pfn ;
140
- zones_holes [ZONE_NORMAL ] = 0 ;
141
-
142
- /*
143
- * We can't use the helper free_area_init(zones[]) because it uses
144
- * PAGE_OFFSET to compute the @min_low_pfn which would be wrong
145
- * when our kernel doesn't start at PAGE_OFFSET, i.e.
146
- * PAGE_OFFSET != CONFIG_LINUX_RAM_BASE
147
- */
148
- free_area_init_node (0 , /* node-id */
149
- zones_size , /* num pages per zone */
150
- min_low_pfn , /* first pfn of node */
151
- zones_holes ); /* holes */
141
+ max_zone_pfn [ZONE_NORMAL ] = max_low_pfn ;
152
142
153
143
#ifdef CONFIG_HIGHMEM
154
144
/*
@@ -168,20 +158,13 @@ void __init setup_arch_memory(void)
168
158
min_high_pfn = PFN_DOWN (high_mem_start );
169
159
max_high_pfn = PFN_DOWN (high_mem_start + high_mem_sz );
170
160
171
- zones_size [ZONE_NORMAL ] = 0 ;
172
- zones_holes [ZONE_NORMAL ] = 0 ;
173
-
174
- zones_size [ZONE_HIGHMEM ] = max_high_pfn - min_high_pfn ;
175
- zones_holes [ZONE_HIGHMEM ] = 0 ;
176
-
177
- free_area_init_node (1 , /* node-id */
178
- zones_size , /* num pages per zone */
179
- min_high_pfn , /* first pfn of node */
180
- zones_holes ); /* holes */
161
+ max_zone_pfn [ZONE_HIGHMEM ] = max_high_pfn ;
181
162
182
163
high_memory = (void * )(min_high_pfn << PAGE_SHIFT );
183
164
kmap_init ();
184
165
#endif
166
+
167
+ free_area_init (max_zone_pfn );
185
168
}
186
169
187
170
/*
0 commit comments