#include <asm/cacheflush.h>
#include <asm/mce.h>
#include <asm/ds.h>
+#include <asm/topology.h>
#ifdef CONFIG_PARAVIRT
#include <asm/paravirt.h>
io_delay_init();
#ifdef CONFIG_SMP
- /* setup to use the static apicid table during kernel startup */
+ /* setup to use the early static init tables during kernel startup */
x86_cpu_to_apicid_early_ptr = (void *)&x86_cpu_to_apicid_init;
+ x86_cpu_to_node_map_early_ptr = (void *)&x86_cpu_to_node_map_init;
#endif
#ifdef CONFIG_ACPI
int cpu;
for_each_possible_cpu(cpu) {
- if (per_cpu_offset(cpu))
+ if (per_cpu_offset(cpu)) {
per_cpu(x86_cpu_to_apicid, cpu) =
x86_cpu_to_apicid_init[cpu];
+ per_cpu(x86_cpu_to_node_map, cpu) =
+ x86_cpu_to_node_map_init[cpu];
+ }
else
printk(KERN_NOTICE "per_cpu_offset zero for cpu %d\n",
cpu);
/* indicate the early static arrays are gone */
x86_cpu_to_apicid_early_ptr = NULL;
+ x86_cpu_to_node_map_early_ptr = NULL;
}
static void __init smp_cpu_index_default(void)
struct memnode memnode;
-u16 cpu_to_node_map[NR_CPUS] __read_mostly = {
+u16 x86_cpu_to_node_map_init[NR_CPUS] __initdata = {
[0 ... NR_CPUS-1] = NUMA_NO_NODE
};
-EXPORT_SYMBOL(cpu_to_node_map);
+void *x86_cpu_to_node_map_early_ptr;
+EXPORT_SYMBOL(x86_cpu_to_node_map_init);
+EXPORT_SYMBOL(x86_cpu_to_node_map_early_ptr);
+DEFINE_PER_CPU(u16, x86_cpu_to_node_map) = NUMA_NO_NODE;
+EXPORT_PER_CPU_SYMBOL(x86_cpu_to_node_map);
u16 apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata = {
[0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE
node_set(0, node_possible_map);
for (i = 0; i < NR_CPUS; i++)
numa_set_node(i, 0);
- /* we can't use cpumask_of_cpu() yet */
+ /* cpumask_of_cpu() may not be available during early startup */
memset(&node_to_cpumask_map[0], 0, sizeof(node_to_cpumask_map[0]));
cpu_set(0, node_to_cpumask_map[0]);
e820_register_active_regions(0, start_pfn, end_pfn);
void __cpuinit numa_set_node(int cpu, int node)
{
+ u16 *cpu_to_node_map = (u16 *)x86_cpu_to_node_map_early_ptr;
+
cpu_pda(cpu)->nodenumber = node;
- cpu_to_node_map[cpu] = node;
+
+ if(cpu_to_node_map)
+ cpu_to_node_map[cpu] = node;
+ else if(per_cpu_offset(cpu))
+ per_cpu(x86_cpu_to_node_map, cpu) = node;
+ else
+ Dprintk(KERN_INFO "Setting node for non-present cpu %d\n", cpu);
}
unsigned long __init numa_free_all_bootmem(void)
#define clear_node_cpumask(cpu) do {} while (0)
#endif
-#define NUMA_NO_NODE 0xffff
-
#endif
#include <asm/mpspec.h>
/* Mappings between logical cpu number and node number */
-extern u16 cpu_to_node_map[];
+DECLARE_PER_CPU(u16, x86_cpu_to_node_map);
+extern u16 __initdata x86_cpu_to_node_map_init[];
+extern void *x86_cpu_to_node_map_early_ptr;
extern cpumask_t node_to_cpumask_map[];
+#define NUMA_NO_NODE ((u16)(~0))
+
/* Returns the number of the node containing CPU 'cpu' */
static inline int cpu_to_node(int cpu)
{
- return cpu_to_node_map[cpu];
+ u16 *cpu_to_node_map = (u16 *)x86_cpu_to_node_map_early_ptr;
+
+ if (cpu_to_node_map)
+ return cpu_to_node_map[cpu];
+ else if (per_cpu_offset(cpu))
+ return per_cpu(x86_cpu_to_node_map, cpu);
+ else
+ return NUMA_NO_NODE;
}
/*
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/module.h>
+#include <linux/sched.h>
#include <linux/sunrpc/types.h>
#include <linux/sunrpc/xdr.h>