diff options
author | Suresh Siddha <suresh.b.siddha@intel.com> | 2011-05-19 19:45:47 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-05-20 07:41:06 -0400 |
commit | a27d0b5e7d913b38880678ac05690f1dc737c4fd (patch) | |
tree | 56957d475688c61171b505200b3144c213b77c6e /arch/x86/kernel/apic/x2apic_phys.c | |
parent | 9ebd680bd029a9fc47399ca61c950f8b6730ac40 (diff) |
x86, x2apic: Remove duplicate code for IPI mask routines
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: steiner@sgi.com
Cc: yinghai@kernel.org
Link: http://lkml.kernel.org/r/20110519234637.337024125@sbsiddha-MOBL3.sc.intel.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/apic/x2apic_phys.c')
-rw-r--r-- | arch/x86/kernel/apic/x2apic_phys.c | 45 |
1 files changed, 15 insertions, 30 deletions
diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c index 8f21771249f6..6ef49e338a73 100644 --- a/arch/x86/kernel/apic/x2apic_phys.c +++ b/arch/x86/kernel/apic/x2apic_phys.c | |||
@@ -55,61 +55,46 @@ static void __x2apic_send_IPI_dest(unsigned int apicid, int vector, | |||
55 | native_x2apic_icr_write(cfg, apicid); | 55 | native_x2apic_icr_write(cfg, apicid); |
56 | } | 56 | } |
57 | 57 | ||
58 | static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector) | 58 | static void |
59 | __x2apic_send_IPI_mask(const struct cpumask *mask, int vector, int apic_dest) | ||
59 | { | 60 | { |
60 | unsigned long query_cpu; | 61 | unsigned long query_cpu; |
62 | unsigned long this_cpu; | ||
61 | unsigned long flags; | 63 | unsigned long flags; |
62 | 64 | ||
63 | x2apic_wrmsr_fence(); | 65 | x2apic_wrmsr_fence(); |
64 | 66 | ||
65 | local_irq_save(flags); | 67 | local_irq_save(flags); |
68 | |||
69 | this_cpu = smp_processor_id(); | ||
66 | for_each_cpu(query_cpu, mask) { | 70 | for_each_cpu(query_cpu, mask) { |
71 | if (apic_dest == APIC_DEST_ALLBUT && this_cpu == query_cpu) | ||
72 | continue; | ||
67 | __x2apic_send_IPI_dest(per_cpu(x86_cpu_to_apicid, query_cpu), | 73 | __x2apic_send_IPI_dest(per_cpu(x86_cpu_to_apicid, query_cpu), |
68 | vector, APIC_DEST_PHYSICAL); | 74 | vector, APIC_DEST_PHYSICAL); |
69 | } | 75 | } |
70 | local_irq_restore(flags); | 76 | local_irq_restore(flags); |
71 | } | 77 | } |
72 | 78 | ||
79 | static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector) | ||
80 | { | ||
81 | __x2apic_send_IPI_mask(mask, vector, APIC_DEST_ALLINC); | ||
82 | } | ||
83 | |||
73 | static void | 84 | static void |
74 | x2apic_send_IPI_mask_allbutself(const struct cpumask *mask, int vector) | 85 | x2apic_send_IPI_mask_allbutself(const struct cpumask *mask, int vector) |
75 | { | 86 | { |
76 | unsigned long this_cpu = smp_processor_id(); | 87 | __x2apic_send_IPI_mask(mask, vector, APIC_DEST_ALLBUT); |
77 | unsigned long query_cpu; | ||
78 | unsigned long flags; | ||
79 | |||
80 | x2apic_wrmsr_fence(); | ||
81 | |||
82 | local_irq_save(flags); | ||
83 | for_each_cpu(query_cpu, mask) { | ||
84 | if (query_cpu != this_cpu) | ||
85 | __x2apic_send_IPI_dest( | ||
86 | per_cpu(x86_cpu_to_apicid, query_cpu), | ||
87 | vector, APIC_DEST_PHYSICAL); | ||
88 | } | ||
89 | local_irq_restore(flags); | ||
90 | } | 88 | } |
91 | 89 | ||
92 | static void x2apic_send_IPI_allbutself(int vector) | 90 | static void x2apic_send_IPI_allbutself(int vector) |
93 | { | 91 | { |
94 | unsigned long this_cpu = smp_processor_id(); | 92 | __x2apic_send_IPI_mask(cpu_online_mask, vector, APIC_DEST_ALLBUT); |
95 | unsigned long query_cpu; | ||
96 | unsigned long flags; | ||
97 | |||
98 | x2apic_wrmsr_fence(); | ||
99 | |||
100 | local_irq_save(flags); | ||
101 | for_each_online_cpu(query_cpu) { | ||
102 | if (query_cpu == this_cpu) | ||
103 | continue; | ||
104 | __x2apic_send_IPI_dest(per_cpu(x86_cpu_to_apicid, query_cpu), | ||
105 | vector, APIC_DEST_PHYSICAL); | ||
106 | } | ||
107 | local_irq_restore(flags); | ||
108 | } | 93 | } |
109 | 94 | ||
110 | static void x2apic_send_IPI_all(int vector) | 95 | static void x2apic_send_IPI_all(int vector) |
111 | { | 96 | { |
112 | x2apic_send_IPI_mask(cpu_online_mask, vector); | 97 | __x2apic_send_IPI_mask(cpu_online_mask, vector, APIC_DEST_ALLINC); |
113 | } | 98 | } |
114 | 99 | ||
115 | static int x2apic_apic_id_registered(void) | 100 | static int x2apic_apic_id_registered(void) |