diff options
Diffstat (limited to 'arch/x86/include/asm/topology.h')
-rw-r--r-- | arch/x86/include/asm/topology.h | 87 |
1 files changed, 17 insertions, 70 deletions
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h index 744299c0b774..892b119dba6f 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,30 +54,8 @@ 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 | static inline void setup_node_to_cpumask_map(void) { } | ||
78 | |||
79 | #else /* CONFIG_X86_64 */ | 57 | #else /* CONFIG_X86_64 */ |
80 | 58 | ||
81 | /* Mappings between node number and cpus on that node. */ | ||
82 | extern cpumask_t *node_to_cpumask_map; | ||
83 | |||
84 | /* Mappings between logical cpu number and node number */ | 59 | /* Mappings between logical cpu number and node number */ |
85 | DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map); | 60 | DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map); |
86 | 61 | ||
@@ -91,8 +66,6 @@ DECLARE_PER_CPU(int, node_number); | |||
91 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | 66 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS |
92 | extern int cpu_to_node(int cpu); | 67 | extern int cpu_to_node(int cpu); |
93 | extern int early_cpu_to_node(int cpu); | 68 | extern int early_cpu_to_node(int cpu); |
94 | extern const cpumask_t *cpumask_of_node(int node); | ||
95 | extern cpumask_t node_to_cpumask(int node); | ||
96 | 69 | ||
97 | #else /* !CONFIG_DEBUG_PER_CPU_MAPS */ | 70 | #else /* !CONFIG_DEBUG_PER_CPU_MAPS */ |
98 | 71 | ||
@@ -108,42 +81,32 @@ static inline int early_cpu_to_node(int cpu) | |||
108 | return early_per_cpu(x86_cpu_to_node_map, cpu); | 81 | return early_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 | } |
122 | 99 | #endif | |
123 | #endif /* !CONFIG_DEBUG_PER_CPU_MAPS */ | ||
124 | 100 | ||
125 | extern void setup_node_to_cpumask_map(void); | 101 | extern void setup_node_to_cpumask_map(void); |
126 | 102 | ||
127 | /* | 103 | /* |
128 | * Replace default node_to_cpumask_ptr with optimized version | ||
129 | * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)" | ||
130 | */ | ||
131 | #define node_to_cpumask_ptr(v, node) \ | ||
132 | const cpumask_t *v = cpumask_of_node(node) | ||
133 | |||
134 | #define node_to_cpumask_ptr_next(v, node) \ | ||
135 | v = cpumask_of_node(node) | ||
136 | |||
137 | #endif /* CONFIG_X86_64 */ | ||
138 | |||
139 | /* | ||
140 | * Returns the number of the node containing Node 'node'. This | 104 | * Returns the number of the node containing Node 'node'. This |
141 | * architecture is flat, so it is a pretty simple function! | 105 | * architecture is flat, so it is a pretty simple function! |
142 | */ | 106 | */ |
143 | #define parent_node(node) (node) | 107 | #define parent_node(node) (node) |
144 | 108 | ||
145 | #define pcibus_to_node(bus) __pcibus_to_node(bus) | 109 | #define pcibus_to_node(bus) __pcibus_to_node(bus) |
146 | #define pcibus_to_cpumask(bus) __pcibus_to_cpumask(bus) | ||
147 | 110 | ||
148 | #ifdef CONFIG_X86_32 | 111 | #ifdef CONFIG_X86_32 |
149 | extern unsigned long node_start_pfn[]; | 112 | extern unsigned long node_start_pfn[]; |
@@ -209,40 +172,24 @@ static inline int early_cpu_to_node(int cpu) | |||
209 | return 0; | 172 | return 0; |
210 | } | 173 | } |
211 | 174 | ||
212 | static inline const cpumask_t *cpumask_of_node(int node) | 175 | static inline const struct cpumask *cpumask_of_node(int node) |
213 | { | ||
214 | return &cpu_online_map; | ||
215 | } | ||
216 | static inline cpumask_t node_to_cpumask(int node) | ||
217 | { | 176 | { |
218 | return cpu_online_map; | 177 | return cpu_online_mask; |
219 | } | 178 | } |
220 | 179 | ||
221 | static inline void setup_node_to_cpumask_map(void) { } | 180 | static inline void setup_node_to_cpumask_map(void) { } |
222 | 181 | ||
223 | /* | ||
224 | * Replace default node_to_cpumask_ptr with optimized version | ||
225 | * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)" | ||
226 | */ | ||
227 | #define node_to_cpumask_ptr(v, node) \ | ||
228 | const cpumask_t *v = cpumask_of_node(node) | ||
229 | |||
230 | #define node_to_cpumask_ptr_next(v, node) \ | ||
231 | v = cpumask_of_node(node) | ||
232 | #endif | 182 | #endif |
233 | 183 | ||
234 | #include <asm-generic/topology.h> | 184 | #include <asm-generic/topology.h> |
235 | 185 | ||
236 | extern cpumask_t cpu_coregroup_map(int cpu); | ||
237 | extern const struct cpumask *cpu_coregroup_mask(int cpu); | 186 | extern const struct cpumask *cpu_coregroup_mask(int cpu); |
238 | 187 | ||
239 | #ifdef ENABLE_TOPO_DEFINES | 188 | #ifdef ENABLE_TOPO_DEFINES |
240 | #define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) | 189 | #define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) |
241 | #define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id) | 190 | #define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id) |
242 | #define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu)) | 191 | #define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu)) |
243 | #define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) | 192 | #define topology_thread_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu)) |
244 | #define topology_core_cpumask(cpu) (&per_cpu(cpu_core_map, cpu)) | ||
245 | #define topology_thread_cpumask(cpu) (&per_cpu(cpu_sibling_map, cpu)) | ||
246 | 193 | ||
247 | /* indicates that pointers to the topology cpumask_t maps are valid */ | 194 | /* indicates that pointers to the topology cpumask_t maps are valid */ |
248 | #define arch_provides_topology_pointers yes | 195 | #define arch_provides_topology_pointers yes |
@@ -256,7 +203,7 @@ struct pci_bus; | |||
256 | void set_pci_bus_resources_arch_default(struct pci_bus *b); | 203 | void set_pci_bus_resources_arch_default(struct pci_bus *b); |
257 | 204 | ||
258 | #ifdef CONFIG_SMP | 205 | #ifdef CONFIG_SMP |
259 | #define mc_capable() (cpus_weight(per_cpu(cpu_core_map, 0)) != nr_cpu_ids) | 206 | #define mc_capable() (cpumask_weight(cpu_core_mask(0)) != nr_cpu_ids) |
260 | #define smt_capable() (smp_num_siblings > 1) | 207 | #define smt_capable() (smp_num_siblings > 1) |
261 | #endif | 208 | #endif |
262 | 209 | ||