aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/genapic_flat_64.c
diff options
context:
space:
mode:
authorMike Travis <travis@sgi.com>2008-12-16 20:33:54 -0500
committerMike Travis <travis@sgi.com>2008-12-16 20:40:56 -0500
commit95d313cf1c1ecedc8bec5727b09bdacbf67dfc45 (patch)
treeee4aa8aff232bb30bb725c5670bb67d73484022d /arch/x86/kernel/genapic_flat_64.c
parenta1681965011916c2f1f0f1f87e70784f5d5d5be5 (diff)
x86: Add cpu_mask_to_apicid_and
Impact: new API Add a helper function that takes two cpumask's, and's them and then returns the apicid of the result. This removes a need in io_apic.c that uses a temporary cpumask to hold (mask & cfg->domain). Signed-off-by: Mike Travis <travis@sgi.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'arch/x86/kernel/genapic_flat_64.c')
-rw-r--r--arch/x86/kernel/genapic_flat_64.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/arch/x86/kernel/genapic_flat_64.c b/arch/x86/kernel/genapic_flat_64.c
index 50eebd0328fe..1efecd206a74 100644
--- a/arch/x86/kernel/genapic_flat_64.c
+++ b/arch/x86/kernel/genapic_flat_64.c
@@ -158,6 +158,15 @@ static unsigned int flat_cpu_mask_to_apicid(const cpumask_t *cpumask)
158 return cpus_addr(*cpumask)[0] & APIC_ALL_CPUS; 158 return cpus_addr(*cpumask)[0] & APIC_ALL_CPUS;
159} 159}
160 160
161static unsigned int flat_cpu_mask_to_apicid_and(const cpumask_t *cpumask,
162 const cpumask_t *andmask)
163{
164 unsigned long mask1 = cpus_addr(*cpumask)[0] & APIC_ALL_CPUS;
165 unsigned long mask2 = cpus_addr(*andmask)[0] & APIC_ALL_CPUS;
166
167 return (int)(mask1 & mask2);
168}
169
161static unsigned int phys_pkg_id(int index_msb) 170static unsigned int phys_pkg_id(int index_msb)
162{ 171{
163 return hard_smp_processor_id() >> index_msb; 172 return hard_smp_processor_id() >> index_msb;
@@ -178,6 +187,7 @@ struct genapic apic_flat = {
178 .send_IPI_mask_allbutself = flat_send_IPI_mask_allbutself, 187 .send_IPI_mask_allbutself = flat_send_IPI_mask_allbutself,
179 .send_IPI_self = apic_send_IPI_self, 188 .send_IPI_self = apic_send_IPI_self,
180 .cpu_mask_to_apicid = flat_cpu_mask_to_apicid, 189 .cpu_mask_to_apicid = flat_cpu_mask_to_apicid,
190 .cpu_mask_to_apicid_and = flat_cpu_mask_to_apicid_and,
181 .phys_pkg_id = phys_pkg_id, 191 .phys_pkg_id = phys_pkg_id,
182 .get_apic_id = get_apic_id, 192 .get_apic_id = get_apic_id,
183 .set_apic_id = set_apic_id, 193 .set_apic_id = set_apic_id,
@@ -254,6 +264,21 @@ static unsigned int physflat_cpu_mask_to_apicid(const cpumask_t *cpumask)
254 return BAD_APICID; 264 return BAD_APICID;
255} 265}
256 266
267static unsigned int physflat_cpu_mask_to_apicid_and(const cpumask_t *cpumask,
268 const cpumask_t *andmask)
269{
270 int cpu;
271
272 /*
273 * We're using fixed IRQ delivery, can only return one phys APIC ID.
274 * May as well be the first.
275 */
276 while ((cpu = next_cpu(-1, *cpumask)) < nr_cpu_ids)
277 if (cpu_isset(cpu, *andmask))
278 return per_cpu(x86_cpu_to_apicid, cpu);
279 return BAD_APICID;
280}
281
257struct genapic apic_physflat = { 282struct genapic apic_physflat = {
258 .name = "physical flat", 283 .name = "physical flat",
259 .acpi_madt_oem_check = physflat_acpi_madt_oem_check, 284 .acpi_madt_oem_check = physflat_acpi_madt_oem_check,
@@ -269,6 +294,7 @@ struct genapic apic_physflat = {
269 .send_IPI_mask_allbutself = physflat_send_IPI_mask_allbutself, 294 .send_IPI_mask_allbutself = physflat_send_IPI_mask_allbutself,
270 .send_IPI_self = apic_send_IPI_self, 295 .send_IPI_self = apic_send_IPI_self,
271 .cpu_mask_to_apicid = physflat_cpu_mask_to_apicid, 296 .cpu_mask_to_apicid = physflat_cpu_mask_to_apicid,
297 .cpu_mask_to_apicid_and = physflat_cpu_mask_to_apicid_and,
272 .phys_pkg_id = phys_pkg_id, 298 .phys_pkg_id = phys_pkg_id,
273 .get_apic_id = get_apic_id, 299 .get_apic_id = get_apic_id,
274 .set_apic_id = set_apic_id, 300 .set_apic_id = set_apic_id,