aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2009-02-17 02:02:14 -0500
committerIngo Molnar <mingo@elte.hu>2009-02-17 06:22:20 -0500
commitc1eeb2de41d7015678bdd412b48a5f071b84e29a (patch)
tree6af99f46f557f9e854e882deac52d23b2fadb5a2 /arch
parent06cd9a7dc8a58186060a91b6ddc031057435fd34 (diff)
x86: fold apic_ops into genapic
Impact: cleanup make it simpler, don't need have one extra struct. v2: fix the sgi_uv build Signed-off-by: Yinghai Lu <yinghai@kernel.org> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/include/asm/apic.h97
-rw-r--r--arch/x86/include/asm/genapic.h61
-rw-r--r--arch/x86/kernel/apic.c63
-rw-r--r--arch/x86/kernel/bigsmp_32.c7
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd_64.c2
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_intel_64.c2
-rw-r--r--arch/x86/kernel/cpu/perfctr-watchdog.c2
-rw-r--r--arch/x86/kernel/es7000_32.c7
-rw-r--r--arch/x86/kernel/genapic_64.c2
-rw-r--r--arch/x86/kernel/genapic_flat_64.c16
-rw-r--r--arch/x86/kernel/genx2apic_cluster.c11
-rw-r--r--arch/x86/kernel/genx2apic_phys.c11
-rw-r--r--arch/x86/kernel/genx2apic_uv_x.c9
-rw-r--r--arch/x86/kernel/ipi.c2
-rw-r--r--arch/x86/kernel/irq.c2
-rw-r--r--arch/x86/kernel/nmi.c2
-rw-r--r--arch/x86/kernel/numaq_32.c7
-rw-r--r--arch/x86/kernel/probe_32.c7
-rw-r--r--arch/x86/kernel/summit_32.c7
-rw-r--r--arch/x86/kernel/uv_irq.c2
-rw-r--r--arch/x86/kernel/vmi_32.c6
-rw-r--r--arch/x86/kernel/vmiclock_32.c2
-rw-r--r--arch/x86/lguest/boot.c19
-rw-r--r--arch/x86/xen/enlighten.c21
24 files changed, 205 insertions, 162 deletions
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index dc1db99cd40e..4f56e053d347 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -92,6 +92,12 @@ static inline u32 native_apic_mem_read(u32 reg)
92 return *((volatile u32 *)(APIC_BASE + reg)); 92 return *((volatile u32 *)(APIC_BASE + reg));
93} 93}
94 94
95extern void native_apic_wait_icr_idle(void);
96extern u32 native_safe_apic_wait_icr_idle(void);
97extern void native_apic_icr_write(u32 low, u32 id);
98extern u64 native_apic_icr_read(void);
99
100#ifdef CONFIG_X86_X2APIC
95static inline void native_apic_msr_write(u32 reg, u32 v) 101static inline void native_apic_msr_write(u32 reg, u32 v)
96{ 102{
97 if (reg == APIC_DFR || reg == APIC_ID || reg == APIC_LDR || 103 if (reg == APIC_DFR || reg == APIC_ID || reg == APIC_LDR ||
@@ -112,7 +118,31 @@ static inline u32 native_apic_msr_read(u32 reg)
112 return low; 118 return low;
113} 119}
114 120
115#ifdef CONFIG_X86_X2APIC 121static inline void native_x2apic_wait_icr_idle(void)
122{
123 /* no need to wait for icr idle in x2apic */
124 return;
125}
126
127static inline u32 native_safe_x2apic_wait_icr_idle(void)
128{
129 /* no need to wait for icr idle in x2apic */
130 return 0;
131}
132
133static inline void native_x2apic_icr_write(u32 low, u32 id)
134{
135 wrmsrl(APIC_BASE_MSR + (APIC_ICR >> 4), ((__u64) id) << 32 | low);
136}
137
138static inline u64 native_x2apic_icr_read(void)
139{
140 unsigned long val;
141
142 rdmsrl(APIC_BASE_MSR + (APIC_ICR >> 4), val);
143 return val;
144}
145
116extern int x2apic; 146extern int x2apic;
117extern void check_x2apic(void); 147extern void check_x2apic(void);
118extern void enable_x2apic(void); 148extern void enable_x2apic(void);
@@ -146,47 +176,6 @@ static inline int x2apic_enabled(void)
146} 176}
147#endif 177#endif
148 178
149struct apic_ops {
150 u32 (*read)(u32 reg);
151 void (*write)(u32 reg, u32 v);
152 u64 (*icr_read)(void);
153 void (*icr_write)(u32 low, u32 high);
154 void (*wait_icr_idle)(void);
155 u32 (*safe_wait_icr_idle)(void);
156};
157
158extern struct apic_ops *apic_ops;
159
160static inline u32 apic_read(u32 reg)
161{
162 return apic_ops->read(reg);
163}
164
165static inline void apic_write(u32 reg, u32 val)
166{
167 apic_ops->write(reg, val);
168}
169
170static inline u64 apic_icr_read(void)
171{
172 return apic_ops->icr_read();
173}
174
175static inline void apic_icr_write(u32 low, u32 high)
176{
177 apic_ops->icr_write(low, high);
178}
179
180static inline void apic_wait_icr_idle(void)
181{
182 apic_ops->wait_icr_idle();
183}
184
185static inline u32 safe_apic_wait_icr_idle(void)
186{
187 return apic_ops->safe_wait_icr_idle();
188}
189
190extern int get_physical_broadcast(void); 179extern int get_physical_broadcast(void);
191 180
192#ifdef CONFIG_X86_X2APIC 181#ifdef CONFIG_X86_X2APIC
@@ -197,18 +186,6 @@ static inline void ack_x2APIC_irq(void)
197} 186}
198#endif 187#endif
199 188
200
201static inline void ack_APIC_irq(void)
202{
203 /*
204 * ack_APIC_irq() actually gets compiled as a single instruction
205 * ... yummie.
206 */
207
208 /* Docs say use 0 for future compatibility */
209 apic_write(APIC_EOI, 0);
210}
211
212extern int lapic_get_maxlvt(void); 189extern int lapic_get_maxlvt(void);
213extern void clear_local_APIC(void); 190extern void clear_local_APIC(void);
214extern void connect_bsp_APIC(void); 191extern void connect_bsp_APIC(void);
@@ -256,18 +233,6 @@ static inline void disable_local_APIC(void) { }
256#define SET_APIC_ID(x) (apic->set_apic_id(x)) 233#define SET_APIC_ID(x) (apic->set_apic_id(x))
257#else 234#else
258 235
259#ifdef CONFIG_X86_LOCAL_APIC
260static inline unsigned default_get_apic_id(unsigned long x)
261{
262 unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR));
263
264 if (APIC_XAPIC(ver))
265 return (x >> 24) & 0xFF;
266 else
267 return (x >> 24) & 0x0F;
268}
269#endif
270
271#endif 236#endif
272 237
273#endif /* _ASM_X86_APIC_H */ 238#endif /* _ASM_X86_APIC_H */
diff --git a/arch/x86/include/asm/genapic.h b/arch/x86/include/asm/genapic.h
index 273b99452ae0..a6d0b00a544c 100644
--- a/arch/x86/include/asm/genapic.h
+++ b/arch/x86/include/asm/genapic.h
@@ -5,6 +5,7 @@
5 5
6#include <asm/mpspec.h> 6#include <asm/mpspec.h>
7#include <asm/atomic.h> 7#include <asm/atomic.h>
8#include <asm/apic.h>
8 9
9/* 10/*
10 * Copyright 2004 James Cleverdon, IBM. 11 * Copyright 2004 James Cleverdon, IBM.
@@ -83,10 +84,70 @@ struct genapic {
83 void (*smp_callin_clear_local_apic)(void); 84 void (*smp_callin_clear_local_apic)(void);
84 void (*store_NMI_vector)(unsigned short *high, unsigned short *low); 85 void (*store_NMI_vector)(unsigned short *high, unsigned short *low);
85 void (*inquire_remote_apic)(int apicid); 86 void (*inquire_remote_apic)(int apicid);
87
88 /* apic ops */
89 u32 (*read)(u32 reg);
90 void (*write)(u32 reg, u32 v);
91 u64 (*icr_read)(void);
92 void (*icr_write)(u32 low, u32 high);
93 void (*wait_icr_idle)(void);
94 u32 (*safe_wait_icr_idle)(void);
86}; 95};
87 96
88extern struct genapic *apic; 97extern struct genapic *apic;
89 98
99static inline u32 apic_read(u32 reg)
100{
101 return apic->read(reg);
102}
103
104static inline void apic_write(u32 reg, u32 val)
105{
106 apic->write(reg, val);
107}
108
109static inline u64 apic_icr_read(void)
110{
111 return apic->icr_read();
112}
113
114static inline void apic_icr_write(u32 low, u32 high)
115{
116 apic->icr_write(low, high);
117}
118
119static inline void apic_wait_icr_idle(void)
120{
121 apic->wait_icr_idle();
122}
123
124static inline u32 safe_apic_wait_icr_idle(void)
125{
126 return apic->safe_wait_icr_idle();
127}
128
129
130static inline void ack_APIC_irq(void)
131{
132 /*
133 * ack_APIC_irq() actually gets compiled as a single instruction
134 * ... yummie.
135 */
136
137 /* Docs say use 0 for future compatibility */
138 apic_write(APIC_EOI, 0);
139}
140
141static inline unsigned default_get_apic_id(unsigned long x)
142{
143 unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR));
144
145 if (APIC_XAPIC(ver))
146 return (x >> 24) & 0xFF;
147 else
148 return (x >> 24) & 0x0F;
149}
150
90/* 151/*
91 * Warm reset vector default position: 152 * Warm reset vector default position:
92 */ 153 */
diff --git a/arch/x86/kernel/apic.c b/arch/x86/kernel/apic.c
index 004aa1c31e4f..af494bad8858 100644
--- a/arch/x86/kernel/apic.c
+++ b/arch/x86/kernel/apic.c
@@ -210,18 +210,13 @@ static int modern_apic(void)
210 return lapic_get_version() >= 0x14; 210 return lapic_get_version() >= 0x14;
211} 211}
212 212
213/* 213void native_apic_wait_icr_idle(void)
214 * Paravirt kernels also might be using these below ops. So we still
215 * use generic apic_read()/apic_write(), which might be pointing to different
216 * ops in PARAVIRT case.
217 */
218void xapic_wait_icr_idle(void)
219{ 214{
220 while (apic_read(APIC_ICR) & APIC_ICR_BUSY) 215 while (apic_read(APIC_ICR) & APIC_ICR_BUSY)
221 cpu_relax(); 216 cpu_relax();
222} 217}
223 218
224u32 safe_xapic_wait_icr_idle(void) 219u32 native_safe_apic_wait_icr_idle(void)
225{ 220{
226 u32 send_status; 221 u32 send_status;
227 int timeout; 222 int timeout;
@@ -237,13 +232,13 @@ u32 safe_xapic_wait_icr_idle(void)
237 return send_status; 232 return send_status;
238} 233}
239 234
240void xapic_icr_write(u32 low, u32 id) 235void native_apic_icr_write(u32 low, u32 id)
241{ 236{
242 apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(id)); 237 apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(id));
243 apic_write(APIC_ICR, low); 238 apic_write(APIC_ICR, low);
244} 239}
245 240
246static u64 xapic_icr_read(void) 241u64 native_apic_icr_read(void)
247{ 242{
248 u32 icr1, icr2; 243 u32 icr1, icr2;
249 244
@@ -253,54 +248,6 @@ static u64 xapic_icr_read(void)
253 return icr1 | ((u64)icr2 << 32); 248 return icr1 | ((u64)icr2 << 32);
254} 249}
255 250
256static struct apic_ops xapic_ops = {
257 .read = native_apic_mem_read,
258 .write = native_apic_mem_write,
259 .icr_read = xapic_icr_read,
260 .icr_write = xapic_icr_write,
261 .wait_icr_idle = xapic_wait_icr_idle,
262 .safe_wait_icr_idle = safe_xapic_wait_icr_idle,
263};
264
265struct apic_ops __read_mostly *apic_ops = &xapic_ops;
266EXPORT_SYMBOL_GPL(apic_ops);
267
268#ifdef CONFIG_X86_X2APIC
269static void x2apic_wait_icr_idle(void)
270{
271 /* no need to wait for icr idle in x2apic */
272 return;
273}
274
275static u32 safe_x2apic_wait_icr_idle(void)
276{
277 /* no need to wait for icr idle in x2apic */
278 return 0;
279}
280
281void x2apic_icr_write(u32 low, u32 id)
282{
283 wrmsrl(APIC_BASE_MSR + (APIC_ICR >> 4), ((__u64) id) << 32 | low);
284}
285
286static u64 x2apic_icr_read(void)
287{
288 unsigned long val;
289
290 rdmsrl(APIC_BASE_MSR + (APIC_ICR >> 4), val);
291 return val;
292}
293
294static struct apic_ops x2apic_ops = {
295 .read = native_apic_msr_read,
296 .write = native_apic_msr_write,
297 .icr_read = x2apic_icr_read,
298 .icr_write = x2apic_icr_write,
299 .wait_icr_idle = x2apic_wait_icr_idle,
300 .safe_wait_icr_idle = safe_x2apic_wait_icr_idle,
301};
302#endif
303
304/** 251/**
305 * enable_NMI_through_LVT0 - enable NMI through local vector table 0 252 * enable_NMI_through_LVT0 - enable NMI through local vector table 0
306 */ 253 */
@@ -1329,7 +1276,6 @@ void check_x2apic(void)
1329 if (msr & X2APIC_ENABLE) { 1276 if (msr & X2APIC_ENABLE) {
1330 pr_info("x2apic enabled by BIOS, switching to x2apic ops\n"); 1277 pr_info("x2apic enabled by BIOS, switching to x2apic ops\n");
1331 x2apic_preenabled = x2apic = 1; 1278 x2apic_preenabled = x2apic = 1;
1332 apic_ops = &x2apic_ops;
1333 } 1279 }
1334} 1280}
1335 1281
@@ -1403,7 +1349,6 @@ void __init enable_IR_x2apic(void)
1403 1349
1404 if (!x2apic) { 1350 if (!x2apic) {
1405 x2apic = 1; 1351 x2apic = 1;
1406 apic_ops = &x2apic_ops;
1407 enable_x2apic(); 1352 enable_x2apic();
1408 } 1353 }
1409 1354
diff --git a/arch/x86/kernel/bigsmp_32.c b/arch/x86/kernel/bigsmp_32.c
index 47a62f46afdb..9eeb714c5ded 100644
--- a/arch/x86/kernel/bigsmp_32.c
+++ b/arch/x86/kernel/bigsmp_32.c
@@ -263,4 +263,11 @@ struct genapic apic_bigsmp = {
263 .smp_callin_clear_local_apic = NULL, 263 .smp_callin_clear_local_apic = NULL,
264 .store_NMI_vector = NULL, 264 .store_NMI_vector = NULL,
265 .inquire_remote_apic = default_inquire_remote_apic, 265 .inquire_remote_apic = default_inquire_remote_apic,
266
267 .read = native_apic_mem_read,
268 .write = native_apic_mem_write,
269 .icr_read = native_apic_icr_read,
270 .icr_write = native_apic_icr_write,
271 .wait_icr_idle = native_apic_wait_icr_idle,
272 .safe_wait_icr_idle = native_safe_apic_wait_icr_idle,
266}; 273};
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
index 4772e91e8246..e22d6ed26e61 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
@@ -24,7 +24,7 @@
24#include <linux/smp.h> 24#include <linux/smp.h>
25#include <linux/sysdev.h> 25#include <linux/sysdev.h>
26#include <linux/sysfs.h> 26#include <linux/sysfs.h>
27#include <asm/apic.h> 27#include <asm/genapic.h>
28#include <asm/mce.h> 28#include <asm/mce.h>
29#include <asm/msr.h> 29#include <asm/msr.h>
30#include <asm/percpu.h> 30#include <asm/percpu.h>
diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel_64.c b/arch/x86/kernel/cpu/mcheck/mce_intel_64.c
index 5e8c79e748a6..42f090702f02 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_intel_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_intel_64.c
@@ -7,7 +7,7 @@
7#include <linux/interrupt.h> 7#include <linux/interrupt.h>
8#include <linux/percpu.h> 8#include <linux/percpu.h>
9#include <asm/processor.h> 9#include <asm/processor.h>
10#include <asm/apic.h> 10#include <asm/genapic.h>
11#include <asm/msr.h> 11#include <asm/msr.h>
12#include <asm/mce.h> 12#include <asm/mce.h>
13#include <asm/hw_irq.h> 13#include <asm/hw_irq.h>
diff --git a/arch/x86/kernel/cpu/perfctr-watchdog.c b/arch/x86/kernel/cpu/perfctr-watchdog.c
index 9abd48b22674..f6c70a164e32 100644
--- a/arch/x86/kernel/cpu/perfctr-watchdog.c
+++ b/arch/x86/kernel/cpu/perfctr-watchdog.c
@@ -19,7 +19,7 @@
19#include <linux/nmi.h> 19#include <linux/nmi.h>
20#include <linux/kprobes.h> 20#include <linux/kprobes.h>
21 21
22#include <asm/apic.h> 22#include <asm/genapic.h>
23#include <asm/intel_arch_perfmon.h> 23#include <asm/intel_arch_perfmon.h>
24 24
25struct nmi_watchdog_ctlblk { 25struct nmi_watchdog_ctlblk {
diff --git a/arch/x86/kernel/es7000_32.c b/arch/x86/kernel/es7000_32.c
index 55515d73d9c2..23f1df4ce18e 100644
--- a/arch/x86/kernel/es7000_32.c
+++ b/arch/x86/kernel/es7000_32.c
@@ -806,4 +806,11 @@ struct genapic apic_es7000 = {
806 .smp_callin_clear_local_apic = NULL, 806 .smp_callin_clear_local_apic = NULL,
807 .store_NMI_vector = NULL, 807 .store_NMI_vector = NULL,
808 .inquire_remote_apic = default_inquire_remote_apic, 808 .inquire_remote_apic = default_inquire_remote_apic,
809
810 .read = native_apic_mem_read,
811 .write = native_apic_mem_write,
812 .icr_read = native_apic_icr_read,
813 .icr_write = native_apic_icr_write,
814 .wait_icr_idle = native_apic_wait_icr_idle,
815 .safe_wait_icr_idle = native_safe_apic_wait_icr_idle,
809}; 816};
diff --git a/arch/x86/kernel/genapic_64.c b/arch/x86/kernel/genapic_64.c
index cdc4772d9c87..70b616b4c629 100644
--- a/arch/x86/kernel/genapic_64.c
+++ b/arch/x86/kernel/genapic_64.c
@@ -19,8 +19,8 @@
19#include <linux/dmar.h> 19#include <linux/dmar.h>
20 20
21#include <asm/smp.h> 21#include <asm/smp.h>
22#include <asm/ipi.h>
23#include <asm/genapic.h> 22#include <asm/genapic.h>
23#include <asm/ipi.h>
24#include <asm/setup.h> 24#include <asm/setup.h>
25 25
26extern struct genapic apic_flat; 26extern struct genapic apic_flat;
diff --git a/arch/x86/kernel/genapic_flat_64.c b/arch/x86/kernel/genapic_flat_64.c
index 249d2d3c034c..36ee760fd133 100644
--- a/arch/x86/kernel/genapic_flat_64.c
+++ b/arch/x86/kernel/genapic_flat_64.c
@@ -17,8 +17,8 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/hardirq.h> 18#include <linux/hardirq.h>
19#include <asm/smp.h> 19#include <asm/smp.h>
20#include <asm/ipi.h>
21#include <asm/genapic.h> 20#include <asm/genapic.h>
21#include <asm/ipi.h>
22 22
23#ifdef CONFIG_ACPI 23#ifdef CONFIG_ACPI
24#include <acpi/acpi_bus.h> 24#include <acpi/acpi_bus.h>
@@ -229,6 +229,13 @@ struct genapic apic_flat = {
229 .smp_callin_clear_local_apic = NULL, 229 .smp_callin_clear_local_apic = NULL,
230 .store_NMI_vector = NULL, 230 .store_NMI_vector = NULL,
231 .inquire_remote_apic = NULL, 231 .inquire_remote_apic = NULL,
232
233 .read = native_apic_mem_read,
234 .write = native_apic_mem_write,
235 .icr_read = native_apic_icr_read,
236 .icr_write = native_apic_icr_write,
237 .wait_icr_idle = native_apic_wait_icr_idle,
238 .safe_wait_icr_idle = native_safe_apic_wait_icr_idle,
232}; 239};
233 240
234/* 241/*
@@ -374,4 +381,11 @@ struct genapic apic_physflat = {
374 .smp_callin_clear_local_apic = NULL, 381 .smp_callin_clear_local_apic = NULL,
375 .store_NMI_vector = NULL, 382 .store_NMI_vector = NULL,
376 .inquire_remote_apic = NULL, 383 .inquire_remote_apic = NULL,
384
385 .read = native_apic_mem_read,
386 .write = native_apic_mem_write,
387 .icr_read = native_apic_icr_read,
388 .icr_write = native_apic_icr_write,
389 .wait_icr_idle = native_apic_wait_icr_idle,
390 .safe_wait_icr_idle = native_safe_apic_wait_icr_idle,
377}; 391};
diff --git a/arch/x86/kernel/genx2apic_cluster.c b/arch/x86/kernel/genx2apic_cluster.c
index 7c87156b6411..dd6e8d685426 100644
--- a/arch/x86/kernel/genx2apic_cluster.c
+++ b/arch/x86/kernel/genx2apic_cluster.c
@@ -7,8 +7,8 @@
7#include <linux/dmar.h> 7#include <linux/dmar.h>
8 8
9#include <asm/smp.h> 9#include <asm/smp.h>
10#include <asm/ipi.h>
11#include <asm/genapic.h> 10#include <asm/genapic.h>
11#include <asm/ipi.h>
12 12
13DEFINE_PER_CPU(u32, x86_cpu_to_logical_apicid); 13DEFINE_PER_CPU(u32, x86_cpu_to_logical_apicid);
14 14
@@ -46,7 +46,7 @@ static void
46 /* 46 /*
47 * send the IPI. 47 * send the IPI.
48 */ 48 */
49 x2apic_icr_write(cfg, apicid); 49 native_x2apic_icr_write(cfg, apicid);
50} 50}
51 51
52/* 52/*
@@ -234,4 +234,11 @@ struct genapic apic_x2apic_cluster = {
234 .smp_callin_clear_local_apic = NULL, 234 .smp_callin_clear_local_apic = NULL,
235 .store_NMI_vector = NULL, 235 .store_NMI_vector = NULL,
236 .inquire_remote_apic = NULL, 236 .inquire_remote_apic = NULL,
237
238 .read = native_apic_msr_read,
239 .write = native_apic_msr_write,
240 .icr_read = native_x2apic_icr_read,
241 .icr_write = native_x2apic_icr_write,
242 .wait_icr_idle = native_x2apic_wait_icr_idle,
243 .safe_wait_icr_idle = native_safe_x2apic_wait_icr_idle,
237}; 244};
diff --git a/arch/x86/kernel/genx2apic_phys.c b/arch/x86/kernel/genx2apic_phys.c
index 5cbae8aa0408..eb1486bb002e 100644
--- a/arch/x86/kernel/genx2apic_phys.c
+++ b/arch/x86/kernel/genx2apic_phys.c
@@ -7,8 +7,8 @@
7#include <linux/dmar.h> 7#include <linux/dmar.h>
8 8
9#include <asm/smp.h> 9#include <asm/smp.h>
10#include <asm/ipi.h>
11#include <asm/genapic.h> 10#include <asm/genapic.h>
11#include <asm/ipi.h>
12 12
13static int x2apic_phys; 13static int x2apic_phys;
14 14
@@ -50,7 +50,7 @@ static void __x2apic_send_IPI_dest(unsigned int apicid, int vector,
50 /* 50 /*
51 * send the IPI. 51 * send the IPI.
52 */ 52 */
53 x2apic_icr_write(cfg, apicid); 53 native_x2apic_icr_write(cfg, apicid);
54} 54}
55 55
56static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector) 56static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector)
@@ -220,4 +220,11 @@ struct genapic apic_x2apic_phys = {
220 .smp_callin_clear_local_apic = NULL, 220 .smp_callin_clear_local_apic = NULL,
221 .store_NMI_vector = NULL, 221 .store_NMI_vector = NULL,
222 .inquire_remote_apic = NULL, 222 .inquire_remote_apic = NULL,
223
224 .read = native_apic_msr_read,
225 .write = native_apic_msr_write,
226 .icr_read = native_x2apic_icr_read,
227 .icr_write = native_x2apic_icr_write,
228 .wait_icr_idle = native_x2apic_wait_icr_idle,
229 .safe_wait_icr_idle = native_safe_x2apic_wait_icr_idle,
223}; 230};
diff --git a/arch/x86/kernel/genx2apic_uv_x.c b/arch/x86/kernel/genx2apic_uv_x.c
index 89b84e004f04..9ae4a92fac8c 100644
--- a/arch/x86/kernel/genx2apic_uv_x.c
+++ b/arch/x86/kernel/genx2apic_uv_x.c
@@ -22,8 +22,8 @@
22#include <linux/proc_fs.h> 22#include <linux/proc_fs.h>
23#include <asm/current.h> 23#include <asm/current.h>
24#include <asm/smp.h> 24#include <asm/smp.h>
25#include <asm/ipi.h>
26#include <asm/genapic.h> 25#include <asm/genapic.h>
26#include <asm/ipi.h>
27#include <asm/pgtable.h> 27#include <asm/pgtable.h>
28#include <asm/uv/uv.h> 28#include <asm/uv/uv.h>
29#include <asm/uv/uv_mmrs.h> 29#include <asm/uv/uv_mmrs.h>
@@ -292,6 +292,13 @@ struct genapic apic_x2apic_uv_x = {
292 .smp_callin_clear_local_apic = NULL, 292 .smp_callin_clear_local_apic = NULL,
293 .store_NMI_vector = NULL, 293 .store_NMI_vector = NULL,
294 .inquire_remote_apic = NULL, 294 .inquire_remote_apic = NULL,
295
296 .read = native_apic_msr_read,
297 .write = native_apic_msr_write,
298 .icr_read = native_x2apic_icr_read,
299 .icr_write = native_x2apic_icr_write,
300 .wait_icr_idle = native_x2apic_wait_icr_idle,
301 .safe_wait_icr_idle = native_safe_x2apic_wait_icr_idle,
295}; 302};
296 303
297static __cpuinit void set_x2apic_extra_bits(int pnode) 304static __cpuinit void set_x2apic_extra_bits(int pnode)
diff --git a/arch/x86/kernel/ipi.c b/arch/x86/kernel/ipi.c
index dbf5445727a9..1326272cae43 100644
--- a/arch/x86/kernel/ipi.c
+++ b/arch/x86/kernel/ipi.c
@@ -15,7 +15,7 @@
15#include <asm/mtrr.h> 15#include <asm/mtrr.h>
16#include <asm/tlbflush.h> 16#include <asm/tlbflush.h>
17#include <asm/mmu_context.h> 17#include <asm/mmu_context.h>
18#include <asm/apic.h> 18#include <asm/genapic.h>
19#include <asm/proto.h> 19#include <asm/proto.h>
20#include <asm/ipi.h> 20#include <asm/ipi.h>
21 21
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index f13ca1650aaf..3957776b1930 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -8,7 +8,7 @@
8#include <linux/smp.h> 8#include <linux/smp.h>
9#include <linux/ftrace.h> 9#include <linux/ftrace.h>
10 10
11#include <asm/apic.h> 11#include <asm/genapic.h>
12#include <asm/io_apic.h> 12#include <asm/io_apic.h>
13#include <asm/irq.h> 13#include <asm/irq.h>
14#include <asm/idle.h> 14#include <asm/idle.h>
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
index bdfad80c3cf1..48b9ca5e088c 100644
--- a/arch/x86/kernel/nmi.c
+++ b/arch/x86/kernel/nmi.c
@@ -11,7 +11,7 @@
11 * Mikael Pettersson : PM converted to driver model. Disable/enable API. 11 * Mikael Pettersson : PM converted to driver model. Disable/enable API.
12 */ 12 */
13 13
14#include <asm/apic.h> 14#include <asm/genapic.h>
15 15
16#include <linux/nmi.h> 16#include <linux/nmi.h>
17#include <linux/mm.h> 17#include <linux/mm.h>
diff --git a/arch/x86/kernel/numaq_32.c b/arch/x86/kernel/numaq_32.c
index 0cc41a1d2550..f0f0c2f0596b 100644
--- a/arch/x86/kernel/numaq_32.c
+++ b/arch/x86/kernel/numaq_32.c
@@ -569,4 +569,11 @@ struct genapic apic_numaq = {
569 .smp_callin_clear_local_apic = numaq_smp_callin_clear_local_apic, 569 .smp_callin_clear_local_apic = numaq_smp_callin_clear_local_apic,
570 .store_NMI_vector = numaq_store_NMI_vector, 570 .store_NMI_vector = numaq_store_NMI_vector,
571 .inquire_remote_apic = NULL, 571 .inquire_remote_apic = NULL,
572
573 .read = native_apic_mem_read,
574 .write = native_apic_mem_write,
575 .icr_read = native_apic_icr_read,
576 .icr_write = native_apic_icr_write,
577 .wait_icr_idle = native_apic_wait_icr_idle,
578 .safe_wait_icr_idle = native_safe_apic_wait_icr_idle,
572}; 579};
diff --git a/arch/x86/kernel/probe_32.c b/arch/x86/kernel/probe_32.c
index 22337b75de62..1f701caa95bc 100644
--- a/arch/x86/kernel/probe_32.c
+++ b/arch/x86/kernel/probe_32.c
@@ -127,6 +127,13 @@ struct genapic apic_default = {
127 .smp_callin_clear_local_apic = NULL, 127 .smp_callin_clear_local_apic = NULL,
128 .store_NMI_vector = NULL, 128 .store_NMI_vector = NULL,
129 .inquire_remote_apic = default_inquire_remote_apic, 129 .inquire_remote_apic = default_inquire_remote_apic,
130
131 .read = native_apic_mem_read,
132 .write = native_apic_mem_write,
133 .icr_read = native_apic_icr_read,
134 .icr_write = native_apic_icr_write,
135 .wait_icr_idle = native_apic_wait_icr_idle,
136 .safe_wait_icr_idle = native_safe_apic_wait_icr_idle,
130}; 137};
131 138
132extern struct genapic apic_numaq; 139extern struct genapic apic_numaq;
diff --git a/arch/x86/kernel/summit_32.c b/arch/x86/kernel/summit_32.c
index 1e733eff9b33..1cf32c325d12 100644
--- a/arch/x86/kernel/summit_32.c
+++ b/arch/x86/kernel/summit_32.c
@@ -599,4 +599,11 @@ struct genapic apic_summit = {
599 .smp_callin_clear_local_apic = NULL, 599 .smp_callin_clear_local_apic = NULL,
600 .store_NMI_vector = NULL, 600 .store_NMI_vector = NULL,
601 .inquire_remote_apic = default_inquire_remote_apic, 601 .inquire_remote_apic = default_inquire_remote_apic,
602
603 .read = native_apic_mem_read,
604 .write = native_apic_mem_write,
605 .icr_read = native_apic_icr_read,
606 .icr_write = native_apic_icr_write,
607 .wait_icr_idle = native_apic_wait_icr_idle,
608 .safe_wait_icr_idle = native_safe_apic_wait_icr_idle,
602}; 609};
diff --git a/arch/x86/kernel/uv_irq.c b/arch/x86/kernel/uv_irq.c
index aeef529917e4..75eb5ec5dd2a 100644
--- a/arch/x86/kernel/uv_irq.c
+++ b/arch/x86/kernel/uv_irq.c
@@ -11,7 +11,7 @@
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/irq.h> 12#include <linux/irq.h>
13 13
14#include <asm/apic.h> 14#include <asm/genapic.h>
15#include <asm/uv/uv_irq.h> 15#include <asm/uv/uv_irq.h>
16 16
17static void uv_noop(unsigned int irq) 17static void uv_noop(unsigned int irq)
diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c
index f052c84ecbe4..a1c7b71dc0d0 100644
--- a/arch/x86/kernel/vmi_32.c
+++ b/arch/x86/kernel/vmi_32.c
@@ -32,7 +32,7 @@
32#include <asm/io.h> 32#include <asm/io.h>
33#include <asm/fixmap.h> 33#include <asm/fixmap.h>
34#include <asm/apicdef.h> 34#include <asm/apicdef.h>
35#include <asm/apic.h> 35#include <asm/genapic.h>
36#include <asm/processor.h> 36#include <asm/processor.h>
37#include <asm/timer.h> 37#include <asm/timer.h>
38#include <asm/vmi_time.h> 38#include <asm/vmi_time.h>
@@ -798,8 +798,8 @@ static inline int __init activate_vmi(void)
798#endif 798#endif
799 799
800#ifdef CONFIG_X86_LOCAL_APIC 800#ifdef CONFIG_X86_LOCAL_APIC
801 para_fill(apic_ops->read, APICRead); 801 para_fill(apic->read, APICRead);
802 para_fill(apic_ops->write, APICWrite); 802 para_fill(apic->write, APICWrite);
803#endif 803#endif
804 804
805 /* 805 /*
diff --git a/arch/x86/kernel/vmiclock_32.c b/arch/x86/kernel/vmiclock_32.c
index a4791ef412d1..2a5e0e6a7c0d 100644
--- a/arch/x86/kernel/vmiclock_32.c
+++ b/arch/x86/kernel/vmiclock_32.c
@@ -30,7 +30,7 @@
30#include <asm/vmi_time.h> 30#include <asm/vmi_time.h>
31#include <asm/arch_hooks.h> 31#include <asm/arch_hooks.h>
32#include <asm/apicdef.h> 32#include <asm/apicdef.h>
33#include <asm/apic.h> 33#include <asm/genapic.h>
34#include <asm/timer.h> 34#include <asm/timer.h>
35#include <asm/i8253.h> 35#include <asm/i8253.h>
36#include <asm/irq_vectors.h> 36#include <asm/irq_vectors.h>
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index da2e314f61b5..bc9893f2c383 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -55,7 +55,7 @@
55#include <linux/lguest_launcher.h> 55#include <linux/lguest_launcher.h>
56#include <linux/virtio_console.h> 56#include <linux/virtio_console.h>
57#include <linux/pm.h> 57#include <linux/pm.h>
58#include <asm/apic.h> 58#include <asm/genapic.h>
59#include <asm/lguest.h> 59#include <asm/lguest.h>
60#include <asm/paravirt.h> 60#include <asm/paravirt.h>
61#include <asm/param.h> 61#include <asm/param.h>
@@ -828,13 +828,14 @@ static u32 lguest_apic_safe_wait_icr_idle(void)
828 return 0; 828 return 0;
829} 829}
830 830
831static struct apic_ops lguest_basic_apic_ops = { 831static void set_lguest_basic_apic_ops(void)
832 .read = lguest_apic_read, 832{
833 .write = lguest_apic_write, 833 apic->read = lguest_apic_read;
834 .icr_read = lguest_apic_icr_read, 834 apic->write = lguest_apic_write;
835 .icr_write = lguest_apic_icr_write, 835 apic->icr_read = lguest_apic_icr_read;
836 .wait_icr_idle = lguest_apic_wait_icr_idle, 836 apic->icr_write = lguest_apic_icr_write;
837 .safe_wait_icr_idle = lguest_apic_safe_wait_icr_idle, 837 apic->wait_icr_idle = lguest_apic_wait_icr_idle;
838 apic->safe_wait_icr_idle = lguest_apic_safe_wait_icr_idle;
838}; 839};
839#endif 840#endif
840 841
@@ -1035,7 +1036,7 @@ __init void lguest_init(void)
1035 1036
1036#ifdef CONFIG_X86_LOCAL_APIC 1037#ifdef CONFIG_X86_LOCAL_APIC
1037 /* apic read/write intercepts */ 1038 /* apic read/write intercepts */
1038 apic_ops = &lguest_basic_apic_ops; 1039 set_lguest_basic_apic_ops();
1039#endif 1040#endif
1040 1041
1041 /* time operations */ 1042 /* time operations */
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 95ff6a0e942a..e3dd3fb67290 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -36,7 +36,7 @@
36#include <xen/hvc-console.h> 36#include <xen/hvc-console.h>
37 37
38#include <asm/paravirt.h> 38#include <asm/paravirt.h>
39#include <asm/apic.h> 39#include <asm/genapic.h>
40#include <asm/page.h> 40#include <asm/page.h>
41#include <asm/xen/hypercall.h> 41#include <asm/xen/hypercall.h>
42#include <asm/xen/hypervisor.h> 42#include <asm/xen/hypervisor.h>
@@ -554,14 +554,15 @@ static u32 xen_safe_apic_wait_icr_idle(void)
554 return 0; 554 return 0;
555} 555}
556 556
557static struct apic_ops xen_basic_apic_ops = { 557static void set_xen_basic_apic_ops(void)
558 .read = xen_apic_read, 558{
559 .write = xen_apic_write, 559 apic->read = xen_apic_read;
560 .icr_read = xen_apic_icr_read, 560 apic->write = xen_apic_write;
561 .icr_write = xen_apic_icr_write, 561 apic->icr_read = xen_apic_icr_read;
562 .wait_icr_idle = xen_apic_wait_icr_idle, 562 apic->icr_write = xen_apic_icr_write;
563 .safe_wait_icr_idle = xen_safe_apic_wait_icr_idle, 563 apic->wait_icr_idle = xen_apic_wait_icr_idle;
564}; 564 apic->safe_wait_icr_idle = xen_safe_apic_wait_icr_idle;
565}
565 566
566#endif 567#endif
567 568
@@ -898,7 +899,7 @@ asmlinkage void __init xen_start_kernel(void)
898 /* 899 /*
899 * set up the basic apic ops. 900 * set up the basic apic ops.
900 */ 901 */
901 apic_ops = &xen_basic_apic_ops; 902 set_xen_basic_apic_ops();
902#endif 903#endif
903 904
904 if (xen_feature(XENFEAT_mmu_pt_update_preserve_ad)) { 905 if (xen_feature(XENFEAT_mmu_pt_update_preserve_ad)) {