diff options
author | Anton Blanchard <anton@samba.org> | 2010-04-26 11:32:42 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-05-06 03:41:57 -0400 |
commit | 8729faaa5e87557876c02f1665d517e2b41299f1 (patch) | |
tree | a0ef963766246ecc3ca25d36b52d801d9469d2da /arch/powerpc/platforms/pseries/hotplug-cpu.c | |
parent | cc1ba8ea6dde3f049b2b365d8fdc13976aee25cb (diff) |
powerpc/cpumask: Convert hotplug-cpu code to new cpumask API
Convert hotplug-cpu code to new cpumask API.
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms/pseries/hotplug-cpu.c')
-rw-r--r-- | arch/powerpc/platforms/pseries/hotplug-cpu.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c index b0760d7701b4..235f363f732d 100644 --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c | |||
@@ -163,7 +163,7 @@ static int pseries_cpu_disable(void) | |||
163 | 163 | ||
164 | /*fix boot_cpuid here*/ | 164 | /*fix boot_cpuid here*/ |
165 | if (cpu == boot_cpuid) | 165 | if (cpu == boot_cpuid) |
166 | boot_cpuid = any_online_cpu(cpu_online_map); | 166 | boot_cpuid = cpumask_any(cpu_online_mask); |
167 | 167 | ||
168 | /* FIXME: abstract this to not be platform specific later on */ | 168 | /* FIXME: abstract this to not be platform specific later on */ |
169 | xics_migrate_irqs_away(); | 169 | xics_migrate_irqs_away(); |
@@ -231,7 +231,7 @@ static void pseries_cpu_die(unsigned int cpu) | |||
231 | static int pseries_add_processor(struct device_node *np) | 231 | static int pseries_add_processor(struct device_node *np) |
232 | { | 232 | { |
233 | unsigned int cpu; | 233 | unsigned int cpu; |
234 | cpumask_t candidate_map, tmp = CPU_MASK_NONE; | 234 | cpumask_var_t candidate_mask, tmp; |
235 | int err = -ENOSPC, len, nthreads, i; | 235 | int err = -ENOSPC, len, nthreads, i; |
236 | const u32 *intserv; | 236 | const u32 *intserv; |
237 | 237 | ||
@@ -239,48 +239,53 @@ static int pseries_add_processor(struct device_node *np) | |||
239 | if (!intserv) | 239 | if (!intserv) |
240 | return 0; | 240 | return 0; |
241 | 241 | ||
242 | zalloc_cpumask_var(&candidate_mask, GFP_KERNEL); | ||
243 | zalloc_cpumask_var(&tmp, GFP_KERNEL); | ||
244 | |||
242 | nthreads = len / sizeof(u32); | 245 | nthreads = len / sizeof(u32); |
243 | for (i = 0; i < nthreads; i++) | 246 | for (i = 0; i < nthreads; i++) |
244 | cpu_set(i, tmp); | 247 | cpumask_set_cpu(i, tmp); |
245 | 248 | ||
246 | cpu_maps_update_begin(); | 249 | cpu_maps_update_begin(); |
247 | 250 | ||
248 | BUG_ON(!cpus_subset(cpu_present_map, cpu_possible_map)); | 251 | BUG_ON(!cpumask_subset(cpu_present_mask, cpu_possible_mask)); |
249 | 252 | ||
250 | /* Get a bitmap of unoccupied slots. */ | 253 | /* Get a bitmap of unoccupied slots. */ |
251 | cpus_xor(candidate_map, cpu_possible_map, cpu_present_map); | 254 | cpumask_xor(candidate_mask, cpu_possible_mask, cpu_present_mask); |
252 | if (cpus_empty(candidate_map)) { | 255 | if (cpumask_empty(candidate_mask)) { |
253 | /* If we get here, it most likely means that NR_CPUS is | 256 | /* If we get here, it most likely means that NR_CPUS is |
254 | * less than the partition's max processors setting. | 257 | * less than the partition's max processors setting. |
255 | */ | 258 | */ |
256 | printk(KERN_ERR "Cannot add cpu %s; this system configuration" | 259 | printk(KERN_ERR "Cannot add cpu %s; this system configuration" |
257 | " supports %d logical cpus.\n", np->full_name, | 260 | " supports %d logical cpus.\n", np->full_name, |
258 | cpus_weight(cpu_possible_map)); | 261 | cpumask_weight(cpu_possible_mask)); |
259 | goto out_unlock; | 262 | goto out_unlock; |
260 | } | 263 | } |
261 | 264 | ||
262 | while (!cpus_empty(tmp)) | 265 | while (!cpumask_empty(tmp)) |
263 | if (cpus_subset(tmp, candidate_map)) | 266 | if (cpumask_subset(tmp, candidate_mask)) |
264 | /* Found a range where we can insert the new cpu(s) */ | 267 | /* Found a range where we can insert the new cpu(s) */ |
265 | break; | 268 | break; |
266 | else | 269 | else |
267 | cpus_shift_left(tmp, tmp, nthreads); | 270 | cpumask_shift_left(tmp, tmp, nthreads); |
268 | 271 | ||
269 | if (cpus_empty(tmp)) { | 272 | if (cpumask_empty(tmp)) { |
270 | printk(KERN_ERR "Unable to find space in cpu_present_map for" | 273 | printk(KERN_ERR "Unable to find space in cpu_present_map for" |
271 | " processor %s with %d thread(s)\n", np->name, | 274 | " processor %s with %d thread(s)\n", np->name, |
272 | nthreads); | 275 | nthreads); |
273 | goto out_unlock; | 276 | goto out_unlock; |
274 | } | 277 | } |
275 | 278 | ||
276 | for_each_cpu_mask(cpu, tmp) { | 279 | for_each_cpu(cpu, tmp) { |
277 | BUG_ON(cpu_isset(cpu, cpu_present_map)); | 280 | BUG_ON(cpumask_test_cpu(cpu, cpu_present_mask)); |
278 | set_cpu_present(cpu, true); | 281 | set_cpu_present(cpu, true); |
279 | set_hard_smp_processor_id(cpu, *intserv++); | 282 | set_hard_smp_processor_id(cpu, *intserv++); |
280 | } | 283 | } |
281 | err = 0; | 284 | err = 0; |
282 | out_unlock: | 285 | out_unlock: |
283 | cpu_maps_update_done(); | 286 | cpu_maps_update_done(); |
287 | free_cpumask_var(candidate_mask); | ||
288 | free_cpumask_var(tmp); | ||
284 | return err; | 289 | return err; |
285 | } | 290 | } |
286 | 291 | ||
@@ -311,7 +316,7 @@ static void pseries_remove_processor(struct device_node *np) | |||
311 | set_hard_smp_processor_id(cpu, -1); | 316 | set_hard_smp_processor_id(cpu, -1); |
312 | break; | 317 | break; |
313 | } | 318 | } |
314 | if (cpu == NR_CPUS) | 319 | if (cpu >= nr_cpu_ids) |
315 | printk(KERN_WARNING "Could not find cpu to remove " | 320 | printk(KERN_WARNING "Could not find cpu to remove " |
316 | "with physical id 0x%x\n", intserv[i]); | 321 | "with physical id 0x%x\n", intserv[i]); |
317 | } | 322 | } |