aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-01-28 09:42:24 -0500
committerIngo Molnar <mingo@elte.hu>2009-01-28 17:20:31 -0500
commitdac5f4121df3c39fdb2ea57acd669a0ae19e46f8 (patch)
treec3dde8b525b1a8e73732bdffdb7e819f4a14fd3a /arch/x86/include
parentdebccb3e77be52cfc26c5a99e123c114c5c72aeb (diff)
x86, apic: untangle the send_IPI_*() jungle
Our send_IPI_*() methods and definitions are a twisted mess: the same symbol is defined to different things depending on .config details, in a non-transparent way. - spread out the quirks into separately named per apic driver methods - prefix the standard PC methods with default_ - get rid of wrapper macro obfuscation - clean up various details Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/include')
-rw-r--r--arch/x86/include/asm/bigsmp/ipi.h16
-rw-r--r--arch/x86/include/asm/es7000/ipi.h16
-rw-r--r--arch/x86/include/asm/hw_irq.h4
-rw-r--r--arch/x86/include/asm/ipi.h38
-rw-r--r--arch/x86/include/asm/mach-default/mach_apic.h1
-rw-r--r--arch/x86/include/asm/mach-default/mach_ipi.h40
-rw-r--r--arch/x86/include/asm/mach-generic/mach_ipi.h4
-rw-r--r--arch/x86/include/asm/numaq/ipi.h16
-rw-r--r--arch/x86/include/asm/summit/ipi.h16
9 files changed, 71 insertions, 80 deletions
diff --git a/arch/x86/include/asm/bigsmp/ipi.h b/arch/x86/include/asm/bigsmp/ipi.h
index 27fcd01b3ae6..a91db69cda6b 100644
--- a/arch/x86/include/asm/bigsmp/ipi.h
+++ b/arch/x86/include/asm/bigsmp/ipi.h
@@ -1,22 +1,22 @@
1#ifndef __ASM_MACH_IPI_H 1#ifndef __ASM_MACH_IPI_H
2#define __ASM_MACH_IPI_H 2#define __ASM_MACH_IPI_H
3 3
4void send_IPI_mask_sequence(const struct cpumask *mask, int vector); 4void default_send_IPI_mask_sequence(const struct cpumask *mask, int vector);
5void send_IPI_mask_allbutself(const struct cpumask *mask, int vector); 5void default_send_IPI_mask_allbutself(const struct cpumask *mask, int vector);
6 6
7static inline void send_IPI_mask(const struct cpumask *mask, int vector) 7static inline void default_send_IPI_mask(const struct cpumask *mask, int vector)
8{ 8{
9 send_IPI_mask_sequence(mask, vector); 9 default_send_IPI_mask_sequence(mask, vector);
10} 10}
11 11
12static inline void send_IPI_allbutself(int vector) 12static inline void bigsmp_send_IPI_allbutself(int vector)
13{ 13{
14 send_IPI_mask_allbutself(cpu_online_mask, vector); 14 default_send_IPI_mask_allbutself(cpu_online_mask, vector);
15} 15}
16 16
17static inline void send_IPI_all(int vector) 17static inline void bigsmp_send_IPI_all(int vector)
18{ 18{
19 send_IPI_mask(cpu_online_mask, vector); 19 default_send_IPI_mask(cpu_online_mask, vector);
20} 20}
21 21
22#endif /* __ASM_MACH_IPI_H */ 22#endif /* __ASM_MACH_IPI_H */
diff --git a/arch/x86/include/asm/es7000/ipi.h b/arch/x86/include/asm/es7000/ipi.h
index 7e8ed24d4b8a..81e77c812baa 100644
--- a/arch/x86/include/asm/es7000/ipi.h
+++ b/arch/x86/include/asm/es7000/ipi.h
@@ -1,22 +1,22 @@
1#ifndef __ASM_ES7000_IPI_H 1#ifndef __ASM_ES7000_IPI_H
2#define __ASM_ES7000_IPI_H 2#define __ASM_ES7000_IPI_H
3 3
4void send_IPI_mask_sequence(const struct cpumask *mask, int vector); 4void default_send_IPI_mask_sequence(const struct cpumask *mask, int vector);
5void send_IPI_mask_allbutself(const struct cpumask *mask, int vector); 5void default_send_IPI_mask_allbutself(const struct cpumask *mask, int vector);
6 6
7static inline void send_IPI_mask(const struct cpumask *mask, int vector) 7static inline void es7000_send_IPI_mask(const struct cpumask *mask, int vector)
8{ 8{
9 send_IPI_mask_sequence(mask, vector); 9 default_send_IPI_mask_sequence(mask, vector);
10} 10}
11 11
12static inline void send_IPI_allbutself(int vector) 12static inline void es7000_send_IPI_allbutself(int vector)
13{ 13{
14 send_IPI_mask_allbutself(cpu_online_mask, vector); 14 default_send_IPI_mask_allbutself(cpu_online_mask, vector);
15} 15}
16 16
17static inline void send_IPI_all(int vector) 17static inline void es7000_send_IPI_all(int vector)
18{ 18{
19 send_IPI_mask(cpu_online_mask, vector); 19 es7000_send_IPI_mask(cpu_online_mask, vector);
20} 20}
21 21
22#endif /* __ASM_ES7000_IPI_H */ 22#endif /* __ASM_ES7000_IPI_H */
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
index 8de644b6b959..bfa921fad133 100644
--- a/arch/x86/include/asm/hw_irq.h
+++ b/arch/x86/include/asm/hw_irq.h
@@ -73,9 +73,9 @@ extern void enable_IO_APIC(void);
73 73
74/* IPI functions */ 74/* IPI functions */
75#ifdef CONFIG_X86_32 75#ifdef CONFIG_X86_32
76extern void send_IPI_self(int vector); 76extern void default_send_IPI_self(int vector);
77#endif 77#endif
78extern void send_IPI(int dest, int vector); 78extern void default_send_IPI(int dest, int vector);
79 79
80/* Statistics */ 80/* Statistics */
81extern atomic_t irq_err_count; 81extern atomic_t irq_err_count;
diff --git a/arch/x86/include/asm/ipi.h b/arch/x86/include/asm/ipi.h
index c745a306f7d3..a8d717f2c7e7 100644
--- a/arch/x86/include/asm/ipi.h
+++ b/arch/x86/include/asm/ipi.h
@@ -55,8 +55,9 @@ static inline void __xapic_wait_icr_idle(void)
55 cpu_relax(); 55 cpu_relax();
56} 56}
57 57
58static inline void __send_IPI_shortcut(unsigned int shortcut, int vector, 58static inline void
59 unsigned int dest) 59__default_send_IPI_shortcut(unsigned int shortcut,
60 int vector, unsigned int dest)
60{ 61{
61 /* 62 /*
62 * Subtle. In the case of the 'never do double writes' workaround 63 * Subtle. In the case of the 'never do double writes' workaround
@@ -87,8 +88,8 @@ static inline void __send_IPI_shortcut(unsigned int shortcut, int vector,
87 * This is used to send an IPI with no shorthand notation (the destination is 88 * This is used to send an IPI with no shorthand notation (the destination is
88 * specified in bits 56 to 63 of the ICR). 89 * specified in bits 56 to 63 of the ICR).
89 */ 90 */
90static inline void __send_IPI_dest_field(unsigned int mask, int vector, 91static inline void
91 unsigned int dest) 92 __default_send_IPI_dest_field(unsigned int mask, int vector, unsigned int dest)
92{ 93{
93 unsigned long cfg; 94 unsigned long cfg;
94 95
@@ -117,11 +118,11 @@ static inline void __send_IPI_dest_field(unsigned int mask, int vector,
117 native_apic_mem_write(APIC_ICR, cfg); 118 native_apic_mem_write(APIC_ICR, cfg);
118} 119}
119 120
120static inline void send_IPI_mask_sequence(const struct cpumask *mask, 121static inline void
121 int vector) 122default_send_IPI_mask_sequence(const struct cpumask *mask, int vector)
122{ 123{
123 unsigned long flags;
124 unsigned long query_cpu; 124 unsigned long query_cpu;
125 unsigned long flags;
125 126
126 /* 127 /*
127 * Hack. The clustered APIC addressing mode doesn't allow us to send 128 * Hack. The clustered APIC addressing mode doesn't allow us to send
@@ -130,27 +131,28 @@ static inline void send_IPI_mask_sequence(const struct cpumask *mask,
130 */ 131 */
131 local_irq_save(flags); 132 local_irq_save(flags);
132 for_each_cpu(query_cpu, mask) { 133 for_each_cpu(query_cpu, mask) {
133 __send_IPI_dest_field(per_cpu(x86_cpu_to_apicid, query_cpu), 134 __default_send_IPI_dest_field(per_cpu(x86_cpu_to_apicid,
134 vector, APIC_DEST_PHYSICAL); 135 query_cpu), vector, APIC_DEST_PHYSICAL);
135 } 136 }
136 local_irq_restore(flags); 137 local_irq_restore(flags);
137} 138}
138 139
139static inline void send_IPI_mask_allbutself(const struct cpumask *mask, 140static inline void
140 int vector) 141default_send_IPI_mask_allbutself(const struct cpumask *mask, int vector)
141{ 142{
142 unsigned long flags;
143 unsigned int query_cpu;
144 unsigned int this_cpu = smp_processor_id(); 143 unsigned int this_cpu = smp_processor_id();
144 unsigned int query_cpu;
145 unsigned long flags;
145 146
146 /* See Hack comment above */ 147 /* See Hack comment above */
147 148
148 local_irq_save(flags); 149 local_irq_save(flags);
149 for_each_cpu(query_cpu, mask) 150 for_each_cpu(query_cpu, mask) {
150 if (query_cpu != this_cpu) 151 if (query_cpu == this_cpu)
151 __send_IPI_dest_field( 152 continue;
152 per_cpu(x86_cpu_to_apicid, query_cpu), 153 __default_send_IPI_dest_field(per_cpu(x86_cpu_to_apicid,
153 vector, APIC_DEST_PHYSICAL); 154 query_cpu), vector, APIC_DEST_PHYSICAL);
155 }
154 local_irq_restore(flags); 156 local_irq_restore(flags);
155} 157}
156 158
diff --git a/arch/x86/include/asm/mach-default/mach_apic.h b/arch/x86/include/asm/mach-default/mach_apic.h
index 8972f8434145..2e4104cf3481 100644
--- a/arch/x86/include/asm/mach-default/mach_apic.h
+++ b/arch/x86/include/asm/mach-default/mach_apic.h
@@ -20,7 +20,6 @@ static inline const struct cpumask *default_target_cpus(void)
20#ifdef CONFIG_X86_64 20#ifdef CONFIG_X86_64
21#include <asm/genapic.h> 21#include <asm/genapic.h>
22#define read_apic_id() (apic->get_apic_id(apic_read(APIC_ID))) 22#define read_apic_id() (apic->get_apic_id(apic_read(APIC_ID)))
23#define send_IPI_self (apic->send_IPI_self)
24#define wakeup_secondary_cpu (apic->wakeup_cpu) 23#define wakeup_secondary_cpu (apic->wakeup_cpu)
25extern void default_setup_apic_routing(void); 24extern void default_setup_apic_routing(void);
26#else 25#else
diff --git a/arch/x86/include/asm/mach-default/mach_ipi.h b/arch/x86/include/asm/mach-default/mach_ipi.h
index 089399643dfa..85dec630c69c 100644
--- a/arch/x86/include/asm/mach-default/mach_ipi.h
+++ b/arch/x86/include/asm/mach-default/mach_ipi.h
@@ -4,45 +4,40 @@
4/* Avoid include hell */ 4/* Avoid include hell */
5#define NMI_VECTOR 0x02 5#define NMI_VECTOR 0x02
6 6
7void send_IPI_mask_bitmask(const struct cpumask *mask, int vector); 7void default_send_IPI_mask_bitmask(const struct cpumask *mask, int vector);
8void send_IPI_mask_allbutself(const struct cpumask *mask, int vector); 8void default_send_IPI_mask_allbutself(const struct cpumask *mask, int vector);
9void __send_IPI_shortcut(unsigned int shortcut, int vector); 9void __default_send_IPI_shortcut(unsigned int shortcut, int vector);
10 10
11extern int no_broadcast; 11extern int no_broadcast;
12 12
13#ifdef CONFIG_X86_64 13#ifdef CONFIG_X86_64
14#include <asm/genapic.h> 14#include <asm/genapic.h>
15#define send_IPI_mask (apic->send_IPI_mask)
16#define send_IPI_mask_allbutself (apic->send_IPI_mask_allbutself)
17#else 15#else
18static inline void send_IPI_mask(const struct cpumask *mask, int vector) 16static inline void default_send_IPI_mask(const struct cpumask *mask, int vector)
19{ 17{
20 send_IPI_mask_bitmask(mask, vector); 18 default_send_IPI_mask_bitmask(mask, vector);
21} 19}
22void send_IPI_mask_allbutself(const struct cpumask *mask, int vector); 20void default_send_IPI_mask_allbutself(const struct cpumask *mask, int vector);
23#endif 21#endif
24 22
25static inline void __local_send_IPI_allbutself(int vector) 23static inline void __default_local_send_IPI_allbutself(int vector)
26{ 24{
27 if (no_broadcast || vector == NMI_VECTOR) 25 if (no_broadcast || vector == NMI_VECTOR)
28 send_IPI_mask_allbutself(cpu_online_mask, vector); 26 apic->send_IPI_mask_allbutself(cpu_online_mask, vector);
29 else 27 else
30 __send_IPI_shortcut(APIC_DEST_ALLBUT, vector); 28 __default_send_IPI_shortcut(APIC_DEST_ALLBUT, vector);
31} 29}
32 30
33static inline void __local_send_IPI_all(int vector) 31static inline void __default_local_send_IPI_all(int vector)
34{ 32{
35 if (no_broadcast || vector == NMI_VECTOR) 33 if (no_broadcast || vector == NMI_VECTOR)
36 send_IPI_mask(cpu_online_mask, vector); 34 apic->send_IPI_mask(cpu_online_mask, vector);
37 else 35 else
38 __send_IPI_shortcut(APIC_DEST_ALLINC, vector); 36 __default_send_IPI_shortcut(APIC_DEST_ALLINC, vector);
39} 37}
40 38
41#ifdef CONFIG_X86_64 39#ifdef CONFIG_X86_32
42#define send_IPI_allbutself (apic->send_IPI_allbutself) 40static inline void default_send_IPI_allbutself(int vector)
43#define send_IPI_all (apic->send_IPI_all)
44#else
45static inline void send_IPI_allbutself(int vector)
46{ 41{
47 /* 42 /*
48 * if there are no other CPUs in the system then we get an APIC send 43 * if there are no other CPUs in the system then we get an APIC send
@@ -51,13 +46,12 @@ static inline void send_IPI_allbutself(int vector)
51 if (!(num_online_cpus() > 1)) 46 if (!(num_online_cpus() > 1))
52 return; 47 return;
53 48
54 __local_send_IPI_allbutself(vector); 49 __default_local_send_IPI_allbutself(vector);
55 return;
56} 50}
57 51
58static inline void send_IPI_all(int vector) 52static inline void default_send_IPI_all(int vector)
59{ 53{
60 __local_send_IPI_all(vector); 54 __default_local_send_IPI_all(vector);
61} 55}
62#endif 56#endif
63 57
diff --git a/arch/x86/include/asm/mach-generic/mach_ipi.h b/arch/x86/include/asm/mach-generic/mach_ipi.h
index 75e54bd6cbdc..5691c09645c5 100644
--- a/arch/x86/include/asm/mach-generic/mach_ipi.h
+++ b/arch/x86/include/asm/mach-generic/mach_ipi.h
@@ -3,8 +3,4 @@
3 3
4#include <asm/genapic.h> 4#include <asm/genapic.h>
5 5
6#define send_IPI_mask (apic->send_IPI_mask)
7#define send_IPI_allbutself (apic->send_IPI_allbutself)
8#define send_IPI_all (apic->send_IPI_all)
9
10#endif /* _ASM_X86_MACH_GENERIC_MACH_IPI_H */ 6#endif /* _ASM_X86_MACH_GENERIC_MACH_IPI_H */
diff --git a/arch/x86/include/asm/numaq/ipi.h b/arch/x86/include/asm/numaq/ipi.h
index a8374c652778..5dbc4b4cd5e5 100644
--- a/arch/x86/include/asm/numaq/ipi.h
+++ b/arch/x86/include/asm/numaq/ipi.h
@@ -1,22 +1,22 @@
1#ifndef __ASM_NUMAQ_IPI_H 1#ifndef __ASM_NUMAQ_IPI_H
2#define __ASM_NUMAQ_IPI_H 2#define __ASM_NUMAQ_IPI_H
3 3
4void send_IPI_mask_sequence(const struct cpumask *mask, int vector); 4void default_send_IPI_mask_sequence(const struct cpumask *mask, int vector);
5void send_IPI_mask_allbutself(const struct cpumask *mask, int vector); 5void default_send_IPI_mask_allbutself(const struct cpumask *mask, int vector);
6 6
7static inline void send_IPI_mask(const struct cpumask *mask, int vector) 7static inline void numaq_send_IPI_mask(const struct cpumask *mask, int vector)
8{ 8{
9 send_IPI_mask_sequence(mask, vector); 9 default_send_IPI_mask_sequence(mask, vector);
10} 10}
11 11
12static inline void send_IPI_allbutself(int vector) 12static inline void numaq_send_IPI_allbutself(int vector)
13{ 13{
14 send_IPI_mask_allbutself(cpu_online_mask, vector); 14 default_send_IPI_mask_allbutself(cpu_online_mask, vector);
15} 15}
16 16
17static inline void send_IPI_all(int vector) 17static inline void numaq_send_IPI_all(int vector)
18{ 18{
19 send_IPI_mask(cpu_online_mask, vector); 19 numaq_send_IPI_mask(cpu_online_mask, vector);
20} 20}
21 21
22#endif /* __ASM_NUMAQ_IPI_H */ 22#endif /* __ASM_NUMAQ_IPI_H */
diff --git a/arch/x86/include/asm/summit/ipi.h b/arch/x86/include/asm/summit/ipi.h
index a8a2c24f50cc..f87a43fe0aed 100644
--- a/arch/x86/include/asm/summit/ipi.h
+++ b/arch/x86/include/asm/summit/ipi.h
@@ -1,26 +1,26 @@
1#ifndef __ASM_SUMMIT_IPI_H 1#ifndef __ASM_SUMMIT_IPI_H
2#define __ASM_SUMMIT_IPI_H 2#define __ASM_SUMMIT_IPI_H
3 3
4void send_IPI_mask_sequence(const cpumask_t *mask, int vector); 4void default_send_IPI_mask_sequence(const cpumask_t *mask, int vector);
5void send_IPI_mask_allbutself(const cpumask_t *mask, int vector); 5void default_send_IPI_mask_allbutself(const cpumask_t *mask, int vector);
6 6
7static inline void send_IPI_mask(const cpumask_t *mask, int vector) 7static inline void summit_send_IPI_mask(const cpumask_t *mask, int vector)
8{ 8{
9 send_IPI_mask_sequence(mask, vector); 9 default_send_IPI_mask_sequence(mask, vector);
10} 10}
11 11
12static inline void send_IPI_allbutself(int vector) 12static inline void summit_send_IPI_allbutself(int vector)
13{ 13{
14 cpumask_t mask = cpu_online_map; 14 cpumask_t mask = cpu_online_map;
15 cpu_clear(smp_processor_id(), mask); 15 cpu_clear(smp_processor_id(), mask);
16 16
17 if (!cpus_empty(mask)) 17 if (!cpus_empty(mask))
18 send_IPI_mask(&mask, vector); 18 summit_send_IPI_mask(&mask, vector);
19} 19}
20 20
21static inline void send_IPI_all(int vector) 21static inline void summit_send_IPI_all(int vector)
22{ 22{
23 send_IPI_mask(&cpu_online_map, vector); 23 summit_send_IPI_mask(&cpu_online_map, vector);
24} 24}
25 25
26#endif /* __ASM_SUMMIT_IPI_H */ 26#endif /* __ASM_SUMMIT_IPI_H */