Commit 9bd9be00 authored by Nicholas Piggin's avatar Nicholas Piggin Committed by Michael Ellerman

powerpc/mm/numa: move numa topology discovery earlier

Split sparsemem initialisation from basic numa topology discovery.
Move the parsing earlier in boot, before pacas are allocated.
Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent b575454f
...@@ -23,6 +23,7 @@ extern void reloc_got2(unsigned long); ...@@ -23,6 +23,7 @@ extern void reloc_got2(unsigned long);
#define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x))) #define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x)))
void check_for_initrd(void); void check_for_initrd(void);
void mem_topology_setup(void);
void initmem_init(void); void initmem_init(void);
void setup_panic(void); void setup_panic(void);
#define ARCH_PANIC_TIMEOUT 180 #define ARCH_PANIC_TIMEOUT 180
......
...@@ -888,6 +888,9 @@ void __init setup_arch(char **cmdline_p) ...@@ -888,6 +888,9 @@ void __init setup_arch(char **cmdline_p)
/* Check the SMT related command line arguments (ppc64). */ /* Check the SMT related command line arguments (ppc64). */
check_smt_enabled(); check_smt_enabled();
/* Parse memory topology */
mem_topology_setup();
/* On BookE, setup per-core TLB data structures. */ /* On BookE, setup per-core TLB data structures. */
setup_tlb_core_data(); setup_tlb_core_data();
......
...@@ -212,7 +212,7 @@ walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, ...@@ -212,7 +212,7 @@ walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
EXPORT_SYMBOL_GPL(walk_system_ram_range); EXPORT_SYMBOL_GPL(walk_system_ram_range);
#ifndef CONFIG_NEED_MULTIPLE_NODES #ifndef CONFIG_NEED_MULTIPLE_NODES
void __init initmem_init(void) void __init mem_topology_setup(void)
{ {
max_low_pfn = max_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT; max_low_pfn = max_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT;
min_low_pfn = MEMORY_START >> PAGE_SHIFT; min_low_pfn = MEMORY_START >> PAGE_SHIFT;
...@@ -224,7 +224,10 @@ void __init initmem_init(void) ...@@ -224,7 +224,10 @@ void __init initmem_init(void)
* memblock_regions * memblock_regions
*/ */
memblock_set_node(0, (phys_addr_t)ULLONG_MAX, &memblock.memory, 0); memblock_set_node(0, (phys_addr_t)ULLONG_MAX, &memblock.memory, 0);
}
void __init initmem_init(void)
{
/* XXX need to clip this if using highmem? */ /* XXX need to clip this if using highmem? */
sparse_memory_present_with_active_regions(0); sparse_memory_present_with_active_regions(0);
sparse_init(); sparse_init();
......
...@@ -836,18 +836,13 @@ static void __init find_possible_nodes(void) ...@@ -836,18 +836,13 @@ static void __init find_possible_nodes(void)
of_node_put(rtas); of_node_put(rtas);
} }
void __init initmem_init(void) void __init mem_topology_setup(void)
{ {
int nid, cpu; int cpu;
max_low_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT;
max_pfn = max_low_pfn;
if (parse_numa_properties()) if (parse_numa_properties())
setup_nonnuma(); setup_nonnuma();
memblock_dump_all();
/* /*
* Modify the set of possible NUMA nodes to reflect information * Modify the set of possible NUMA nodes to reflect information
* available about the set of online nodes, and the set of nodes * available about the set of online nodes, and the set of nodes
...@@ -858,6 +853,23 @@ void __init initmem_init(void) ...@@ -858,6 +853,23 @@ void __init initmem_init(void)
find_possible_nodes(); find_possible_nodes();
setup_node_to_cpumask_map();
reset_numa_cpu_lookup_table();
for_each_present_cpu(cpu)
numa_setup_cpu(cpu);
}
void __init initmem_init(void)
{
int nid;
max_low_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT;
max_pfn = max_low_pfn;
memblock_dump_all();
for_each_online_node(nid) { for_each_online_node(nid) {
unsigned long start_pfn, end_pfn; unsigned long start_pfn, end_pfn;
...@@ -868,10 +880,6 @@ void __init initmem_init(void) ...@@ -868,10 +880,6 @@ void __init initmem_init(void)
sparse_init(); sparse_init();
setup_node_to_cpumask_map();
reset_numa_cpu_lookup_table();
/* /*
* We need the numa_cpu_lookup_table to be accurate for all CPUs, * We need the numa_cpu_lookup_table to be accurate for all CPUs,
* even before we online them, so that we can use cpu_to_{node,mem} * even before we online them, so that we can use cpu_to_{node,mem}
...@@ -881,8 +889,6 @@ void __init initmem_init(void) ...@@ -881,8 +889,6 @@ void __init initmem_init(void)
*/ */
cpuhp_setup_state_nocalls(CPUHP_POWER_NUMA_PREPARE, "powerpc/numa:prepare", cpuhp_setup_state_nocalls(CPUHP_POWER_NUMA_PREPARE, "powerpc/numa:prepare",
ppc_numa_cpu_prepare, ppc_numa_cpu_dead); ppc_numa_cpu_prepare, ppc_numa_cpu_dead);
for_each_present_cpu(cpu)
numa_setup_cpu(cpu);
} }
static int __init early_numa(char *p) static int __init early_numa(char *p)
......
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