]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/suse-2.6.27.25/patches.xen/xen-x86-no-lapic
Updated xen patches taken from suse.
[people/teissler/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.xen / xen-x86-no-lapic
1 From: jbeulich@novell.com
2 Subject: Disallow all accesses to the local APIC page
3 Patch-mainline: obsolete
4 References: 191115
5
6 --- sle11-2009-06-04.orig/arch/x86/kernel/Makefile 2009-06-04 10:47:37.000000000 +0200
7 +++ sle11-2009-06-04/arch/x86/kernel/Makefile 2009-06-04 10:47:37.000000000 +0200
8 @@ -120,9 +120,11 @@ ifeq ($(CONFIG_X86_64),y)
9
10 obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o
11
12 + apic_64-$(CONFIG_XEN) += apic_32.o
13 time_64-$(CONFIG_XEN) += time_32.o
14 endif
15
16 -disabled-obj-$(CONFIG_XEN) := %_uv.o crash.o early-quirks.o hpet.o i8253.o \
17 - i8259.o irqinit_$(BITS).o pci-swiotlb_64.o reboot.o smpboot.o \
18 - tlb_$(BITS).o tsc.o tsc_sync.o uv_%.o vsmp_64.o
19 +disabled-obj-$(CONFIG_XEN) := %_uv.o crash.o early-quirks.o genapic_flat_64.o \
20 + genx2apic_%.o hpet.o i8253.o i8259.o irqinit_$(BITS).o \
21 + pci-swiotlb_64.o reboot.o smpboot.o tlb_$(BITS).o tsc.o tsc_sync.o \
22 + uv_%.o vsmp_64.o
23 --- sle11-2009-06-04.orig/arch/x86/kernel/acpi/boot.c 2009-06-04 10:21:39.000000000 +0200
24 +++ sle11-2009-06-04/arch/x86/kernel/acpi/boot.c 2009-06-04 10:47:37.000000000 +0200
25 @@ -89,7 +89,7 @@ int acpi_sci_override_gsi __initdata;
26 int acpi_skip_timer_override __initdata;
27 int acpi_use_timer_override __initdata;
28
29 -#ifdef CONFIG_X86_LOCAL_APIC
30 +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN)
31 static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
32 #endif
33
34 @@ -237,12 +237,14 @@ static int __init acpi_parse_madt(struct
35 return -ENODEV;
36 }
37
38 +#ifndef CONFIG_XEN
39 if (madt->address) {
40 acpi_lapic_addr = (u64) madt->address;
41
42 printk(KERN_DEBUG PREFIX "Local APIC address 0x%08x\n",
43 madt->address);
44 }
45 +#endif
46
47 acpi_madt_oem_check(madt->header.oem_id, madt->header.oem_table_id);
48
49 @@ -317,6 +319,7 @@ static int __init
50 acpi_parse_lapic_addr_ovr(struct acpi_subtable_header * header,
51 const unsigned long end)
52 {
53 +#ifndef CONFIG_XEN
54 struct acpi_madt_local_apic_override *lapic_addr_ovr = NULL;
55
56 lapic_addr_ovr = (struct acpi_madt_local_apic_override *)header;
57 @@ -325,6 +328,7 @@ acpi_parse_lapic_addr_ovr(struct acpi_su
58 return -EINVAL;
59
60 acpi_lapic_addr = lapic_addr_ovr->address;
61 +#endif
62
63 return 0;
64 }
65 @@ -904,10 +908,12 @@ static int mp_find_ioapic(int gsi)
66 static u8 __init uniq_ioapic_id(u8 id)
67 {
68 #ifdef CONFIG_X86_32
69 +#ifndef CONFIG_XEN
70 if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) &&
71 !APIC_XAPIC(apic_version[boot_cpu_physical_apicid]))
72 return io_apic_get_unique_id(nr_ioapics, id);
73 else
74 +#endif
75 return id;
76 #else
77 int i;
78 @@ -1139,7 +1145,7 @@ int mp_register_gsi(u32 gsi, int trigger
79
80 ioapic_pin = gsi - mp_ioapic_routing[ioapic].gsi_base;
81
82 -#ifdef CONFIG_X86_32
83 +#if defined(CONFIG_X86_32) && !defined(CONFIG_XEN)
84 if (ioapic_renumber_irq)
85 gsi = ioapic_renumber_irq(ioapic, gsi);
86 #endif
87 --- sle11-2009-06-04.orig/arch/x86/kernel/apic_32-xen.c 2009-06-04 10:21:39.000000000 +0200
88 +++ sle11-2009-06-04/arch/x86/kernel/apic_32-xen.c 2009-06-04 10:47:37.000000000 +0200
89 @@ -1,60 +1,11 @@
90 /*
91 - * Local APIC handling, local APIC timers
92 - *
93 - * (c) 1999, 2000 Ingo Molnar <mingo@redhat.com>
94 - *
95 - * Fixes
96 - * Maciej W. Rozycki : Bits for genuine 82489DX APICs;
97 - * thanks to Eric Gilmore
98 - * and Rolf G. Tews
99 - * for testing these extensively.
100 - * Maciej W. Rozycki : Various updates and fixes.
101 - * Mikael Pettersson : Power Management for UP-APIC.
102 - * Pavel Machek and
103 - * Mikael Pettersson : PM converted to driver model.
104 + * Local APIC handling stubs
105 */
106
107 #include <linux/init.h>
108 -
109 -#include <linux/mm.h>
110 -#include <linux/delay.h>
111 -#include <linux/bootmem.h>
112 #include <linux/interrupt.h>
113 -#include <linux/mc146818rtc.h>
114 -#include <linux/kernel_stat.h>
115 -#include <linux/sysdev.h>
116 -#include <linux/cpu.h>
117 -#include <linux/clockchips.h>
118 -#include <linux/acpi_pmtmr.h>
119 -#include <linux/module.h>
120
121 -#include <asm/atomic.h>
122 #include <asm/smp.h>
123 -#include <asm/mtrr.h>
124 -#include <asm/mpspec.h>
125 -#include <asm/desc.h>
126 -#include <asm/arch_hooks.h>
127 -#include <asm/hpet.h>
128 -#include <asm/i8253.h>
129 -#include <asm/nmi.h>
130 -
131 -#include <mach_apic.h>
132 -#include <mach_apicdef.h>
133 -#include <mach_ipi.h>
134 -
135 -#include "io_ports.h"
136 -
137 -#ifndef CONFIG_XEN
138 -/*
139 - * cpu_mask that denotes the CPUs that needs timer interrupt coming in as
140 - * IPIs in place of local APIC timers
141 - */
142 -static cpumask_t timer_bcast_ipi;
143 -#endif
144 -
145 -/*
146 - * Knob to control our willingness to enable the local APIC.
147 - */
148
149 /*
150 * Debug level, exported for io_apic.c
151 @@ -64,33 +15,32 @@ unsigned int apic_verbosity;
152 /* Have we found an MP table */
153 int smp_found_config;
154
155 -#ifndef CONFIG_XEN
156 -static int modern_apic(void)
157 +static int __init apic_set_verbosity(char *str)
158 {
159 - /* AMD systems use old APIC versions, so check the CPU */
160 - if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
161 - boot_cpu_data.x86 >= 0xf)
162 - return 1;
163 - return lapic_get_version() >= 0x14;
164 + if (strcmp("debug", str) == 0)
165 + apic_verbosity = APIC_DEBUG;
166 + else if (strcmp("verbose", str) == 0)
167 + apic_verbosity = APIC_VERBOSE;
168 + return 1;
169 }
170 -#endif /* !CONFIG_XEN */
171
172 -int get_physical_broadcast(void)
173 -{
174 - return 0xff;
175 -}
176 +__setup("apic=", apic_set_verbosity);
177
178 int setup_profiling_timer(unsigned int multiplier)
179 {
180 return -EINVAL;
181 }
182
183 +#ifndef CONFIG_SMP
184 /*
185 * This initializes the IO-APIC and APIC hardware if this is
186 * a UP kernel.
187 */
188 int __init APIC_init_uniprocessor(void)
189 {
190 + if (!cpu_has_apic)
191 + return -1;
192 +
193 #ifdef CONFIG_X86_IO_APIC
194 if (smp_found_config)
195 if (!skip_ioapic_setup && nr_ioapics)
196 @@ -99,3 +49,4 @@ int __init APIC_init_uniprocessor(void)
197
198 return 0;
199 }
200 +#endif
201 --- sle11-2009-06-04.orig/arch/x86/kernel/apic_64-xen.c 2009-06-04 10:21:39.000000000 +0200
202 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000
203 @@ -1,188 +0,0 @@
204 -/*
205 - * Local APIC handling, local APIC timers
206 - *
207 - * (c) 1999, 2000 Ingo Molnar <mingo@redhat.com>
208 - *
209 - * Fixes
210 - * Maciej W. Rozycki : Bits for genuine 82489DX APICs;
211 - * thanks to Eric Gilmore
212 - * and Rolf G. Tews
213 - * for testing these extensively.
214 - * Maciej W. Rozycki : Various updates and fixes.
215 - * Mikael Pettersson : Power Management for UP-APIC.
216 - * Pavel Machek and
217 - * Mikael Pettersson : PM converted to driver model.
218 - */
219 -
220 -#include <linux/init.h>
221 -
222 -#include <linux/mm.h>
223 -#include <linux/delay.h>
224 -#include <linux/bootmem.h>
225 -#include <linux/interrupt.h>
226 -#include <linux/mc146818rtc.h>
227 -#include <linux/kernel_stat.h>
228 -#include <linux/sysdev.h>
229 -#include <linux/module.h>
230 -
231 -#include <asm/atomic.h>
232 -#include <asm/smp.h>
233 -#include <asm/mtrr.h>
234 -#include <asm/mpspec.h>
235 -#include <asm/desc.h>
236 -#include <asm/arch_hooks.h>
237 -#include <asm/hpet.h>
238 -#include <asm/idle.h>
239 -
240 -int disable_apic;
241 -
242 -/*
243 - * Debug level, exported for io_apic.c
244 - */
245 -unsigned int apic_verbosity;
246 -
247 -/* Have we found an MP table */
248 -int smp_found_config;
249 -
250 -/*
251 - * The guts of the apic timer interrupt
252 - */
253 -static void local_apic_timer_interrupt(void)
254 -{
255 -#ifndef CONFIG_XEN
256 - int cpu = smp_processor_id();
257 - struct clock_event_device *evt = &per_cpu(lapic_events, cpu);
258 -
259 - /*
260 - * Normally we should not be here till LAPIC has been initialized but
261 - * in some cases like kdump, its possible that there is a pending LAPIC
262 - * timer interrupt from previous kernel's context and is delivered in
263 - * new kernel the moment interrupts are enabled.
264 - *
265 - * Interrupts are enabled early and LAPIC is setup much later, hence
266 - * its possible that when we get here evt->event_handler is NULL.
267 - * Check for event_handler being NULL and discard the interrupt as
268 - * spurious.
269 - */
270 - if (!evt->event_handler) {
271 - printk(KERN_WARNING
272 - "Spurious LAPIC timer interrupt on cpu %d\n", cpu);
273 - /* Switch it off */
274 - lapic_timer_setup(CLOCK_EVT_MODE_SHUTDOWN, evt);
275 - return;
276 - }
277 -#endif
278 -
279 - /*
280 - * the NMI deadlock-detector uses this.
281 - */
282 - add_pda(apic_timer_irqs, 1);
283 -
284 -#ifndef CONFIG_XEN
285 - evt->event_handler(evt);
286 -#endif
287 -}
288 -
289 -/*
290 - * Local APIC timer interrupt. This is the most natural way for doing
291 - * local interrupts, but local timer interrupts can be emulated by
292 - * broadcast interrupts too. [in case the hw doesn't support APIC timers]
293 - *
294 - * [ if a single-CPU system runs an SMP kernel then we call the local
295 - * interrupt as well. Thus we cannot inline the local irq ... ]
296 - */
297 -void smp_apic_timer_interrupt(struct pt_regs *regs)
298 -{
299 - struct pt_regs *old_regs = set_irq_regs(regs);
300 -
301 - /*
302 - * NOTE! We'd better ACK the irq immediately,
303 - * because timer handling can be slow.
304 - */
305 - ack_APIC_irq();
306 - /*
307 - * update_process_times() expects us to have done irq_enter().
308 - * Besides, if we don't timer interrupts ignore the global
309 - * interrupt lock, which is the WrongThing (tm) to do.
310 - */
311 - exit_idle();
312 - irq_enter();
313 - local_apic_timer_interrupt();
314 - irq_exit();
315 - set_irq_regs(old_regs);
316 -}
317 -
318 -int setup_profiling_timer(unsigned int multiplier)
319 -{
320 - return -EINVAL;
321 -}
322 -
323 -/*
324 - * This initializes the IO-APIC and APIC hardware if this is
325 - * a UP kernel.
326 - */
327 -int __init APIC_init_uniprocessor(void)
328 -{
329 -#ifdef CONFIG_X86_IO_APIC
330 - if (smp_found_config && !skip_ioapic_setup && nr_ioapics)
331 - setup_IO_APIC();
332 -#endif
333 -
334 - return 1;
335 -}
336 -
337 -/*
338 - * Local APIC interrupts
339 - */
340 -
341 -/*
342 - * This interrupt should _never_ happen with our APIC/SMP architecture
343 - */
344 -asmlinkage void smp_spurious_interrupt(void)
345 -{
346 - unsigned int v;
347 - exit_idle();
348 - irq_enter();
349 - /*
350 - * Check if this really is a spurious interrupt and ACK it
351 - * if it is a vectored one. Just in case...
352 - * Spurious interrupts should not be ACKed.
353 - */
354 - v = apic_read(APIC_ISR + ((SPURIOUS_APIC_VECTOR & ~0x1f) >> 1));
355 - if (v & (1 << (SPURIOUS_APIC_VECTOR & 0x1f)))
356 - ack_APIC_irq();
357 -
358 - add_pda(irq_spurious_count, 1);
359 - irq_exit();
360 -}
361 -
362 -/*
363 - * This interrupt should never happen with our APIC/SMP architecture
364 - */
365 -asmlinkage void smp_error_interrupt(void)
366 -{
367 - unsigned int v, v1;
368 -
369 - exit_idle();
370 - irq_enter();
371 - /* First tickle the hardware, only then report what went on. -- REW */
372 - v = apic_read(APIC_ESR);
373 - apic_write(APIC_ESR, 0);
374 - v1 = apic_read(APIC_ESR);
375 - ack_APIC_irq();
376 - atomic_inc(&irq_err_count);
377 -
378 - /* Here is what the APIC error bits mean:
379 - 0: Send CS error
380 - 1: Receive CS error
381 - 2: Send accept error
382 - 3: Receive accept error
383 - 4: Reserved
384 - 5: Send illegal vector
385 - 6: Received illegal vector
386 - 7: Illegal register address
387 - */
388 - printk (KERN_DEBUG "APIC error on CPU%d: %02x(%02x)\n",
389 - smp_processor_id(), v , v1);
390 - irq_exit();
391 -}
392 --- sle11-2009-06-04.orig/arch/x86/kernel/cpu/common-xen.c 2009-06-04 10:46:36.000000000 +0200
393 +++ sle11-2009-06-04/arch/x86/kernel/cpu/common-xen.c 2009-06-04 10:47:37.000000000 +0200
394 @@ -19,10 +19,6 @@
395 #include <asm/mpspec.h>
396 #include <asm/apic.h>
397 #include <mach_apic.h>
398 -#else
399 -#ifdef CONFIG_XEN
400 -#define phys_pkg_id(a,b) a
401 -#endif
402 #endif
403 #include <asm/hypervisor.h>
404
405 --- sle11-2009-06-04.orig/arch/x86/kernel/genapic_64-xen.c 2009-06-04 10:46:28.000000000 +0200
406 +++ sle11-2009-06-04/arch/x86/kernel/genapic_64-xen.c 2009-06-04 10:47:37.000000000 +0200
407 @@ -18,7 +18,6 @@
408 #include <linux/hardirq.h>
409
410 #include <asm/smp.h>
411 -#include <asm/ipi.h>
412 #include <asm/genapic.h>
413
414 #ifdef CONFIG_ACPI
415 --- sle11-2009-06-04.orig/arch/x86/kernel/genapic_xen_64.c 2009-06-04 10:47:21.000000000 +0200
416 +++ sle11-2009-06-04/arch/x86/kernel/genapic_xen_64.c 2009-06-04 10:47:37.000000000 +0200
417 @@ -18,7 +18,6 @@
418 #include <linux/init.h>
419 #ifdef CONFIG_XEN_PRIVILEGED_GUEST
420 #include <asm/smp.h>
421 -#include <asm/ipi.h>
422 #else
423 #include <asm/apic.h>
424 #endif
425 @@ -78,20 +77,6 @@ static const cpumask_t *xen_target_cpus(
426 return &cpu_online_map;
427 }
428
429 -static void xen_vector_allocation_domain(int cpu, cpumask_t *retmask)
430 -{
431 - cpus_clear(*retmask);
432 - cpu_set(cpu, *retmask);
433 -}
434 -
435 -/*
436 - * Set up the logical destination ID.
437 - * Do nothing, not called now.
438 - */
439 -static void xen_init_apic_ldr(void)
440 -{
441 -}
442 -
443 static void xen_send_IPI_mask(const cpumask_t *cpumask, int vector)
444 {
445 xen_send_IPI_shortcut(APIC_DEST_ALLINC, cpumask, vector);
446 @@ -118,17 +103,9 @@ static void xen_send_IPI_self(int vector
447 xen_send_IPI_shortcut(APIC_DEST_SELF, NULL, vector);
448 }
449
450 -#ifdef CONFIG_XEN_PRIVILEGED_GUEST
451 -static int xen_apic_id_registered(void)
452 -{
453 - /* better be set */
454 - return physid_isset(smp_processor_id(), phys_cpu_present_map);
455 -}
456 -#endif
457 -
458 static unsigned int xen_cpu_mask_to_apicid(const cpumask_t *cpumask)
459 {
460 - return cpus_addr(*cpumask)[0] & APIC_ALL_CPUS;
461 + return cpus_addr(*cpumask)[0];
462 }
463
464 static unsigned int phys_pkg_id(int index_msb)
465 @@ -144,13 +121,8 @@ struct genapic apic_xen = {
466 #ifdef CONFIG_XEN_PRIVILEGED_GUEST
467 .int_delivery_mode = dest_LowestPrio,
468 #endif
469 - .int_dest_mode = (APIC_DEST_LOGICAL != 0),
470 + .int_dest_mode = 1,
471 .target_cpus = xen_target_cpus,
472 - .vector_allocation_domain = xen_vector_allocation_domain,
473 -#ifdef CONFIG_XEN_PRIVILEGED_GUEST
474 - .apic_id_registered = xen_apic_id_registered,
475 -#endif
476 - .init_apic_ldr = xen_init_apic_ldr,
477 .send_IPI_all = xen_send_IPI_all,
478 .send_IPI_allbutself = xen_send_IPI_allbutself,
479 .send_IPI_mask = xen_send_IPI_mask,
480 --- sle11-2009-06-04.orig/arch/x86/kernel/io_apic_32-xen.c 2009-06-04 10:46:34.000000000 +0200
481 +++ sle11-2009-06-04/arch/x86/kernel/io_apic_32-xen.c 2009-06-04 10:47:37.000000000 +0200
482 @@ -48,7 +48,6 @@
483 #include <asm/hypertransport.h>
484
485 #include <mach_apic.h>
486 -#include <mach_apicdef.h>
487
488 #ifdef CONFIG_XEN
489 #include <xen/interface/xen.h>
490 @@ -63,20 +62,20 @@
491 unsigned long io_apic_irqs;
492
493 #define clear_IO_APIC() ((void)0)
494 -#endif /* CONFIG_XEN */
495 -
496 +#else
497 int (*ioapic_renumber_irq)(int ioapic, int irq);
498 atomic_t irq_mis_count;
499
500 -#ifndef CONFIG_XEN
501 /* Where if anywhere is the i8259 connect in external int mode */
502 static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };
503 -#endif
504 +#endif /* CONFIG_XEN */
505
506 static DEFINE_SPINLOCK(ioapic_lock);
507 static DEFINE_SPINLOCK(vector_lock);
508
509 +#ifndef CONFIG_XEN
510 int timer_through_8259 __initdata;
511 +#endif
512
513 /*
514 * Is the SiS APIC rmw bug present ?
515 @@ -105,7 +104,9 @@ int mp_bus_id_to_type[MAX_MP_BUSSES];
516
517 DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
518
519 +#ifndef CONFIG_XEN
520 static int disable_timer_pin_1 __initdata;
521 +#endif
522
523 /*
524 * Rough estimation of how many shared IRQs there are, can
525 @@ -1177,11 +1178,13 @@ static int pin_2_irq(int idx, int apic,
526 irq += nr_ioapic_registers[i++];
527 irq += pin;
528
529 +#ifndef CONFIG_XEN
530 /*
531 * For MPS mode, so far only needed by ES7000 platform
532 */
533 if (ioapic_renumber_irq)
534 irq = ioapic_renumber_irq(apic, irq);
535 +#endif
536 }
537
538 /*
539 @@ -2933,6 +2936,7 @@ int acpi_get_override_irq(int bus_irq, i
540
541 #endif /* CONFIG_ACPI */
542
543 +#ifndef CONFIG_XEN
544 static int __init parse_disable_timer_pin_1(char *arg)
545 {
546 disable_timer_pin_1 = 1;
547 @@ -2946,6 +2950,7 @@ static int __init parse_enable_timer_pin
548 return 0;
549 }
550 early_param("enable_timer_pin_1", parse_enable_timer_pin_1);
551 +#endif
552
553 static int __init parse_noapic(char *arg)
554 {
555 --- sle11-2009-06-04.orig/arch/x86/kernel/io_apic_64-xen.c 2009-06-04 10:46:34.000000000 +0200
556 +++ sle11-2009-06-04/arch/x86/kernel/io_apic_64-xen.c 2009-06-04 10:47:37.000000000 +0200
557 @@ -78,10 +78,6 @@ char system_vectors[NR_VECTORS] = { [0 .
558
559 int sis_apic_bug; /* not actually supported, dummy for compile */
560
561 -static int no_timer_check;
562 -
563 -static int disable_timer_pin_1 __initdata;
564 -
565 #ifdef CONFIG_XEN
566 #include <xen/interface/xen.h>
567 #include <xen/interface/physdev.h>
568 @@ -96,6 +92,10 @@ unsigned long io_apic_irqs;
569
570 #define clear_IO_APIC() ((void)0)
571 #else
572 +static int no_timer_check;
573 +
574 +static int disable_timer_pin_1 __initdata;
575 +
576 int timer_through_8259 __initdata;
577
578 /* Where if anywhere is the i8259 connect in external int mode */
579 @@ -487,6 +487,7 @@ static int __init parse_noapic(char *str
580 }
581 early_param("noapic", parse_noapic);
582
583 +#ifndef CONFIG_XEN
584 /* Actually the next is obsolete, but keep it for paranoid reasons -AK */
585 static int __init disable_timer_pin_setup(char *arg)
586 {
587 @@ -494,6 +495,7 @@ static int __init disable_timer_pin_setu
588 return 1;
589 }
590 __setup("disable_timer_pin_1", disable_timer_pin_setup);
591 +#endif
592
593
594 /*
595 @@ -1820,10 +1822,6 @@ static inline void __init check_timer(vo
596 out:
597 local_irq_restore(flags);
598 }
599 -#else
600 -#define check_timer() ((void)0)
601 -int timer_uses_ioapic_pin_0 = 0;
602 -#endif /* !CONFIG_XEN */
603
604 static int __init notimercheck(char *s)
605 {
606 @@ -1831,6 +1829,10 @@ static int __init notimercheck(char *s)
607 return 1;
608 }
609 __setup("no_timer_check", notimercheck);
610 +#else
611 +#define check_timer() ((void)0)
612 +int timer_uses_ioapic_pin_0 = 0;
613 +#endif /* !CONFIG_XEN */
614
615 /*
616 *
617 --- sle11-2009-06-04.orig/arch/x86/kernel/irq_32-xen.c 2009-06-04 10:47:21.000000000 +0200
618 +++ sle11-2009-06-04/arch/x86/kernel/irq_32-xen.c 2009-06-04 10:47:37.000000000 +0200
619 @@ -252,7 +252,9 @@ unsigned int do_IRQ(struct pt_regs *regs
620 * Interrupt statistics:
621 */
622
623 +#ifndef CONFIG_XEN
624 atomic_t irq_err_count;
625 +#endif
626
627 /*
628 * /proc/interrupts printing:
629 @@ -308,7 +310,7 @@ skip:
630 for_each_online_cpu(j)
631 seq_printf(p, "%10u ", nmi_count(j));
632 seq_printf(p, " Non-maskable interrupts\n");
633 -#ifdef CONFIG_X86_LOCAL_APIC
634 +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN)
635 seq_printf(p, "LOC: ");
636 for_each_online_cpu(j)
637 seq_printf(p, "%10u ",
638 @@ -341,6 +343,7 @@ skip:
639 per_cpu(irq_stat,j).irq_thermal_count);
640 seq_printf(p, " Thermal event interrupts\n");
641 #endif
642 +#ifndef CONFIG_XEN
643 #ifdef CONFIG_X86_LOCAL_APIC
644 seq_printf(p, "SPU: ");
645 for_each_online_cpu(j)
646 @@ -352,6 +355,7 @@ skip:
647 #if defined(CONFIG_X86_IO_APIC)
648 seq_printf(p, "MIS: %10u\n", atomic_read(&irq_mis_count));
649 #endif
650 +#endif
651 }
652 return 0;
653 }
654 @@ -384,12 +388,16 @@ u64 arch_irq_stat_cpu(unsigned int cpu)
655
656 u64 arch_irq_stat(void)
657 {
658 +#ifndef CONFIG_XEN
659 u64 sum = atomic_read(&irq_err_count);
660
661 #ifdef CONFIG_X86_IO_APIC
662 sum += atomic_read(&irq_mis_count);
663 #endif
664 return sum;
665 +#else
666 + return 0;
667 +#endif
668 }
669
670 #ifdef CONFIG_HOTPLUG_CPU
671 --- sle11-2009-06-04.orig/arch/x86/kernel/irq_64-xen.c 2009-06-04 10:47:21.000000000 +0200
672 +++ sle11-2009-06-04/arch/x86/kernel/irq_64-xen.c 2009-06-04 10:47:37.000000000 +0200
673 @@ -18,7 +18,9 @@
674 #include <asm/idle.h>
675 #include <asm/smp.h>
676
677 +#ifndef CONFIG_XEN
678 atomic_t irq_err_count;
679 +#endif
680
681 /*
682 * 'what should we do if we get a hw irq event on an illegal vector'.
683 @@ -27,19 +29,6 @@ atomic_t irq_err_count;
684 void ack_bad_irq(unsigned int irq)
685 {
686 printk(KERN_WARNING "unexpected IRQ trap at irq %02x\n", irq);
687 -#ifdef CONFIG_X86_LOCAL_APIC
688 - /*
689 - * Currently unexpected vectors happen only on SMP and APIC.
690 - * We _must_ ack these because every local APIC has only N
691 - * irq slots per priority level, and a 'hanging, unacked' IRQ
692 - * holds up an irq slot - in excessive cases (when multiple
693 - * unexpected vectors occur) that might lock up the APIC
694 - * completely.
695 - * But don't ack when the APIC is disabled. -AK
696 - */
697 - if (!disable_apic)
698 - ack_APIC_irq();
699 -#endif
700 }
701
702 #ifdef CONFIG_DEBUG_STACKOVERFLOW
703 @@ -119,7 +108,7 @@ skip:
704 for_each_online_cpu(j)
705 seq_printf(p, "%10u ", cpu_pda(j)->__nmi_count);
706 seq_printf(p, " Non-maskable interrupts\n");
707 -#ifdef CONFIG_X86_LOCAL_APIC
708 +#ifndef CONFIG_XEN
709 seq_printf(p, "LOC: ");
710 for_each_online_cpu(j)
711 seq_printf(p, "%10u ", cpu_pda(j)->apic_timer_irqs);
712 @@ -151,13 +140,13 @@ skip:
713 seq_printf(p, "%10u ", cpu_pda(j)->irq_threshold_count);
714 seq_printf(p, " Threshold APIC interrupts\n");
715 #endif
716 -#ifdef CONFIG_X86_LOCAL_APIC
717 +#ifndef CONFIG_XEN
718 seq_printf(p, "SPU: ");
719 for_each_online_cpu(j)
720 seq_printf(p, "%10u ", cpu_pda(j)->irq_spurious_count);
721 seq_printf(p, " Spurious interrupts\n");
722 -#endif
723 seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
724 +#endif
725 }
726 return 0;
727 }
728 @@ -187,7 +176,11 @@ u64 arch_irq_stat_cpu(unsigned int cpu)
729
730 u64 arch_irq_stat(void)
731 {
732 +#ifndef CONFIG_XEN
733 return atomic_read(&irq_err_count);
734 +#else
735 + return 0;
736 +#endif
737 }
738
739 /*
740 --- sle11-2009-06-04.orig/arch/x86/kernel/mpparse-xen.c 2009-06-04 10:21:39.000000000 +0200
741 +++ sle11-2009-06-04/arch/x86/kernel/mpparse-xen.c 2009-06-04 10:47:37.000000000 +0200
742 @@ -31,7 +31,6 @@
743
744 #include <mach_apic.h>
745 #ifdef CONFIG_X86_32
746 -#include <mach_apicdef.h>
747 #include <mach_mpparse.h>
748 #endif
749
750 @@ -287,7 +286,9 @@ static int __init smp_check_mpc(struct m
751
752 printk(KERN_INFO "MPTABLE: Product ID: %s\n", str);
753
754 +#ifndef CONFIG_XEN
755 printk(KERN_INFO "MPTABLE: APIC at: 0x%X\n", mpc->mpc_lapic);
756 +#endif
757
758 return 1;
759 }
760 @@ -315,9 +316,11 @@ static int __init smp_read_mpc(struct mp
761 } else
762 mps_oem_check(mpc, oem, str);
763 #endif
764 +#ifndef CONFIG_XEN
765 /* save the local APIC address, it might be non-default */
766 if (!acpi_lapic)
767 mp_lapic_addr = mpc->mpc_lapic;
768 +#endif
769
770 if (early)
771 return 1;
772 @@ -548,10 +551,12 @@ static inline void __init construct_defa
773 int linttypes[2] = { mp_ExtINT, mp_NMI };
774 int i;
775
776 +#ifndef CONFIG_XEN
777 /*
778 * local APIC has default address
779 */
780 mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
781 +#endif
782
783 /*
784 * 2 CPUs, numbered 0 & 1.
785 @@ -627,10 +632,12 @@ static void __init __get_smp_config(unsi
786 */
787 if (mpf->mpf_feature1 != 0) {
788 if (early) {
789 +#ifndef CONFIG_XEN
790 /*
791 * local APIC has default address
792 */
793 mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
794 +#endif
795 return;
796 }
797
798 --- sle11-2009-06-04.orig/arch/x86/kernel/traps_64-xen.c 2009-06-04 10:47:37.000000000 +0200
799 +++ sle11-2009-06-04/arch/x86/kernel/traps_64-xen.c 2009-06-04 10:47:37.000000000 +0200
800 @@ -1174,15 +1174,15 @@ asmlinkage void do_spurious_interrupt_bu
801 {
802 }
803
804 -#if 0
805 +#ifndef CONFIG_XEN
806 asmlinkage void __attribute__((weak)) smp_thermal_interrupt(void)
807 {
808 }
809 -#endif
810
811 asmlinkage void __attribute__((weak)) mce_threshold_interrupt(void)
812 {
813 }
814 +#endif
815
816 /*
817 * 'math_state_restore()' saves the current math information in the
818 --- sle11-2009-06-04.orig/drivers/xen/core/smpboot.c 2009-06-04 10:47:28.000000000 +0200
819 +++ sle11-2009-06-04/drivers/xen/core/smpboot.c 2009-06-04 10:47:37.000000000 +0200
820 @@ -346,7 +346,7 @@ void __init smp_prepare_cpus(unsigned in
821 * Here we can be sure that there is an IO-APIC in the system. Let's
822 * go and set it up:
823 */
824 - if (!skip_ioapic_setup && nr_ioapics)
825 + if (cpu_has_apic && !skip_ioapic_setup && nr_ioapics)
826 setup_IO_APIC();
827 #endif
828 }
829 --- sle11-2009-06-04.orig/include/asm-x86/apic.h 2009-06-04 10:18:34.000000000 +0200
830 +++ sle11-2009-06-04/include/asm-x86/apic.h 2009-06-04 10:47:37.000000000 +0200
831 @@ -5,7 +5,9 @@
832 #include <linux/delay.h>
833
834 #include <asm/alternative.h>
835 +#ifndef CONFIG_XEN
836 #include <asm/fixmap.h>
837 +#endif
838 #include <asm/apicdef.h>
839 #include <asm/processor.h>
840 #include <asm/system.h>
841 @@ -40,6 +42,7 @@ extern void generic_apic_probe(void);
842 #ifdef CONFIG_X86_LOCAL_APIC
843
844 extern unsigned int apic_verbosity;
845 +#ifndef CONFIG_XEN
846 extern int local_apic_timer_c2_ok;
847
848 extern int ioapic_force;
849 @@ -149,6 +152,7 @@ static inline void ack_APIC_irq(void)
850 /* Docs say use 0 for future compatibility */
851 apic_write(APIC_EOI, 0);
852 }
853 +#endif
854
855 extern int lapic_get_maxlvt(void);
856 extern void clear_local_APIC(void);
857 --- sle11-2009-06-04.orig/include/asm-x86/apicdef.h 2009-06-04 10:17:48.000000000 +0200
858 +++ sle11-2009-06-04/include/asm-x86/apicdef.h 2009-06-04 10:47:37.000000000 +0200
859 @@ -1,6 +1,8 @@
860 #ifndef _ASM_X86_APICDEF_H
861 #define _ASM_X86_APICDEF_H
862
863 +#ifndef CONFIG_XEN
864 +
865 /*
866 * Constants for various Intel APICs. (local APIC, IOAPIC, etc.)
867 *
868 @@ -132,6 +134,16 @@
869 #define APIC_BASE_MSR 0x800
870 #define X2APIC_ENABLE (1UL << 10)
871
872 +#else /* CONFIG_XEN */
873 +
874 +enum {
875 + APIC_DEST_ALLBUT = 0x1,
876 + APIC_DEST_SELF,
877 + APIC_DEST_ALLINC
878 +};
879 +
880 +#endif /* CONFIG_XEN */
881 +
882 #ifdef CONFIG_X86_32
883 # define MAX_IO_APICS 64
884 #else
885 @@ -139,6 +151,8 @@
886 # define MAX_LOCAL_APIC 32768
887 #endif
888
889 +#ifndef CONFIG_XEN
890 +
891 /*
892 * All x86-64 systems are xAPIC compatible.
893 * In the following, "apicid" is a physical APIC ID.
894 @@ -409,6 +423,8 @@ struct local_apic {
895
896 #undef u32
897
898 +#endif /* CONFIG_XEN */
899 +
900 #ifdef CONFIG_X86_32
901 #define BAD_APICID 0xFFu
902 #else
903 --- sle11-2009-06-04.orig/include/asm-x86/ipi.h 2009-06-04 10:17:48.000000000 +0200
904 +++ sle11-2009-06-04/include/asm-x86/ipi.h 2009-06-04 10:47:37.000000000 +0200
905 @@ -1,6 +1,8 @@
906 #ifndef __ASM_IPI_H
907 #define __ASM_IPI_H
908
909 +#ifndef CONFIG_XEN
910 +
911 /*
912 * Copyright 2004 James Cleverdon, IBM.
913 * Subject to the GNU Public License, v.2
914 @@ -151,4 +153,6 @@ static inline void send_IPI_mask_allbuts
915 local_irq_restore(flags);
916 }
917
918 +#endif /* CONFIG_XEN */
919 +
920 #endif /* __ASM_IPI_H */
921 --- sle11-2009-06-04.orig/include/asm-x86/mach-xen/asm/fixmap_32.h 2009-06-04 10:21:39.000000000 +0200
922 +++ sle11-2009-06-04/include/asm-x86/mach-xen/asm/fixmap_32.h 2009-06-04 10:47:37.000000000 +0200
923 @@ -55,10 +55,10 @@ enum fixed_addresses {
924 FIX_VDSO,
925 FIX_DBGP_BASE,
926 FIX_EARLYCON_MEM_BASE,
927 +#ifndef CONFIG_XEN
928 #ifdef CONFIG_X86_LOCAL_APIC
929 FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
930 #endif
931 -#ifndef CONFIG_XEN
932 #ifdef CONFIG_X86_IO_APIC
933 FIX_IO_APIC_BASE_0,
934 FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1,
935 --- sle11-2009-06-04.orig/include/asm-x86/mach-xen/asm/fixmap_64.h 2009-06-04 10:21:39.000000000 +0200
936 +++ sle11-2009-06-04/include/asm-x86/mach-xen/asm/fixmap_64.h 2009-06-04 10:47:37.000000000 +0200
937 @@ -13,7 +13,6 @@
938
939 #include <linux/kernel.h>
940 #include <asm/acpi.h>
941 -#include <asm/apicdef.h>
942 #include <asm/page.h>
943 #include <asm/vsyscall.h>
944 #include <asm/efi.h>
945 @@ -41,10 +40,8 @@ enum fixed_addresses {
946 VSYSCALL_HPET,
947 FIX_DBGP_BASE,
948 FIX_EARLYCON_MEM_BASE,
949 -#ifdef CONFIG_X86_LOCAL_APIC
950 - FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
951 -#endif
952 #ifndef CONFIG_XEN
953 + FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
954 FIX_IO_APIC_BASE_0,
955 FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS - 1,
956 #endif
957 --- sle11-2009-06-04.orig/include/asm-x86/mach-xen/asm/smp.h 2009-06-04 10:46:32.000000000 +0200
958 +++ sle11-2009-06-04/include/asm-x86/mach-xen/asm/smp.h 2009-06-04 10:47:37.000000000 +0200
959 @@ -16,7 +16,7 @@
960 # endif
961 #endif
962 #include <asm/pda.h>
963 -#include <asm/thread_info.h>
964 +#include <linux/thread_info.h>
965
966 #define cpu_callout_map cpu_possible_map
967 extern cpumask_t cpu_initialized;
968 @@ -178,7 +178,7 @@ DECLARE_PER_CPU(int, cpu_number);
969 #define stack_smp_processor_id() 0
970 #endif
971
972 -#ifdef CONFIG_X86_LOCAL_APIC
973 +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN)
974
975 static inline int logical_smp_processor_id(void)
976 {
977 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
978 +++ sle11-2009-06-04/include/asm-x86/mach-xen/mach_apic.h 2009-06-04 10:47:37.000000000 +0200
979 @@ -0,0 +1,54 @@
980 +#ifndef __ASM_MACH_APIC_H
981 +#define __ASM_MACH_APIC_H
982 +
983 +#include <asm/smp.h>
984 +
985 +#ifdef CONFIG_X86_64
986 +
987 +#include <asm/genapic.h>
988 +#define INT_DELIVERY_MODE (genapic->int_delivery_mode)
989 +#define INT_DEST_MODE (genapic->int_dest_mode)
990 +#define TARGET_CPUS (genapic->target_cpus())
991 +#define cpu_mask_to_apicid (genapic->cpu_mask_to_apicid)
992 +#define phys_pkg_id (genapic->phys_pkg_id)
993 +#define send_IPI_self (genapic->send_IPI_self)
994 +extern void setup_apic_routing(void);
995 +
996 +#else
997 +
998 +#ifdef CONFIG_SMP
999 +#define TARGET_CPUS cpu_online_map
1000 +#else
1001 +#define TARGET_CPUS cpumask_of_cpu(0)
1002 +#endif
1003 +
1004 +#define INT_DELIVERY_MODE dest_LowestPrio
1005 +#define INT_DEST_MODE 1
1006 +
1007 +static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
1008 +{
1009 + return cpuid_apic;
1010 +}
1011 +
1012 +static inline void setup_apic_routing(void)
1013 +{
1014 +}
1015 +
1016 +static inline int multi_timer_check(int apic, int irq)
1017 +{
1018 + return 0;
1019 +}
1020 +
1021 +static inline int apicid_to_node(int logical_apicid)
1022 +{
1023 + return 0;
1024 +}
1025 +
1026 +static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
1027 +{
1028 + return cpus_addr(cpumask)[0];
1029 +}
1030 +
1031 +#endif /* CONFIG_X86_64 */
1032 +
1033 +#endif /* __ASM_MACH_APIC_H */