summaryrefslogtreecommitdiffstats
path: root/include/asm-x86/topology.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-x86/topology.h')
-rw-r--r--include/asm-x86/topology.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/asm-x86/topology.h b/include/asm-x86/topology.h
index 2da1464..040374f 100644
--- a/include/asm-x86/topology.h
+++ b/include/asm-x86/topology.h
@@ -30,16 +30,30 @@
#include <asm/mpspec.h>
/* Mappings between logical cpu number and node number */
+#ifdef CONFIG_X86_32
+extern u8 cpu_to_node_map[];
+
+#else
DECLARE_PER_CPU(u16, x86_cpu_to_node_map);
extern u16 x86_cpu_to_node_map_init[];
extern void *x86_cpu_to_node_map_early_ptr;
+#endif
+
extern cpumask_t node_to_cpumask_map[];
#define NUMA_NO_NODE ((u16)(~0))
/* Returns the number of the node containing CPU 'cpu' */
+#ifdef CONFIG_X86_32
+#define early_cpu_to_node(cpu) cpu_to_node(cpu)
static inline int cpu_to_node(int cpu)
{
+ return cpu_to_node_map[cpu];
+}
+
+#else /* CONFIG_X86_64 */
+static inline int early_cpu_to_node(int cpu)
+{
u16 *cpu_to_node_map = x86_cpu_to_node_map_early_ptr;
if (cpu_to_node_map)
@@ -50,6 +64,15 @@ static inline int cpu_to_node(int cpu)
return NUMA_NO_NODE;
}
+static inline int cpu_to_node(int cpu)
+{
+ if(per_cpu_offset(cpu))
+ return per_cpu(x86_cpu_to_node_map, cpu);
+ else
+ return NUMA_NO_NODE;
+}
+#endif /* CONFIG_X86_64 */
+
/*
* Returns the number of the node containing Node 'node'. This
* architecture is flat, so it is a pretty simple function!
OpenPOWER on IntegriCloud