diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-01-28 09:42:24 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-28 17:20:31 -0500 |
commit | dac5f4121df3c39fdb2ea57acd669a0ae19e46f8 (patch) | |
tree | c3dde8b525b1a8e73732bdffdb7e819f4a14fd3a /arch/x86/include | |
parent | debccb3e77be52cfc26c5a99e123c114c5c72aeb (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.h | 16 | ||||
-rw-r--r-- | arch/x86/include/asm/es7000/ipi.h | 16 | ||||
-rw-r--r-- | arch/x86/include/asm/hw_irq.h | 4 | ||||
-rw-r--r-- | arch/x86/include/asm/ipi.h | 38 | ||||
-rw-r--r-- | arch/x86/include/asm/mach-default/mach_apic.h | 1 | ||||
-rw-r--r-- | arch/x86/include/asm/mach-default/mach_ipi.h | 40 | ||||
-rw-r--r-- | arch/x86/include/asm/mach-generic/mach_ipi.h | 4 | ||||
-rw-r--r-- | arch/x86/include/asm/numaq/ipi.h | 16 | ||||
-rw-r--r-- | arch/x86/include/asm/summit/ipi.h | 16 |
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 | ||
4 | void send_IPI_mask_sequence(const struct cpumask *mask, int vector); | 4 | void default_send_IPI_mask_sequence(const struct cpumask *mask, int vector); |
5 | void send_IPI_mask_allbutself(const struct cpumask *mask, int vector); | 5 | void default_send_IPI_mask_allbutself(const struct cpumask *mask, int vector); |
6 | 6 | ||
7 | static inline void send_IPI_mask(const struct cpumask *mask, int vector) | 7 | static 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 | ||
12 | static inline void send_IPI_allbutself(int vector) | 12 | static 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 | ||
17 | static inline void send_IPI_all(int vector) | 17 | static 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 | ||
4 | void send_IPI_mask_sequence(const struct cpumask *mask, int vector); | 4 | void default_send_IPI_mask_sequence(const struct cpumask *mask, int vector); |
5 | void send_IPI_mask_allbutself(const struct cpumask *mask, int vector); | 5 | void default_send_IPI_mask_allbutself(const struct cpumask *mask, int vector); |
6 | 6 | ||
7 | static inline void send_IPI_mask(const struct cpumask *mask, int vector) | 7 | static 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 | ||
12 | static inline void send_IPI_allbutself(int vector) | 12 | static 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 | ||
17 | static inline void send_IPI_all(int vector) | 17 | static 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 |
76 | extern void send_IPI_self(int vector); | 76 | extern void default_send_IPI_self(int vector); |
77 | #endif | 77 | #endif |
78 | extern void send_IPI(int dest, int vector); | 78 | extern void default_send_IPI(int dest, int vector); |
79 | 79 | ||
80 | /* Statistics */ | 80 | /* Statistics */ |
81 | extern atomic_t irq_err_count; | 81 | extern 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 | ||
58 | static inline void __send_IPI_shortcut(unsigned int shortcut, int vector, | 58 | static 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 | */ |
90 | static inline void __send_IPI_dest_field(unsigned int mask, int vector, | 91 | static 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 | ||
120 | static inline void send_IPI_mask_sequence(const struct cpumask *mask, | 121 | static inline void |
121 | int vector) | 122 | default_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 | ||
139 | static inline void send_IPI_mask_allbutself(const struct cpumask *mask, | 140 | static inline void |
140 | int vector) | 141 | default_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) |
25 | extern void default_setup_apic_routing(void); | 24 | extern 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 | ||
7 | void send_IPI_mask_bitmask(const struct cpumask *mask, int vector); | 7 | void default_send_IPI_mask_bitmask(const struct cpumask *mask, int vector); |
8 | void send_IPI_mask_allbutself(const struct cpumask *mask, int vector); | 8 | void default_send_IPI_mask_allbutself(const struct cpumask *mask, int vector); |
9 | void __send_IPI_shortcut(unsigned int shortcut, int vector); | 9 | void __default_send_IPI_shortcut(unsigned int shortcut, int vector); |
10 | 10 | ||
11 | extern int no_broadcast; | 11 | extern 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 |
18 | static inline void send_IPI_mask(const struct cpumask *mask, int vector) | 16 | static 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 | } |
22 | void send_IPI_mask_allbutself(const struct cpumask *mask, int vector); | 20 | void default_send_IPI_mask_allbutself(const struct cpumask *mask, int vector); |
23 | #endif | 21 | #endif |
24 | 22 | ||
25 | static inline void __local_send_IPI_allbutself(int vector) | 23 | static 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 | ||
33 | static inline void __local_send_IPI_all(int vector) | 31 | static 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) | 40 | static inline void default_send_IPI_allbutself(int vector) |
43 | #define send_IPI_all (apic->send_IPI_all) | ||
44 | #else | ||
45 | static 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 | ||
58 | static inline void send_IPI_all(int vector) | 52 | static 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 | ||
4 | void send_IPI_mask_sequence(const struct cpumask *mask, int vector); | 4 | void default_send_IPI_mask_sequence(const struct cpumask *mask, int vector); |
5 | void send_IPI_mask_allbutself(const struct cpumask *mask, int vector); | 5 | void default_send_IPI_mask_allbutself(const struct cpumask *mask, int vector); |
6 | 6 | ||
7 | static inline void send_IPI_mask(const struct cpumask *mask, int vector) | 7 | static 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 | ||
12 | static inline void send_IPI_allbutself(int vector) | 12 | static 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 | ||
17 | static inline void send_IPI_all(int vector) | 17 | static 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 | ||
4 | void send_IPI_mask_sequence(const cpumask_t *mask, int vector); | 4 | void default_send_IPI_mask_sequence(const cpumask_t *mask, int vector); |
5 | void send_IPI_mask_allbutself(const cpumask_t *mask, int vector); | 5 | void default_send_IPI_mask_allbutself(const cpumask_t *mask, int vector); |
6 | 6 | ||
7 | static inline void send_IPI_mask(const cpumask_t *mask, int vector) | 7 | static 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 | ||
12 | static inline void send_IPI_allbutself(int vector) | 12 | static 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 | ||
21 | static inline void send_IPI_all(int vector) | 21 | static 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 */ |