diff options
| -rw-r--r-- | arch/x86/kernel/apic/es7000_32.c | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/arch/x86/kernel/apic/es7000_32.c b/arch/x86/kernel/apic/es7000_32.c index 9b9e86f3cfd9..4d8830ffe487 100644 --- a/arch/x86/kernel/apic/es7000_32.c +++ b/arch/x86/kernel/apic/es7000_32.c | |||
| @@ -577,32 +577,22 @@ static int es7000_check_phys_apicid_present(int cpu_physical_apicid) | |||
| 577 | 577 | ||
| 578 | static unsigned int es7000_cpu_mask_to_apicid(const cpumask_t *cpumask) | 578 | static unsigned int es7000_cpu_mask_to_apicid(const cpumask_t *cpumask) |
| 579 | { | 579 | { |
| 580 | unsigned int cpu, num_bits_set, cpus_found = 0; | 580 | unsigned int round = 0; |
| 581 | int apicid; | 581 | int cpu, uninitialized_var(apicid); |
| 582 | 582 | ||
| 583 | num_bits_set = cpumask_weight(cpumask); | ||
| 584 | /* Return id to all */ | ||
| 585 | if (num_bits_set == nr_cpu_ids) | ||
| 586 | return es7000_cpu_to_logical_apicid(0); | ||
| 587 | /* | 583 | /* |
| 588 | * The cpus in the mask must all be on the apic cluster. If are not | 584 | * The cpus in the mask must all be on the apic cluster. |
| 589 | * on the same apicid cluster return default value of target_cpus(): | ||
| 590 | */ | 585 | */ |
| 591 | cpu = cpumask_first(cpumask); | 586 | for_each_cpu(cpu, cpumask) { |
| 592 | apicid = es7000_cpu_to_logical_apicid(cpu); | 587 | int new_apicid = es7000_cpu_to_logical_apicid(cpu); |
| 593 | while (cpus_found < num_bits_set) { | ||
| 594 | if (cpumask_test_cpu(cpu, cpumask)) { | ||
| 595 | int new_apicid = es7000_cpu_to_logical_apicid(cpu); | ||
| 596 | 588 | ||
| 597 | if (APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) { | 589 | if (round && APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) { |
| 598 | WARN(1, "Not a valid mask!"); | 590 | WARN(1, "Not a valid mask!"); |
| 599 | 591 | ||
| 600 | return es7000_cpu_to_logical_apicid(0); | 592 | return BAD_APICID; |
| 601 | } | ||
| 602 | apicid = new_apicid; | ||
| 603 | cpus_found++; | ||
| 604 | } | 593 | } |
| 605 | cpu++; | 594 | apicid = new_apicid; |
| 595 | round++; | ||
| 606 | } | 596 | } |
| 607 | return apicid; | 597 | return apicid; |
| 608 | } | 598 | } |
