aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/genx2apic_phys.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/genx2apic_phys.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/genx2apic_phys.c')
-rw-r--r--arch/x86/kernel/genx2apic_phys.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/x86/kernel/genx2apic_phys.c b/arch/x86/kernel/genx2apic_phys.c
index 41c27b2f3d01..d5578bb8f165 100644
--- a/arch/x86/kernel/genx2apic_phys.c
+++ b/arch/x86/kernel/genx2apic_phys.c
@@ -122,6 +122,21 @@ static unsigned int x2apic_cpu_mask_to_apicid(const cpumask_t *cpumask)
122 return BAD_APICID; 122 return BAD_APICID;
123} 123}
124 124
125static unsigned int x2apic_cpu_mask_to_apicid_and(const cpumask_t *cpumask,
126 const cpumask_t *andmask)
127{
128 int cpu;
129
130 /*
131 * We're using fixed IRQ delivery, can only return one phys APIC ID.
132 * May as well be the first.
133 */
134 while ((cpu = next_cpu(-1, *cpumask)) < nr_cpu_ids)
135 if (cpu_isset(cpu, *andmask))
136 return per_cpu(x86_cpu_to_apicid, cpu);
137 return BAD_APICID;
138}
139
125static unsigned int get_apic_id(unsigned long x) 140static unsigned int get_apic_id(unsigned long x)
126{ 141{
127 unsigned int id; 142 unsigned int id;
@@ -168,6 +183,7 @@ struct genapic apic_x2apic_phys = {
168 .send_IPI_mask_allbutself = x2apic_send_IPI_mask_allbutself, 183 .send_IPI_mask_allbutself = x2apic_send_IPI_mask_allbutself,
169 .send_IPI_self = x2apic_send_IPI_self, 184 .send_IPI_self = x2apic_send_IPI_self,
170 .cpu_mask_to_apicid = x2apic_cpu_mask_to_apicid, 185 .cpu_mask_to_apicid = x2apic_cpu_mask_to_apicid,
186 .cpu_mask_to_apicid_and = x2apic_cpu_mask_to_apicid_and,
171 .phys_pkg_id = phys_pkg_id, 187 .phys_pkg_id = phys_pkg_id,
172 .get_apic_id = get_apic_id, 188 .get_apic_id = get_apic_id,
173 .set_apic_id = set_apic_id, 189 .set_apic_id = set_apic_id,