@@ -158,35 +158,9 @@ static void __init node_mem_init(unsigned int node)
158158
159159#ifdef CONFIG_ACPI_NUMA
160160
161- /*
162- * add_numamem_region
163- *
164- * Add a uasable memory region described by BIOS. The
165- * routine gets each intersection between BIOS's region
166- * and node's region, and adds them into node's memblock
167- * pool.
168- *
169- */
170- static void __init add_numamem_region (u64 start , u64 end , u32 type )
171- {
172- u32 node = pa_to_nid (start );
173- u64 size = end - start ;
174- static unsigned long num_physpages ;
175-
176- if (start >= end ) {
177- pr_debug ("Invalid region: %016llx-%016llx\n" , start , end );
178- return ;
179- }
161+ static unsigned long num_physpages ;
180162
181- num_physpages += (size >> PAGE_SHIFT );
182- pr_info ("Node%d: mem_type:%d, mem_start:0x%llx, mem_size:0x%llx Bytes\n" ,
183- node , type , start , size );
184- pr_info (" start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n" ,
185- start >> PAGE_SHIFT , end >> PAGE_SHIFT , num_physpages );
186- memblock_set_node (start , size , & memblock .memory , node );
187- }
188-
189- static void __init init_node_memblock (void )
163+ static void __init info_node_memblock (void )
190164{
191165 u32 mem_type ;
192166 u64 mem_end , mem_start , mem_size ;
@@ -206,12 +180,20 @@ static void __init init_node_memblock(void)
206180 case EFI_BOOT_SERVICES_DATA :
207181 case EFI_PERSISTENT_MEMORY :
208182 case EFI_CONVENTIONAL_MEMORY :
209- add_numamem_region (mem_start , mem_end , mem_type );
183+ num_physpages += (mem_size >> PAGE_SHIFT );
184+ pr_info ("Node%d: mem_type:%d, mem_start:0x%llx, mem_size:0x%llx Bytes\n" ,
185+ (u32 )pa_to_nid (mem_start ), mem_type , mem_start , mem_size );
186+ pr_info (" start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n" ,
187+ mem_start >> PAGE_SHIFT , mem_end >> PAGE_SHIFT , num_physpages );
210188 break ;
211189 case EFI_PAL_CODE :
212190 case EFI_UNUSABLE_MEMORY :
213191 case EFI_ACPI_RECLAIM_MEMORY :
214- add_numamem_region (mem_start , mem_end , mem_type );
192+ num_physpages += (mem_size >> PAGE_SHIFT );
193+ pr_info ("Node%d: mem_type:%d, mem_start:0x%llx, mem_size:0x%llx Bytes\n" ,
194+ (u32 )pa_to_nid (mem_start ), mem_type , mem_start , mem_size );
195+ pr_info (" start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n" ,
196+ mem_start >> PAGE_SHIFT , mem_end >> PAGE_SHIFT , num_physpages );
215197 fallthrough ;
216198 case EFI_RESERVED_TYPE :
217199 case EFI_RUNTIME_SERVICES_CODE :
@@ -249,22 +231,16 @@ int __init init_numa_memory(void)
249231 for (i = 0 ; i < NR_CPUS ; i ++ )
250232 set_cpuid_to_node (i , NUMA_NO_NODE );
251233
252- numa_reset_distance ();
253- nodes_clear (numa_nodes_parsed );
254- nodes_clear (node_possible_map );
255- nodes_clear (node_online_map );
256- WARN_ON (memblock_clear_hotplug (0 , PHYS_ADDR_MAX ));
257-
258234 /* Parse SRAT and SLIT if provided by firmware. */
259- ret = acpi_disabled ? fake_numa_init () : acpi_numa_init ();
235+ if (!acpi_disabled )
236+ ret = numa_memblks_init (acpi_numa_init , false);
237+ else
238+ ret = numa_memblks_init (fake_numa_init , false);
239+
260240 if (ret < 0 )
261241 return ret ;
262242
263- node_possible_map = numa_nodes_parsed ;
264- if (WARN_ON (nodes_empty (node_possible_map )))
265- return - EINVAL ;
266-
267- init_node_memblock ();
243+ info_node_memblock ();
268244 if (!memblock_validate_numa_coverage (SZ_1M ))
269245 return - EINVAL ;
270246
0 commit comments