Commit a27d0b5e authored by Suresh Siddha's avatar Suresh Siddha Committed by Ingo Molnar

x86, x2apic: Remove duplicate code for IPI mask routines

Signed-off-by: default avatarSuresh Siddha <suresh.b.siddha@intel.com>
Acked-by: default avatarCyrill Gorcunov <gorcunov@openvz.org>
Cc: steiner@sgi.com
Cc: yinghai@kernel.org
Link: http://lkml.kernel.org/r/20110519234637.337024125@sbsiddha-MOBL3.sc.intel.comSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 9ebd680b
...@@ -54,64 +54,48 @@ static void ...@@ -54,64 +54,48 @@ static void
* at once. We have 16 cpu's in a cluster. This will minimize IPI register * at once. We have 16 cpu's in a cluster. This will minimize IPI register
* writes. * writes.
*/ */
static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector) static void
__x2apic_send_IPI_mask(const struct cpumask *mask, int vector, int apic_dest)
{ {
unsigned long query_cpu; unsigned long query_cpu;
unsigned long this_cpu;
unsigned long flags; unsigned long flags;
x2apic_wrmsr_fence(); x2apic_wrmsr_fence();
local_irq_save(flags); local_irq_save(flags);
this_cpu = smp_processor_id();
for_each_cpu(query_cpu, mask) { for_each_cpu(query_cpu, mask) {
if (apic_dest == APIC_DEST_ALLBUT && query_cpu == this_cpu)
continue;
__x2apic_send_IPI_dest( __x2apic_send_IPI_dest(
per_cpu(x86_cpu_to_logical_apicid, query_cpu), per_cpu(x86_cpu_to_logical_apicid, query_cpu),
vector, apic->dest_logical); vector, apic->dest_logical);
} }
local_irq_restore(flags); local_irq_restore(flags);
} }
static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector)
{
__x2apic_send_IPI_mask(mask, vector, APIC_DEST_ALLINC);
}
static void static void
x2apic_send_IPI_mask_allbutself(const struct cpumask *mask, int vector) x2apic_send_IPI_mask_allbutself(const struct cpumask *mask, int vector)
{ {
unsigned long this_cpu = smp_processor_id(); __x2apic_send_IPI_mask(mask, vector, APIC_DEST_ALLBUT);
unsigned long query_cpu;
unsigned long flags;
x2apic_wrmsr_fence();
local_irq_save(flags);
for_each_cpu(query_cpu, mask) {
if (query_cpu == this_cpu)
continue;
__x2apic_send_IPI_dest(
per_cpu(x86_cpu_to_logical_apicid, query_cpu),
vector, apic->dest_logical);
}
local_irq_restore(flags);
} }
static void x2apic_send_IPI_allbutself(int vector) static void x2apic_send_IPI_allbutself(int vector)
{ {
unsigned long this_cpu = smp_processor_id(); __x2apic_send_IPI_mask(cpu_online_mask, vector, APIC_DEST_ALLBUT);
unsigned long query_cpu;
unsigned long flags;
x2apic_wrmsr_fence();
local_irq_save(flags);
for_each_online_cpu(query_cpu) {
if (query_cpu == this_cpu)
continue;
__x2apic_send_IPI_dest(
per_cpu(x86_cpu_to_logical_apicid, query_cpu),
vector, apic->dest_logical);
}
local_irq_restore(flags);
} }
static void x2apic_send_IPI_all(int vector) static void x2apic_send_IPI_all(int vector)
{ {
x2apic_send_IPI_mask(cpu_online_mask, vector); __x2apic_send_IPI_mask(cpu_online_mask, vector, APIC_DEST_ALLINC);
} }
static int x2apic_apic_id_registered(void) static int x2apic_apic_id_registered(void)
......
...@@ -55,61 +55,46 @@ static void __x2apic_send_IPI_dest(unsigned int apicid, int vector, ...@@ -55,61 +55,46 @@ static void __x2apic_send_IPI_dest(unsigned int apicid, int vector,
native_x2apic_icr_write(cfg, apicid); native_x2apic_icr_write(cfg, apicid);
} }
static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector) static void
__x2apic_send_IPI_mask(const struct cpumask *mask, int vector, int apic_dest)
{ {
unsigned long query_cpu; unsigned long query_cpu;
unsigned long this_cpu;
unsigned long flags; unsigned long flags;
x2apic_wrmsr_fence(); x2apic_wrmsr_fence();
local_irq_save(flags); local_irq_save(flags);
this_cpu = smp_processor_id();
for_each_cpu(query_cpu, mask) { for_each_cpu(query_cpu, mask) {
if (apic_dest == APIC_DEST_ALLBUT && this_cpu == query_cpu)
continue;
__x2apic_send_IPI_dest(per_cpu(x86_cpu_to_apicid, query_cpu), __x2apic_send_IPI_dest(per_cpu(x86_cpu_to_apicid, query_cpu),
vector, APIC_DEST_PHYSICAL); vector, APIC_DEST_PHYSICAL);
} }
local_irq_restore(flags); local_irq_restore(flags);
} }
static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector)
{
__x2apic_send_IPI_mask(mask, vector, APIC_DEST_ALLINC);
}
static void static void
x2apic_send_IPI_mask_allbutself(const struct cpumask *mask, int vector) x2apic_send_IPI_mask_allbutself(const struct cpumask *mask, int vector)
{ {
unsigned long this_cpu = smp_processor_id(); __x2apic_send_IPI_mask(mask, vector, APIC_DEST_ALLBUT);
unsigned long query_cpu;
unsigned long flags;
x2apic_wrmsr_fence();
local_irq_save(flags);
for_each_cpu(query_cpu, mask) {
if (query_cpu != this_cpu)
__x2apic_send_IPI_dest(
per_cpu(x86_cpu_to_apicid, query_cpu),
vector, APIC_DEST_PHYSICAL);
}
local_irq_restore(flags);
} }
static void x2apic_send_IPI_allbutself(int vector) static void x2apic_send_IPI_allbutself(int vector)
{ {
unsigned long this_cpu = smp_processor_id(); __x2apic_send_IPI_mask(cpu_online_mask, vector, APIC_DEST_ALLBUT);
unsigned long query_cpu;
unsigned long flags;
x2apic_wrmsr_fence();
local_irq_save(flags);
for_each_online_cpu(query_cpu) {
if (query_cpu == this_cpu)
continue;
__x2apic_send_IPI_dest(per_cpu(x86_cpu_to_apicid, query_cpu),
vector, APIC_DEST_PHYSICAL);
}
local_irq_restore(flags);
} }
static void x2apic_send_IPI_all(int vector) static void x2apic_send_IPI_all(int vector)
{ {
x2apic_send_IPI_mask(cpu_online_mask, vector); __x2apic_send_IPI_mask(cpu_online_mask, vector, APIC_DEST_ALLINC);
} }
static int x2apic_apic_id_registered(void) static int x2apic_apic_id_registered(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment