diff options
Diffstat (limited to 'arch/x86/include/asm/topology.h')
-rw-r--r-- | arch/x86/include/asm/topology.h | 108 |
1 files changed, 35 insertions, 73 deletions
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h index 4e2f2e0aab27..e3f4198371a9 100644 --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h | |||
@@ -44,9 +44,6 @@ | |||
44 | 44 | ||
45 | #ifdef CONFIG_X86_32 | 45 | #ifdef CONFIG_X86_32 |
46 | 46 | ||
47 | /* Mappings between node number and cpus on that node. */ | ||
48 | extern cpumask_t node_to_cpumask_map[]; | ||
49 | |||
50 | /* Mappings between logical cpu number and node number */ | 47 | /* Mappings between logical cpu number and node number */ |
51 | extern int cpu_to_node_map[]; | 48 | extern int cpu_to_node_map[]; |
52 | 49 | ||
@@ -57,39 +54,18 @@ static inline int cpu_to_node(int cpu) | |||
57 | } | 54 | } |
58 | #define early_cpu_to_node(cpu) cpu_to_node(cpu) | 55 | #define early_cpu_to_node(cpu) cpu_to_node(cpu) |
59 | 56 | ||
60 | /* Returns a bitmask of CPUs on Node 'node'. | ||
61 | * | ||
62 | * Side note: this function creates the returned cpumask on the stack | ||
63 | * so with a high NR_CPUS count, excessive stack space is used. The | ||
64 | * cpumask_of_node function should be used whenever possible. | ||
65 | */ | ||
66 | static inline cpumask_t node_to_cpumask(int node) | ||
67 | { | ||
68 | return node_to_cpumask_map[node]; | ||
69 | } | ||
70 | |||
71 | /* Returns a bitmask of CPUs on Node 'node'. */ | ||
72 | static inline const struct cpumask *cpumask_of_node(int node) | ||
73 | { | ||
74 | return &node_to_cpumask_map[node]; | ||
75 | } | ||
76 | |||
77 | #else /* CONFIG_X86_64 */ | 57 | #else /* CONFIG_X86_64 */ |
78 | 58 | ||
79 | /* Mappings between node number and cpus on that node. */ | ||
80 | extern cpumask_t *node_to_cpumask_map; | ||
81 | |||
82 | /* Mappings between logical cpu number and node number */ | 59 | /* Mappings between logical cpu number and node number */ |
83 | DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map); | 60 | DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map); |
84 | 61 | ||
85 | /* Returns the number of the current Node. */ | 62 | /* Returns the number of the current Node. */ |
86 | #define numa_node_id() read_pda(nodenumber) | 63 | DECLARE_PER_CPU(int, node_number); |
64 | #define numa_node_id() percpu_read(node_number) | ||
87 | 65 | ||
88 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | 66 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS |
89 | extern int cpu_to_node(int cpu); | 67 | extern int cpu_to_node(int cpu); |
90 | extern int early_cpu_to_node(int cpu); | 68 | extern int early_cpu_to_node(int cpu); |
91 | extern const cpumask_t *cpumask_of_node(int node); | ||
92 | extern cpumask_t node_to_cpumask(int node); | ||
93 | 69 | ||
94 | #else /* !CONFIG_DEBUG_PER_CPU_MAPS */ | 70 | #else /* !CONFIG_DEBUG_PER_CPU_MAPS */ |
95 | 71 | ||
@@ -102,37 +78,27 @@ static inline int cpu_to_node(int cpu) | |||
102 | /* Same function but used if called before per_cpu areas are setup */ | 78 | /* Same function but used if called before per_cpu areas are setup */ |
103 | static inline int early_cpu_to_node(int cpu) | 79 | static inline int early_cpu_to_node(int cpu) |
104 | { | 80 | { |
105 | if (early_per_cpu_ptr(x86_cpu_to_node_map)) | 81 | return early_per_cpu(x86_cpu_to_node_map, cpu); |
106 | return early_per_cpu_ptr(x86_cpu_to_node_map)[cpu]; | ||
107 | |||
108 | return per_cpu(x86_cpu_to_node_map, cpu); | ||
109 | } | 82 | } |
110 | 83 | ||
111 | /* Returns a pointer to the cpumask of CPUs on Node 'node'. */ | 84 | #endif /* !CONFIG_DEBUG_PER_CPU_MAPS */ |
112 | static inline const cpumask_t *cpumask_of_node(int node) | 85 | |
113 | { | 86 | #endif /* CONFIG_X86_64 */ |
114 | return &node_to_cpumask_map[node]; | ||
115 | } | ||
116 | 87 | ||
117 | /* Returns a bitmask of CPUs on Node 'node'. */ | 88 | /* Mappings between node number and cpus on that node. */ |
118 | static inline cpumask_t node_to_cpumask(int node) | 89 | extern cpumask_var_t node_to_cpumask_map[MAX_NUMNODES]; |
90 | |||
91 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | ||
92 | extern const struct cpumask *cpumask_of_node(int node); | ||
93 | #else | ||
94 | /* Returns a pointer to the cpumask of CPUs on Node 'node'. */ | ||
95 | static inline const struct cpumask *cpumask_of_node(int node) | ||
119 | { | 96 | { |
120 | return node_to_cpumask_map[node]; | 97 | return node_to_cpumask_map[node]; |
121 | } | 98 | } |
99 | #endif | ||
122 | 100 | ||
123 | #endif /* !CONFIG_DEBUG_PER_CPU_MAPS */ | 101 | extern void setup_node_to_cpumask_map(void); |
124 | |||
125 | /* | ||
126 | * Replace default node_to_cpumask_ptr with optimized version | ||
127 | * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)" | ||
128 | */ | ||
129 | #define node_to_cpumask_ptr(v, node) \ | ||
130 | const cpumask_t *v = cpumask_of_node(node) | ||
131 | |||
132 | #define node_to_cpumask_ptr_next(v, node) \ | ||
133 | v = cpumask_of_node(node) | ||
134 | |||
135 | #endif /* CONFIG_X86_64 */ | ||
136 | 102 | ||
137 | /* | 103 | /* |
138 | * Returns the number of the node containing Node 'node'. This | 104 | * Returns the number of the node containing Node 'node'. This |
@@ -141,7 +107,6 @@ static inline cpumask_t node_to_cpumask(int node) | |||
141 | #define parent_node(node) (node) | 107 | #define parent_node(node) (node) |
142 | 108 | ||
143 | #define pcibus_to_node(bus) __pcibus_to_node(bus) | 109 | #define pcibus_to_node(bus) __pcibus_to_node(bus) |
144 | #define pcibus_to_cpumask(bus) __pcibus_to_cpumask(bus) | ||
145 | 110 | ||
146 | #ifdef CONFIG_X86_32 | 111 | #ifdef CONFIG_X86_32 |
147 | extern unsigned long node_start_pfn[]; | 112 | extern unsigned long node_start_pfn[]; |
@@ -192,32 +157,32 @@ extern int __node_distance(int, int); | |||
192 | 157 | ||
193 | #else /* !CONFIG_NUMA */ | 158 | #else /* !CONFIG_NUMA */ |
194 | 159 | ||
195 | #define numa_node_id() 0 | 160 | static inline int numa_node_id(void) |
196 | #define cpu_to_node(cpu) 0 | 161 | { |
197 | #define early_cpu_to_node(cpu) 0 | 162 | return 0; |
163 | } | ||
164 | |||
165 | static inline int cpu_to_node(int cpu) | ||
166 | { | ||
167 | return 0; | ||
168 | } | ||
198 | 169 | ||
199 | static inline const cpumask_t *cpumask_of_node(int node) | 170 | static inline int early_cpu_to_node(int cpu) |
200 | { | 171 | { |
201 | return &cpu_online_map; | 172 | return 0; |
202 | } | 173 | } |
203 | static inline cpumask_t node_to_cpumask(int node) | 174 | |
175 | static inline const struct cpumask *cpumask_of_node(int node) | ||
204 | { | 176 | { |
205 | return cpu_online_map; | 177 | return cpu_online_mask; |
206 | } | 178 | } |
207 | static inline int node_to_first_cpu(int node) | 179 | static inline int node_to_first_cpu(int node) |
208 | { | 180 | { |
209 | return first_cpu(cpu_online_map); | 181 | return cpumask_first(cpu_online_mask); |
210 | } | 182 | } |
211 | 183 | ||
212 | /* | 184 | static inline void setup_node_to_cpumask_map(void) { } |
213 | * Replace default node_to_cpumask_ptr with optimized version | ||
214 | * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)" | ||
215 | */ | ||
216 | #define node_to_cpumask_ptr(v, node) \ | ||
217 | const cpumask_t *v = cpumask_of_node(node) | ||
218 | 185 | ||
219 | #define node_to_cpumask_ptr_next(v, node) \ | ||
220 | v = cpumask_of_node(node) | ||
221 | #endif | 186 | #endif |
222 | 187 | ||
223 | #include <asm-generic/topology.h> | 188 | #include <asm-generic/topology.h> |
@@ -230,16 +195,13 @@ static inline int node_to_first_cpu(int node) | |||
230 | } | 195 | } |
231 | #endif | 196 | #endif |
232 | 197 | ||
233 | extern cpumask_t cpu_coregroup_map(int cpu); | ||
234 | extern const struct cpumask *cpu_coregroup_mask(int cpu); | 198 | extern const struct cpumask *cpu_coregroup_mask(int cpu); |
235 | 199 | ||
236 | #ifdef ENABLE_TOPO_DEFINES | 200 | #ifdef ENABLE_TOPO_DEFINES |
237 | #define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) | 201 | #define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) |
238 | #define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id) | 202 | #define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id) |
239 | #define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu)) | 203 | #define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu)) |
240 | #define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) | 204 | #define topology_thread_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu)) |
241 | #define topology_core_cpumask(cpu) (&per_cpu(cpu_core_map, cpu)) | ||
242 | #define topology_thread_cpumask(cpu) (&per_cpu(cpu_sibling_map, cpu)) | ||
243 | 205 | ||
244 | /* indicates that pointers to the topology cpumask_t maps are valid */ | 206 | /* indicates that pointers to the topology cpumask_t maps are valid */ |
245 | #define arch_provides_topology_pointers yes | 207 | #define arch_provides_topology_pointers yes |
@@ -253,7 +215,7 @@ struct pci_bus; | |||
253 | void set_pci_bus_resources_arch_default(struct pci_bus *b); | 215 | void set_pci_bus_resources_arch_default(struct pci_bus *b); |
254 | 216 | ||
255 | #ifdef CONFIG_SMP | 217 | #ifdef CONFIG_SMP |
256 | #define mc_capable() (cpus_weight(per_cpu(cpu_core_map, 0)) != nr_cpu_ids) | 218 | #define mc_capable() (cpumask_weight(cpu_core_mask(0)) != nr_cpu_ids) |
257 | #define smt_capable() (smp_num_siblings > 1) | 219 | #define smt_capable() (smp_num_siblings > 1) |
258 | #endif | 220 | #endif |
259 | 221 | ||