aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2009-03-02 04:53:58 -0500
committerIngo Molnar <mingo@elte.hu>2009-03-02 05:20:34 -0500
commitfae176d6e03578fee7cfe948ff9ae81bf7ea0ef0 (patch)
treee60e0fd6fa7c61f451c78f0334e36f45977f3ae3 /arch
parent0edc0b324a37c4bf9e13f3194f2f45c677808792 (diff)
x86_32: apic/summit_32, fix cpu_mask_to_apicid
Perform same-cluster checking even for masks with all (nr_cpu_ids) bits set and report correct apicid on success instead. While at it, convert it to for_each_cpu and newer cpumask api. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/apic/summit_32.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/arch/x86/kernel/apic/summit_32.c b/arch/x86/kernel/apic/summit_32.c
index 0a1135c5a6d..beda620bee8 100644
--- a/arch/x86/kernel/apic/summit_32.c
+++ b/arch/x86/kernel/apic/summit_32.c
@@ -291,33 +291,21 @@ static int summit_check_phys_apicid_present(int boot_cpu_physical_apicid)
291 291
292static unsigned int summit_cpu_mask_to_apicid(const cpumask_t *cpumask) 292static unsigned int summit_cpu_mask_to_apicid(const cpumask_t *cpumask)
293{ 293{
294 int cpus_found = 0; 294 unsigned int round = 0;
295 int num_bits_set; 295 int cpu, apicid = 0;
296 int apicid;
297 int cpu;
298 296
299 num_bits_set = cpus_weight(*cpumask);
300 if (num_bits_set >= nr_cpu_ids)
301 return BAD_APICID;
302 /* 297 /*
303 * The cpus in the mask must all be on the apic cluster. 298 * The cpus in the mask must all be on the apic cluster.
304 */ 299 */
305 cpu = first_cpu(*cpumask); 300 for_each_cpu(cpu, cpumask) {
306 apicid = summit_cpu_to_logical_apicid(cpu); 301 int new_apicid = summit_cpu_to_logical_apicid(cpu);
307
308 while (cpus_found < num_bits_set) {
309 if (cpu_isset(cpu, *cpumask)) {
310 int new_apicid = summit_cpu_to_logical_apicid(cpu);
311 302
312 if (APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) { 303 if (round && APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) {
313 printk("%s: Not a valid mask!\n", __func__); 304 printk("%s: Not a valid mask!\n", __func__);
314 305 return BAD_APICID;
315 return BAD_APICID;
316 }
317 apicid = apicid | new_apicid;
318 cpus_found++;
319 } 306 }
320 cpu++; 307 apicid |= new_apicid;
308 round++;
321 } 309 }
322 return apicid; 310 return apicid;
323} 311}