diff options
Diffstat (limited to 'arch/x86/include/asm/summit/apic.h')
-rw-r--r-- | arch/x86/include/asm/summit/apic.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/arch/x86/include/asm/summit/apic.h b/arch/x86/include/asm/summit/apic.h index 437dc83725ca..cbcc2c7eb1d5 100644 --- a/arch/x86/include/asm/summit/apic.h +++ b/arch/x86/include/asm/summit/apic.h | |||
@@ -170,6 +170,45 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask) | |||
170 | return apicid; | 170 | return apicid; |
171 | } | 171 | } |
172 | 172 | ||
173 | static inline unsigned int cpu_mask_to_apicid_and(const cpumask_t *cpumask, | ||
174 | const cpumask_t *andmask) | ||
175 | { | ||
176 | int num_bits_set; | ||
177 | int num_bits_set2; | ||
178 | int cpus_found = 0; | ||
179 | int cpu; | ||
180 | int apicid = 0; | ||
181 | |||
182 | num_bits_set = cpus_weight(*cpumask); | ||
183 | num_bits_set2 = cpus_weight(*andmask); | ||
184 | num_bits_set = min_t(int, num_bits_set, num_bits_set2); | ||
185 | /* Return id to all */ | ||
186 | if (num_bits_set >= nr_cpu_ids) | ||
187 | return 0xFF; | ||
188 | /* | ||
189 | * The cpus in the mask must all be on the apic cluster. If are not | ||
190 | * on the same apicid cluster return default value of TARGET_CPUS. | ||
191 | */ | ||
192 | while ((cpu = next_cpu(-1, *cpumask)) < nr_cpu_ids) | ||
193 | if (cpu_isset(cpu, *andmask) | ||
194 | apicid = cpu_to_logical_apicid(cpu); | ||
195 | while (cpus_found < num_bits_set) { | ||
196 | if (cpu_isset(cpu, *cpumask) && cpu_isset(cpu, *andmask)) { | ||
197 | int new_apicid = cpu_to_logical_apicid(cpu); | ||
198 | if (apicid_cluster(apicid) != | ||
199 | apicid_cluster(new_apicid)) { | ||
200 | printk(KERN_WARNING | ||
201 | "%s: Not a valid mask!\n", __func__); | ||
202 | return 0xFF; | ||
203 | } | ||
204 | apicid = apicid | new_apicid; | ||
205 | cpus_found++; | ||
206 | } | ||
207 | cpu++; | ||
208 | } | ||
209 | return apicid; | ||
210 | } | ||
211 | |||
173 | /* cpuid returns the value latched in the HW at reset, not the APIC ID | 212 | /* cpuid returns the value latched in the HW at reset, not the APIC ID |
174 | * register's value. For any box whose BIOS changes APIC IDs, like | 213 | * register's value. For any box whose BIOS changes APIC IDs, like |
175 | * clustered APIC systems, we must use hard_smp_processor_id. | 214 | * clustered APIC systems, we must use hard_smp_processor_id. |