]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/kernel/genx2apic_cluster.c
x86: Add cpu_mask_to_apicid_and
[linux-2.6-omap-h63xx.git] / arch / x86 / kernel / genx2apic_cluster.c
index f5fa9a91ad3818fa7ace73537a4c7d61b2dfcb32..fd8047f4e4555fc4dd89a4c0b9859597408ceb7a 100644 (file)
@@ -123,6 +123,21 @@ static unsigned int x2apic_cpu_mask_to_apicid(const cpumask_t *cpumask)
                return BAD_APICID;
 }
 
+static unsigned int x2apic_cpu_mask_to_apicid_and(const cpumask_t *cpumask,
+                                                 const cpumask_t *andmask)
+{
+       int cpu;
+
+       /*
+        * We're using fixed IRQ delivery, can only return one phys APIC ID.
+        * May as well be the first.
+        */
+       while ((cpu = next_cpu(-1, *cpumask)) < nr_cpu_ids)
+               if (cpu_isset(cpu, *andmask))
+                       return per_cpu(x86_cpu_to_apicid, cpu);
+       return BAD_APICID;
+}
+
 static unsigned int get_apic_id(unsigned long x)
 {
        unsigned int id;
@@ -172,6 +187,7 @@ struct genapic apic_x2apic_cluster = {
        .send_IPI_mask_allbutself = x2apic_send_IPI_mask_allbutself,
        .send_IPI_self = x2apic_send_IPI_self,
        .cpu_mask_to_apicid = x2apic_cpu_mask_to_apicid,
+       .cpu_mask_to_apicid_and = x2apic_cpu_mask_to_apicid_and,
        .phys_pkg_id = phys_pkg_id,
        .get_apic_id = get_apic_id,
        .set_apic_id = set_apic_id,