x86/apic: Factor out default vector_allocation_domain() operation
authorAlexander Gordeev <agordeev@redhat.com>
Thu, 7 Jun 2012 13:14:49 +0000 (15:14 +0200)
committerIngo Molnar <mingo@kernel.org>
Fri, 8 Jun 2012 09:44:27 +0000 (11:44 +0200)
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Acked-by: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Link: http://lkml.kernel.org/r/20120607131449.GC4759@dhcp-26-207.brq.redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/include/asm/apic.h
arch/x86/kernel/apic/apic_flat_64.c
arch/x86/kernel/apic/apic_noop.c
arch/x86/kernel/apic/apic_numachip.c
arch/x86/kernel/apic/bigsmp_32.c
arch/x86/kernel/apic/es7000_32.c
arch/x86/kernel/apic/numaq_32.c
arch/x86/kernel/apic/probe_32.c
arch/x86/kernel/apic/summit_32.c
arch/x86/kernel/apic/x2apic_phys.c
arch/x86/kernel/apic/x2apic_uv_x.c

index bef571769e685e5f5c6352725f3fd60c4d21b585..feb2dbdae9ecebec051160415f415970f8e9ab9c 100644 (file)
@@ -615,6 +615,27 @@ extern unsigned int
 default_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
                               const struct cpumask *andmask);
 
+static inline void
+flat_vector_allocation_domain(int cpu, struct cpumask *retmask)
+{
+       /* Careful. Some cpus do not strictly honor the set of cpus
+        * specified in the interrupt destination when using lowest
+        * priority interrupt delivery mode.
+        *
+        * In particular there was a hyperthreading cpu observed to
+        * deliver interrupts to the wrong hyperthread when only one
+        * hyperthread was specified in the interrupt desitination.
+        */
+       cpumask_clear(retmask);
+       cpumask_bits(retmask)[0] = APIC_ALL_CPUS;
+}
+
+static inline void
+default_vector_allocation_domain(int cpu, struct cpumask *retmask)
+{
+       cpumask_copy(retmask, cpumask_of(cpu));
+}
+
 static inline unsigned long default_check_apicid_used(physid_mask_t *map, int apicid)
 {
        return physid_isset(apicid, *map);
index 55b97ce4fa19b569f97140bf0836798617f6a395..bddc92566d0a3e2770237087d183fe2820d29069 100644 (file)
@@ -36,20 +36,6 @@ static int flat_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
        return 1;
 }
 
-static void flat_vector_allocation_domain(int cpu, struct cpumask *retmask)
-{
-       /* Careful. Some cpus do not strictly honor the set of cpus
-        * specified in the interrupt destination when using lowest
-        * priority interrupt delivery mode.
-        *
-        * In particular there was a hyperthreading cpu observed to
-        * deliver interrupts to the wrong hyperthread when only one
-        * hyperthread was specified in the interrupt desitination.
-        */
-       cpumask_clear(retmask);
-       cpumask_bits(retmask)[0] = APIC_ALL_CPUS;
-}
-
 /*
  * Set up the logical destination ID.
  *
@@ -257,12 +243,6 @@ static int physflat_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
        return 0;
 }
 
-static void physflat_vector_allocation_domain(int cpu, struct cpumask *retmask)
-{
-       cpumask_clear(retmask);
-       cpumask_set_cpu(cpu, retmask);
-}
-
 static void physflat_send_IPI_mask(const struct cpumask *cpumask, int vector)
 {
        default_send_IPI_mask_sequence_phys(cpumask, vector);
@@ -309,7 +289,7 @@ static struct apic apic_physflat =  {
        .check_apicid_used              = NULL,
        .check_apicid_present           = NULL,
 
-       .vector_allocation_domain       = physflat_vector_allocation_domain,
+       .vector_allocation_domain       = default_vector_allocation_domain,
        /* not needed, but shouldn't hurt: */
        .init_apic_ldr                  = flat_init_apic_ldr,
 
index 7c3dd4fe06862c140a11d4f2e16426bc367d6961..3e43cf52893920e880d30ce427cbe329aecf2d0a 100644 (file)
@@ -104,8 +104,7 @@ static void noop_vector_allocation_domain(int cpu, struct cpumask *retmask)
 {
        if (cpu != 0)
                pr_warning("APIC: Vector allocated for non-BSP cpu\n");
-       cpumask_clear(retmask);
-       cpumask_set_cpu(cpu, retmask);
+       cpumask_copy(retmask, cpumask_of(cpu));
 }
 
 static u32 noop_apic_read(u32 reg)
index dba4bf2ed56684652d596817172be7c8cea6b6ef..c028132ad358643cfc1bcb74a1a0017263faa5c7 100644 (file)
@@ -72,12 +72,6 @@ static int numachip_phys_pkg_id(int initial_apic_id, int index_msb)
        return initial_apic_id >> index_msb;
 }
 
-static void numachip_vector_allocation_domain(int cpu, struct cpumask *retmask)
-{
-       cpumask_clear(retmask);
-       cpumask_set_cpu(cpu, retmask);
-}
-
 static int __cpuinit numachip_wakeup_secondary(int phys_apicid, unsigned long start_rip)
 {
        union numachip_csr_g3_ext_irq_gen int_gen;
@@ -222,7 +216,7 @@ static struct apic apic_numachip __refconst = {
        .check_apicid_used              = NULL,
        .check_apicid_present           = NULL,
 
-       .vector_allocation_domain       = numachip_vector_allocation_domain,
+       .vector_allocation_domain       = default_vector_allocation_domain,
        .init_apic_ldr                  = flat_init_apic_ldr,
 
        .ioapic_phys_id_map             = NULL,
index 907aa3d112a62caba871213c31862017344d1c51..df342fe4d6aa579a2df4a14ff3d7a47a0bf25b63 100644 (file)
@@ -142,12 +142,6 @@ static const struct dmi_system_id bigsmp_dmi_table[] = {
        { } /* NULL entry stops DMI scanning */
 };
 
-static void bigsmp_vector_allocation_domain(int cpu, struct cpumask *retmask)
-{
-       cpumask_clear(retmask);
-       cpumask_set_cpu(cpu, retmask);
-}
-
 static int probe_bigsmp(void)
 {
        if (def_to_bigsmp)
@@ -176,7 +170,7 @@ static struct apic apic_bigsmp = {
        .check_apicid_used              = bigsmp_check_apicid_used,
        .check_apicid_present           = bigsmp_check_apicid_present,
 
-       .vector_allocation_domain       = bigsmp_vector_allocation_domain,
+       .vector_allocation_domain       = default_vector_allocation_domain,
        .init_apic_ldr                  = bigsmp_init_apic_ldr,
 
        .ioapic_phys_id_map             = bigsmp_ioapic_phys_id_map,
index db4ab1be3c79470045fc9ebe44a11315b2416309..3c42865757e22734bd2cd529b3a579fd7e25382f 100644 (file)
@@ -394,21 +394,6 @@ static void es7000_enable_apic_mode(void)
                WARN(1, "Command failed, status = %x\n", mip_status);
 }
 
-static void es7000_vector_allocation_domain(int cpu, struct cpumask *retmask)
-{
-       /* Careful. Some cpus do not strictly honor the set of cpus
-        * specified in the interrupt destination when using lowest
-        * priority interrupt delivery mode.
-        *
-        * In particular there was a hyperthreading cpu observed to
-        * deliver interrupts to the wrong hyperthread when only one
-        * hyperthread was specified in the interrupt desitination.
-        */
-       cpumask_clear(retmask);
-       cpumask_bits(retmask)[0] = APIC_ALL_CPUS;
-}
-
-
 static void es7000_wait_for_init_deassert(atomic_t *deassert)
 {
        while (!atomic_read(deassert))
@@ -638,7 +623,7 @@ static struct apic __refdata apic_es7000_cluster = {
        .check_apicid_used              = es7000_check_apicid_used,
        .check_apicid_present           = es7000_check_apicid_present,
 
-       .vector_allocation_domain       = es7000_vector_allocation_domain,
+       .vector_allocation_domain       = flat_vector_allocation_domain,
        .init_apic_ldr                  = es7000_init_apic_ldr_cluster,
 
        .ioapic_phys_id_map             = es7000_ioapic_phys_id_map,
@@ -705,7 +690,7 @@ static struct apic __refdata apic_es7000 = {
        .check_apicid_used              = es7000_check_apicid_used,
        .check_apicid_present           = es7000_check_apicid_present,
 
-       .vector_allocation_domain       = es7000_vector_allocation_domain,
+       .vector_allocation_domain       = flat_vector_allocation_domain,
        .init_apic_ldr                  = es7000_init_apic_ldr,
 
        .ioapic_phys_id_map             = es7000_ioapic_phys_id_map,
index f00a68cca37a9bbd9ebc613b78fd4519e632cb4b..eb2d466fd81a152528deb866c2a84c4fd47d0575 100644 (file)
@@ -441,20 +441,6 @@ static int probe_numaq(void)
        return found_numaq;
 }
 
-static void numaq_vector_allocation_domain(int cpu, struct cpumask *retmask)
-{
-       /* Careful. Some cpus do not strictly honor the set of cpus
-        * specified in the interrupt destination when using lowest
-        * priority interrupt delivery mode.
-        *
-        * In particular there was a hyperthreading cpu observed to
-        * deliver interrupts to the wrong hyperthread when only one
-        * hyperthread was specified in the interrupt desitination.
-        */
-       cpumask_clear(retmask);
-       cpumask_bits(retmask)[0] = APIC_ALL_CPUS;
-}
-
 static void numaq_setup_portio_remap(void)
 {
        int num_quads = num_online_nodes();
@@ -491,7 +477,7 @@ static struct apic __refdata apic_numaq = {
        .check_apicid_used              = numaq_check_apicid_used,
        .check_apicid_present           = numaq_check_apicid_present,
 
-       .vector_allocation_domain       = numaq_vector_allocation_domain,
+       .vector_allocation_domain       = flat_vector_allocation_domain,
        .init_apic_ldr                  = numaq_init_apic_ldr,
 
        .ioapic_phys_id_map             = numaq_ioapic_phys_id_map,
index 71b6ac48ab263e7a607aa1625cfb5ef86a373829..2c6f003b2e4b27fcecf1798e52910436a5300e0e 100644 (file)
@@ -66,21 +66,6 @@ static void setup_apic_flat_routing(void)
 #endif
 }
 
-static void default_vector_allocation_domain(int cpu, struct cpumask *retmask)
-{
-       /*
-        * Careful. Some cpus do not strictly honor the set of cpus
-        * specified in the interrupt destination when using lowest
-        * priority interrupt delivery mode.
-        *
-        * In particular there was a hyperthreading cpu observed to
-        * deliver interrupts to the wrong hyperthread when only one
-        * hyperthread was specified in the interrupt desitination.
-        */
-       cpumask_clear(retmask);
-       cpumask_bits(retmask)[0] = APIC_ALL_CPUS;
-}
-
 /* should be called last. */
 static int probe_default(void)
 {
@@ -105,7 +90,7 @@ static struct apic apic_default = {
        .check_apicid_used              = default_check_apicid_used,
        .check_apicid_present           = default_check_apicid_present,
 
-       .vector_allocation_domain       = default_vector_allocation_domain,
+       .vector_allocation_domain       = flat_vector_allocation_domain,
        .init_apic_ldr                  = default_init_apic_ldr,
 
        .ioapic_phys_id_map             = default_ioapic_phys_id_map,
index 659897c007553916d129a5da1462b9e733cd6eff..35d254c1fec2979fd8c80ffa86ffbeee0dc9be1a 100644 (file)
@@ -320,20 +320,6 @@ static int probe_summit(void)
        return 0;
 }
 
-static void summit_vector_allocation_domain(int cpu, struct cpumask *retmask)
-{
-       /* Careful. Some cpus do not strictly honor the set of cpus
-        * specified in the interrupt destination when using lowest
-        * priority interrupt delivery mode.
-        *
-        * In particular there was a hyperthreading cpu observed to
-        * deliver interrupts to the wrong hyperthread when only one
-        * hyperthread was specified in the interrupt desitination.
-        */
-       cpumask_clear(retmask);
-       cpumask_bits(retmask)[0] = APIC_ALL_CPUS;
-}
-
 #ifdef CONFIG_X86_SUMMIT_NUMA
 static struct rio_table_hdr *rio_table_hdr;
 static struct scal_detail   *scal_devs[MAX_NUMNODES];
@@ -509,7 +495,7 @@ static struct apic apic_summit = {
        .check_apicid_used              = summit_check_apicid_used,
        .check_apicid_present           = summit_check_apicid_present,
 
-       .vector_allocation_domain       = summit_vector_allocation_domain,
+       .vector_allocation_domain       = flat_vector_allocation_domain,
        .init_apic_ldr                  = summit_init_apic_ldr,
 
        .ioapic_phys_id_map             = summit_ioapic_phys_id_map,
index f730269edef269a7055ae2ce5a6182e6eda4315e..f109388a0e804d7f7433c0fb200b9b449b4cdc1d 100644 (file)
@@ -88,15 +88,6 @@ static int x2apic_phys_probe(void)
        return apic == &apic_x2apic_phys;
 }
 
-/*
- * Each logical cpu is in its own vector allocation domain.
- */
-static void x2apic_vector_allocation_domain(int cpu, struct cpumask *retmask)
-{
-       cpumask_clear(retmask);
-       cpumask_set_cpu(cpu, retmask);
-}
-
 static struct apic apic_x2apic_phys = {
 
        .name                           = "physical x2apic",
@@ -114,7 +105,7 @@ static struct apic apic_x2apic_phys = {
        .check_apicid_used              = NULL,
        .check_apicid_present           = NULL,
 
-       .vector_allocation_domain       = x2apic_vector_allocation_domain,
+       .vector_allocation_domain       = default_vector_allocation_domain,
        .init_apic_ldr                  = init_x2apic_ldr,
 
        .ioapic_phys_id_map             = NULL,
index 16efb92bfea504633a692345a8f2f9ec7a548778..df89a7d78748c10e927e02e38af6f89df314f408 100644 (file)
@@ -185,12 +185,6 @@ EXPORT_SYMBOL_GPL(uv_possible_blades);
 unsigned long sn_rtc_cycles_per_second;
 EXPORT_SYMBOL(sn_rtc_cycles_per_second);
 
-static void uv_vector_allocation_domain(int cpu, struct cpumask *retmask)
-{
-       cpumask_clear(retmask);
-       cpumask_set_cpu(cpu, retmask);
-}
-
 static int __cpuinit uv_wakeup_secondary(int phys_apicid, unsigned long start_rip)
 {
 #ifdef CONFIG_SMP
@@ -363,7 +357,7 @@ static struct apic __refdata apic_x2apic_uv_x = {
        .check_apicid_used              = NULL,
        .check_apicid_present           = NULL,
 
-       .vector_allocation_domain       = uv_vector_allocation_domain,
+       .vector_allocation_domain       = default_vector_allocation_domain,
        .init_apic_ldr                  = uv_init_apic_ldr,
 
        .ioapic_phys_id_map             = NULL,