diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-x86/topology.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/asm-x86/topology.h b/include/asm-x86/topology.h index 2da1464ecbef..040374f030cf 100644 --- a/include/asm-x86/topology.h +++ b/include/asm-x86/topology.h | |||
@@ -30,16 +30,30 @@ | |||
30 | #include <asm/mpspec.h> | 30 | #include <asm/mpspec.h> |
31 | 31 | ||
32 | /* Mappings between logical cpu number and node number */ | 32 | /* Mappings between logical cpu number and node number */ |
33 | #ifdef CONFIG_X86_32 | ||
34 | extern u8 cpu_to_node_map[]; | ||
35 | |||
36 | #else | ||
33 | DECLARE_PER_CPU(u16, x86_cpu_to_node_map); | 37 | DECLARE_PER_CPU(u16, x86_cpu_to_node_map); |
34 | extern u16 x86_cpu_to_node_map_init[]; | 38 | extern u16 x86_cpu_to_node_map_init[]; |
35 | extern void *x86_cpu_to_node_map_early_ptr; | 39 | extern void *x86_cpu_to_node_map_early_ptr; |
40 | #endif | ||
41 | |||
36 | extern cpumask_t node_to_cpumask_map[]; | 42 | extern cpumask_t node_to_cpumask_map[]; |
37 | 43 | ||
38 | #define NUMA_NO_NODE ((u16)(~0)) | 44 | #define NUMA_NO_NODE ((u16)(~0)) |
39 | 45 | ||
40 | /* Returns the number of the node containing CPU 'cpu' */ | 46 | /* Returns the number of the node containing CPU 'cpu' */ |
47 | #ifdef CONFIG_X86_32 | ||
48 | #define early_cpu_to_node(cpu) cpu_to_node(cpu) | ||
41 | static inline int cpu_to_node(int cpu) | 49 | static inline int cpu_to_node(int cpu) |
42 | { | 50 | { |
51 | return cpu_to_node_map[cpu]; | ||
52 | } | ||
53 | |||
54 | #else /* CONFIG_X86_64 */ | ||
55 | static inline int early_cpu_to_node(int cpu) | ||
56 | { | ||
43 | u16 *cpu_to_node_map = x86_cpu_to_node_map_early_ptr; | 57 | u16 *cpu_to_node_map = x86_cpu_to_node_map_early_ptr; |
44 | 58 | ||
45 | if (cpu_to_node_map) | 59 | if (cpu_to_node_map) |
@@ -50,6 +64,15 @@ static inline int cpu_to_node(int cpu) | |||
50 | return NUMA_NO_NODE; | 64 | return NUMA_NO_NODE; |
51 | } | 65 | } |
52 | 66 | ||
67 | static inline int cpu_to_node(int cpu) | ||
68 | { | ||
69 | if(per_cpu_offset(cpu)) | ||
70 | return per_cpu(x86_cpu_to_node_map, cpu); | ||
71 | else | ||
72 | return NUMA_NO_NODE; | ||
73 | } | ||
74 | #endif /* CONFIG_X86_64 */ | ||
75 | |||
53 | /* | 76 | /* |
54 | * Returns the number of the node containing Node 'node'. This | 77 | * Returns the number of the node containing Node 'node'. This |
55 | * architecture is flat, so it is a pretty simple function! | 78 | * architecture is flat, so it is a pretty simple function! |