Magellan Linux

Annotation of /trunk/kernel26-xen/patches-2.6.25-r1/1043-2.6.25-xen-x86-no-lapic.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 609 - (hide annotations) (download)
Fri May 23 17:35:37 2008 UTC (16 years ago) by niro
File size: 35527 byte(s)
-using opensuse xen patchset, updated kernel configs

1 niro 609 From: jbeulich@novell.com
2     Subject: Disallow all accesses to the local APIC page
3     Patch-mainline: obsolete
4     References: 191115
5    
6     Index: head-2008-03-11/arch/x86/kernel/Makefile
7     ===================================================================
8     --- head-2008-03-11.orig/arch/x86/kernel/Makefile 2008-03-13 12:24:15.000000000 +0100
9     +++ head-2008-03-11/arch/x86/kernel/Makefile 2008-03-11 17:16:47.000000000 +0100
10     @@ -100,9 +100,10 @@ ifeq ($(CONFIG_X86_64),y)
11     obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o
12     obj-$(CONFIG_SWIOTLB) += pci-swiotlb_64.o
13    
14     + apic_64-$(CONFIG_XEN) += apic_32.o
15     time_64-$(CONFIG_XEN) += time_32.o
16     pci-dma_64-$(CONFIG_XEN) += pci-dma_32.o
17     endif
18    
19     -disabled-obj-$(CONFIG_XEN) := early-quirks.o hpet.o i8253.o i8259_$(BITS).o reboot.o \
20     - smpboot_$(BITS).o tsc_$(BITS).o tsc_sync.o
21     +disabled-obj-$(CONFIG_XEN) := early-quirks.o genapic_flat_$(BITS).o hpet.o i8253.o \
22     + i8259_$(BITS).o reboot.o smpboot_$(BITS).o tsc_$(BITS).o tsc_sync.o
23     Index: head-2008-03-11/arch/x86/kernel/acpi/boot.c
24     ===================================================================
25     --- head-2008-03-11.orig/arch/x86/kernel/acpi/boot.c 2008-03-13 12:24:15.000000000 +0100
26     +++ head-2008-03-11/arch/x86/kernel/acpi/boot.c 2008-03-07 09:29:44.000000000 +0100
27     @@ -85,7 +85,7 @@ int acpi_sci_override_gsi __initdata;
28     int acpi_skip_timer_override __initdata;
29     int acpi_use_timer_override __initdata;
30    
31     -#ifdef CONFIG_X86_LOCAL_APIC
32     +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN)
33     static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
34     #endif
35    
36     @@ -230,12 +230,14 @@ static int __init acpi_parse_madt(struct
37     return -ENODEV;
38     }
39    
40     +#ifndef CONFIG_XEN
41     if (madt->address) {
42     acpi_lapic_addr = (u64) madt->address;
43    
44     printk(KERN_DEBUG PREFIX "Local APIC address 0x%08x\n",
45     madt->address);
46     }
47     +#endif
48    
49     acpi_madt_oem_check(madt->header.oem_id, madt->header.oem_table_id);
50    
51     @@ -271,6 +273,7 @@ static int __init
52     acpi_parse_lapic_addr_ovr(struct acpi_subtable_header * header,
53     const unsigned long end)
54     {
55     +#ifndef CONFIG_XEN
56     struct acpi_madt_local_apic_override *lapic_addr_ovr = NULL;
57    
58     lapic_addr_ovr = (struct acpi_madt_local_apic_override *)header;
59     @@ -279,6 +282,7 @@ acpi_parse_lapic_addr_ovr(struct acpi_su
60     return -EINVAL;
61    
62     acpi_lapic_addr = lapic_addr_ovr->address;
63     +#endif
64    
65     return 0;
66     }
67     @@ -758,7 +762,9 @@ static int __init acpi_parse_madt_lapic_
68     return count;
69     }
70    
71     +#ifndef CONFIG_XEN
72     mp_register_lapic_address(acpi_lapic_addr);
73     +#endif
74    
75     count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC, acpi_parse_lapic,
76     MAX_APICS);
77     Index: head-2008-03-11/arch/x86/kernel/apic_32-xen.c
78     ===================================================================
79     --- head-2008-03-11.orig/arch/x86/kernel/apic_32-xen.c 2008-03-13 12:24:15.000000000 +0100
80     +++ head-2008-03-11/arch/x86/kernel/apic_32-xen.c 2008-03-03 14:54:20.000000000 +0100
81     @@ -1,81 +1,27 @@
82     /*
83     - * Local APIC handling, local APIC timers
84     - *
85     - * (c) 1999, 2000 Ingo Molnar <mingo@redhat.com>
86     - *
87     - * Fixes
88     - * Maciej W. Rozycki : Bits for genuine 82489DX APICs;
89     - * thanks to Eric Gilmore
90     - * and Rolf G. Tews
91     - * for testing these extensively.
92     - * Maciej W. Rozycki : Various updates and fixes.
93     - * Mikael Pettersson : Power Management for UP-APIC.
94     - * Pavel Machek and
95     - * Mikael Pettersson : PM converted to driver model.
96     + * Local APIC handling stubs
97     */
98    
99     #include <linux/init.h>
100     -
101     -#include <linux/mm.h>
102     -#include <linux/delay.h>
103     -#include <linux/bootmem.h>
104     #include <linux/interrupt.h>
105     -#include <linux/mc146818rtc.h>
106     -#include <linux/kernel_stat.h>
107     -#include <linux/sysdev.h>
108     -#include <linux/cpu.h>
109     -#include <linux/clockchips.h>
110     -#include <linux/acpi_pmtmr.h>
111     -#include <linux/module.h>
112    
113     -#include <asm/atomic.h>
114     #include <asm/smp.h>
115     -#include <asm/mtrr.h>
116     -#include <asm/mpspec.h>
117     -#include <asm/desc.h>
118     -#include <asm/arch_hooks.h>
119     -#include <asm/hpet.h>
120     -#include <asm/i8253.h>
121     -#include <asm/nmi.h>
122     -
123     -#include <mach_apic.h>
124     -#include <mach_apicdef.h>
125     -#include <mach_ipi.h>
126     -
127     -#include "io_ports.h"
128     -
129     -#ifndef CONFIG_XEN
130     -/*
131     - * cpu_mask that denotes the CPUs that needs timer interrupt coming in as
132     - * IPIs in place of local APIC timers
133     - */
134     -static cpumask_t timer_bcast_ipi;
135     -#endif
136     -
137     -/*
138     - * Knob to control our willingness to enable the local APIC.
139     - */
140    
141     /*
142     * Debug level, exported for io_apic.c
143     */
144     int apic_verbosity;
145    
146     -#ifndef CONFIG_XEN
147     -static int modern_apic(void)
148     +static int __init apic_set_verbosity(char *str)
149     {
150     - /* AMD systems use old APIC versions, so check the CPU */
151     - if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
152     - boot_cpu_data.x86 >= 0xf)
153     - return 1;
154     - return lapic_get_version() >= 0x14;
155     + if (strcmp("debug", str) == 0)
156     + apic_verbosity = APIC_DEBUG;
157     + else if (strcmp("verbose", str) == 0)
158     + apic_verbosity = APIC_VERBOSE;
159     + return 1;
160     }
161     -#endif /* !CONFIG_XEN */
162    
163     -int get_physical_broadcast(void)
164     -{
165     - return 0xff;
166     -}
167     +__setup("apic=", apic_set_verbosity);
168    
169     int setup_profiling_timer(unsigned int multiplier)
170     {
171     Index: head-2008-03-11/arch/x86/kernel/apic_64-xen.c
172     ===================================================================
173     --- head-2008-03-11.orig/arch/x86/kernel/apic_64-xen.c 2008-03-13 12:24:15.000000000 +0100
174     +++ /dev/null 1970-01-01 00:00:00.000000000 +0000
175     @@ -1,185 +0,0 @@
176     -/*
177     - * Local APIC handling, local APIC timers
178     - *
179     - * (c) 1999, 2000 Ingo Molnar <mingo@redhat.com>
180     - *
181     - * Fixes
182     - * Maciej W. Rozycki : Bits for genuine 82489DX APICs;
183     - * thanks to Eric Gilmore
184     - * and Rolf G. Tews
185     - * for testing these extensively.
186     - * Maciej W. Rozycki : Various updates and fixes.
187     - * Mikael Pettersson : Power Management for UP-APIC.
188     - * Pavel Machek and
189     - * Mikael Pettersson : PM converted to driver model.
190     - */
191     -
192     -#include <linux/init.h>
193     -
194     -#include <linux/mm.h>
195     -#include <linux/delay.h>
196     -#include <linux/bootmem.h>
197     -#include <linux/interrupt.h>
198     -#include <linux/mc146818rtc.h>
199     -#include <linux/kernel_stat.h>
200     -#include <linux/sysdev.h>
201     -#include <linux/module.h>
202     -
203     -#include <asm/atomic.h>
204     -#include <asm/smp.h>
205     -#include <asm/mtrr.h>
206     -#include <asm/mpspec.h>
207     -#include <asm/desc.h>
208     -#include <asm/arch_hooks.h>
209     -#include <asm/hpet.h>
210     -#include <asm/idle.h>
211     -
212     -int disable_apic;
213     -
214     -/*
215     - * Debug level, exported for io_apic.c
216     - */
217     -int apic_verbosity;
218     -
219     -/*
220     - * The guts of the apic timer interrupt
221     - */
222     -static void local_apic_timer_interrupt(void)
223     -{
224     -#ifndef CONFIG_XEN
225     - int cpu = smp_processor_id();
226     - struct clock_event_device *evt = &per_cpu(lapic_events, cpu);
227     -
228     - /*
229     - * Normally we should not be here till LAPIC has been initialized but
230     - * in some cases like kdump, its possible that there is a pending LAPIC
231     - * timer interrupt from previous kernel's context and is delivered in
232     - * new kernel the moment interrupts are enabled.
233     - *
234     - * Interrupts are enabled early and LAPIC is setup much later, hence
235     - * its possible that when we get here evt->event_handler is NULL.
236     - * Check for event_handler being NULL and discard the interrupt as
237     - * spurious.
238     - */
239     - if (!evt->event_handler) {
240     - printk(KERN_WARNING
241     - "Spurious LAPIC timer interrupt on cpu %d\n", cpu);
242     - /* Switch it off */
243     - lapic_timer_setup(CLOCK_EVT_MODE_SHUTDOWN, evt);
244     - return;
245     - }
246     -#endif
247     -
248     - /*
249     - * the NMI deadlock-detector uses this.
250     - */
251     - add_pda(apic_timer_irqs, 1);
252     -
253     -#ifndef CONFIG_XEN
254     - evt->event_handler(evt);
255     -#endif
256     -}
257     -
258     -/*
259     - * Local APIC timer interrupt. This is the most natural way for doing
260     - * local interrupts, but local timer interrupts can be emulated by
261     - * broadcast interrupts too. [in case the hw doesn't support APIC timers]
262     - *
263     - * [ if a single-CPU system runs an SMP kernel then we call the local
264     - * interrupt as well. Thus we cannot inline the local irq ... ]
265     - */
266     -void smp_apic_timer_interrupt(struct pt_regs *regs)
267     -{
268     - struct pt_regs *old_regs = set_irq_regs(regs);
269     -
270     - /*
271     - * NOTE! We'd better ACK the irq immediately,
272     - * because timer handling can be slow.
273     - */
274     - ack_APIC_irq();
275     - /*
276     - * update_process_times() expects us to have done irq_enter().
277     - * Besides, if we don't timer interrupts ignore the global
278     - * interrupt lock, which is the WrongThing (tm) to do.
279     - */
280     - exit_idle();
281     - irq_enter();
282     - local_apic_timer_interrupt();
283     - irq_exit();
284     - set_irq_regs(old_regs);
285     -}
286     -
287     -int setup_profiling_timer(unsigned int multiplier)
288     -{
289     - return -EINVAL;
290     -}
291     -
292     -/*
293     - * This initializes the IO-APIC and APIC hardware if this is
294     - * a UP kernel.
295     - */
296     -int __init APIC_init_uniprocessor(void)
297     -{
298     -#ifdef CONFIG_X86_IO_APIC
299     - if (smp_found_config && !skip_ioapic_setup && nr_ioapics)
300     - setup_IO_APIC();
301     -#endif
302     -
303     - return 1;
304     -}
305     -
306     -/*
307     - * Local APIC interrupts
308     - */
309     -
310     -/*
311     - * This interrupt should _never_ happen with our APIC/SMP architecture
312     - */
313     -asmlinkage void smp_spurious_interrupt(void)
314     -{
315     - unsigned int v;
316     - exit_idle();
317     - irq_enter();
318     - /*
319     - * Check if this really is a spurious interrupt and ACK it
320     - * if it is a vectored one. Just in case...
321     - * Spurious interrupts should not be ACKed.
322     - */
323     - v = apic_read(APIC_ISR + ((SPURIOUS_APIC_VECTOR & ~0x1f) >> 1));
324     - if (v & (1 << (SPURIOUS_APIC_VECTOR & 0x1f)))
325     - ack_APIC_irq();
326     -
327     - add_pda(irq_spurious_count, 1);
328     - irq_exit();
329     -}
330     -
331     -/*
332     - * This interrupt should never happen with our APIC/SMP architecture
333     - */
334     -asmlinkage void smp_error_interrupt(void)
335     -{
336     - unsigned int v, v1;
337     -
338     - exit_idle();
339     - irq_enter();
340     - /* First tickle the hardware, only then report what went on. -- REW */
341     - v = apic_read(APIC_ESR);
342     - apic_write(APIC_ESR, 0);
343     - v1 = apic_read(APIC_ESR);
344     - ack_APIC_irq();
345     - atomic_inc(&irq_err_count);
346     -
347     - /* Here is what the APIC error bits mean:
348     - 0: Send CS error
349     - 1: Receive CS error
350     - 2: Send accept error
351     - 3: Receive accept error
352     - 4: Reserved
353     - 5: Send illegal vector
354     - 6: Received illegal vector
355     - 7: Illegal register address
356     - */
357     - printk (KERN_DEBUG "APIC error on CPU%d: %02x(%02x)\n",
358     - smp_processor_id(), v , v1);
359     - irq_exit();
360     -}
361     Index: head-2008-03-11/arch/x86/kernel/cpu/amd.c
362     ===================================================================
363     --- head-2008-03-11.orig/arch/x86/kernel/cpu/amd.c 2008-03-13 12:24:15.000000000 +0100
364     +++ head-2008-03-11/arch/x86/kernel/cpu/amd.c 2008-03-03 14:54:20.000000000 +0100
365     @@ -24,7 +24,7 @@
366     extern void vide(void);
367     __asm__(".align 4\nvide: ret");
368    
369     -#ifdef CONFIG_X86_LOCAL_APIC
370     +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN)
371     #define ENABLE_C1E_MASK 0x18000000
372     #define CPUID_PROCESSOR_SIGNATURE 1
373     #define CPUID_XFAM 0x0ff00000
374     @@ -295,7 +295,7 @@ static void __cpuinit init_amd(struct cp
375     num_cache_leaves = 3;
376     }
377    
378     -#ifdef CONFIG_X86_LOCAL_APIC
379     +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN)
380     if (amd_apic_timer_broken())
381     local_apic_timer_disabled = 1;
382     #endif
383     Index: head-2008-03-11/arch/x86/kernel/genapic_64-xen.c
384     ===================================================================
385     --- head-2008-03-11.orig/arch/x86/kernel/genapic_64-xen.c 2008-03-13 12:24:15.000000000 +0100
386     +++ head-2008-03-11/arch/x86/kernel/genapic_64-xen.c 2008-03-03 14:54:20.000000000 +0100
387     @@ -17,7 +17,6 @@
388     #include <linux/init.h>
389    
390     #include <asm/smp.h>
391     -#include <asm/ipi.h>
392     #include <asm/genapic.h>
393    
394     #ifdef CONFIG_ACPI
395     @@ -74,7 +73,7 @@ void __init setup_apic_routing(void)
396     /* Same for both flat and physical. */
397    
398     #ifdef CONFIG_XEN
399     -extern void xen_send_IPI_shortcut(unsigned int shortcut, int vector, unsigned int dest);
400     +extern void xen_send_IPI_shortcut(unsigned int shortcut, int vector);
401     #endif
402    
403     void send_IPI_self(int vector)
404     @@ -82,6 +81,6 @@ void send_IPI_self(int vector)
405     #ifndef CONFIG_XEN
406     __send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL);
407     #else
408     - xen_send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL);
409     + xen_send_IPI_shortcut(APIC_DEST_SELF, vector);
410     #endif
411     }
412     Index: head-2008-03-11/arch/x86/kernel/genapic_xen_64.c
413     ===================================================================
414     --- head-2008-03-11.orig/arch/x86/kernel/genapic_xen_64.c 2008-03-13 12:24:15.000000000 +0100
415     +++ head-2008-03-11/arch/x86/kernel/genapic_xen_64.c 2008-03-05 14:31:39.000000000 +0100
416     @@ -18,7 +18,6 @@
417     #include <linux/init.h>
418     #ifdef CONFIG_XEN_PRIVILEGED_GUEST
419     #include <asm/smp.h>
420     -#include <asm/ipi.h>
421     #else
422     #include <asm/apic.h>
423     #endif
424     @@ -34,7 +33,7 @@ static inline void __send_IPI_one(unsign
425     notify_remote_via_irq(irq);
426     }
427    
428     -void xen_send_IPI_shortcut(unsigned int shortcut, int vector, unsigned int dest)
429     +void xen_send_IPI_shortcut(unsigned int shortcut, int vector)
430     {
431     int cpu;
432    
433     @@ -96,13 +95,13 @@ static void xen_send_IPI_allbutself(int
434     */
435     Dprintk("%s\n", __FUNCTION__);
436     if (num_online_cpus() > 1)
437     - xen_send_IPI_shortcut(APIC_DEST_ALLBUT, vector, APIC_DEST_LOGICAL);
438     + xen_send_IPI_shortcut(APIC_DEST_ALLBUT, vector);
439     }
440    
441     static void xen_send_IPI_all(int vector)
442     {
443     Dprintk("%s\n", __FUNCTION__);
444     - xen_send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL);
445     + xen_send_IPI_shortcut(APIC_DEST_ALLINC, vector);
446     }
447    
448     static void xen_send_IPI_mask(cpumask_t cpumask, int vector)
449     @@ -135,7 +134,7 @@ static int xen_apic_id_registered(void)
450     static unsigned int xen_cpu_mask_to_apicid(cpumask_t cpumask)
451     {
452     Dprintk("%s\n", __FUNCTION__);
453     - return cpus_addr(cpumask)[0] & APIC_ALL_CPUS;
454     + return cpus_addr(cpumask)[0];
455     }
456    
457     static unsigned int phys_pkg_id(int index_msb)
458     @@ -152,7 +151,7 @@ struct genapic apic_xen = {
459     #ifdef CONFIG_XEN_PRIVILEGED_GUEST
460     .int_delivery_mode = dest_LowestPrio,
461     #endif
462     - .int_dest_mode = (APIC_DEST_LOGICAL != 0),
463     + .int_dest_mode = 1,
464     .target_cpus = xen_target_cpus,
465     .vector_allocation_domain = xen_vector_allocation_domain,
466     #ifdef CONFIG_XEN_PRIVILEGED_GUEST
467     Index: head-2008-03-11/arch/x86/kernel/io_apic_32-xen.c
468     ===================================================================
469     --- head-2008-03-11.orig/arch/x86/kernel/io_apic_32-xen.c 2008-03-13 12:24:15.000000000 +0100
470     +++ head-2008-03-11/arch/x86/kernel/io_apic_32-xen.c 2008-03-03 14:54:20.000000000 +0100
471     @@ -47,7 +47,6 @@
472     #include <asm/hypertransport.h>
473    
474     #include <mach_apic.h>
475     -#include <mach_apicdef.h>
476    
477     #ifdef CONFIG_XEN
478     #include <xen/interface/xen.h>
479     @@ -61,10 +60,10 @@
480     unsigned long io_apic_irqs;
481    
482     #define clear_IO_APIC() ((void)0)
483     -#endif /* CONFIG_XEN */
484     -
485     +#else
486     int (*ioapic_renumber_irq)(int ioapic, int irq);
487     atomic_t irq_mis_count;
488     +#endif /* CONFIG_XEN */
489    
490     /* Where if anywhere is the i8259 connect in external int mode */
491     static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };
492     @@ -72,7 +71,9 @@ static struct { int pin, apic; } ioapic_
493     static DEFINE_SPINLOCK(ioapic_lock);
494     static DEFINE_SPINLOCK(vector_lock);
495    
496     +#ifndef CONFIG_XEN
497     int timer_over_8254 __initdata = 1;
498     +#endif
499    
500     /*
501     * Is the SiS APIC rmw bug present ?
502     @@ -85,7 +86,9 @@ int sis_apic_bug = -1;
503     */
504     int nr_ioapic_registers[MAX_IO_APICS];
505    
506     +#ifndef CONFIG_XEN
507     static int disable_timer_pin_1 __initdata;
508     +#endif
509    
510     /*
511     * Rough estimation of how many shared IRQs there are, can
512     @@ -1188,12 +1191,13 @@ static int pin_2_irq(int idx, int apic,
513     irq += nr_ioapic_registers[i++];
514     irq += pin;
515    
516     +#ifndef CONFIG_XEN
517     /*
518     * For MPS mode, so far only needed by ES7000 platform
519     */
520     if (ioapic_renumber_irq)
521     irq = ioapic_renumber_irq(apic, irq);
522     -
523     +#endif
524     break;
525     }
526     default:
527     @@ -2383,6 +2387,7 @@ void __init setup_IO_APIC(void)
528     print_IO_APIC();
529     }
530    
531     +#ifndef CONFIG_XEN
532     static int __init setup_disable_8254_timer(char *s)
533     {
534     timer_over_8254 = -1;
535     @@ -2396,6 +2401,7 @@ static int __init setup_enable_8254_time
536    
537     __setup("disable_8254_timer", setup_disable_8254_timer);
538     __setup("enable_8254_timer", setup_enable_8254_timer);
539     +#endif
540    
541     /*
542     * Called after all the initialization is done. If we didnt find any
543     @@ -2924,6 +2930,7 @@ int acpi_get_override_irq(int bus_irq, i
544    
545     #endif /* CONFIG_ACPI */
546    
547     +#ifndef CONFIG_XEN
548     static int __init parse_disable_timer_pin_1(char *arg)
549     {
550     disable_timer_pin_1 = 1;
551     @@ -2937,6 +2944,7 @@ static int __init parse_enable_timer_pin
552     return 0;
553     }
554     early_param("enable_timer_pin_1", parse_enable_timer_pin_1);
555     +#endif
556    
557     static int __init parse_noapic(char *arg)
558     {
559     Index: head-2008-03-11/arch/x86/kernel/io_apic_64-xen.c
560     ===================================================================
561     --- head-2008-03-11.orig/arch/x86/kernel/io_apic_64-xen.c 2008-03-13 12:24:15.000000000 +0100
562     +++ head-2008-03-11/arch/x86/kernel/io_apic_64-xen.c 2008-03-03 14:54:20.000000000 +0100
563     @@ -69,10 +69,6 @@ static int assign_irq_vector(int irq, cp
564    
565     int sis_apic_bug; /* not actually supported, dummy for compile */
566    
567     -static int no_timer_check;
568     -
569     -static int disable_timer_pin_1 __initdata;
570     -
571     #ifdef CONFIG_XEN
572     #include <xen/interface/xen.h>
573     #include <xen/interface/physdev.h>
574     @@ -86,6 +82,10 @@ unsigned long io_apic_irqs;
575    
576     #define clear_IO_APIC() ((void)0)
577     #else
578     +static int no_timer_check;
579     +
580     +static int disable_timer_pin_1 __initdata;
581     +
582     int timer_over_8254 __initdata = 1;
583    
584     /* Where if anywhere is the i8259 connect in external int mode */
585     @@ -439,6 +439,7 @@ static int __init parse_noapic(char *str
586     }
587     early_param("noapic", parse_noapic);
588    
589     +#ifndef CONFIG_XEN
590     /* Actually the next is obsolete, but keep it for paranoid reasons -AK */
591     static int __init disable_timer_pin_setup(char *arg)
592     {
593     @@ -447,7 +448,6 @@ static int __init disable_timer_pin_setu
594     }
595     __setup("disable_timer_pin_1", disable_timer_pin_setup);
596    
597     -#ifndef CONFIG_XEN
598     static int __init setup_disable_8254_timer(char *s)
599     {
600     timer_over_8254 = -1;
601     @@ -1769,10 +1769,6 @@ static inline void __init check_timer(vo
602     out:
603     local_irq_restore(flags);
604     }
605     -#else
606     -#define check_timer() ((void)0)
607     -int timer_uses_ioapic_pin_0 = 0;
608     -#endif /* !CONFIG_XEN */
609    
610     static int __init notimercheck(char *s)
611     {
612     @@ -1780,6 +1776,10 @@ static int __init notimercheck(char *s)
613     return 1;
614     }
615     __setup("no_timer_check", notimercheck);
616     +#else
617     +#define check_timer() ((void)0)
618     +int timer_uses_ioapic_pin_0 = 0;
619     +#endif /* !CONFIG_XEN */
620    
621     /*
622     *
623     Index: head-2008-03-11/arch/x86/kernel/irq_32-xen.c
624     ===================================================================
625     --- head-2008-03-11.orig/arch/x86/kernel/irq_32-xen.c 2008-03-13 12:24:15.000000000 +0100
626     +++ head-2008-03-11/arch/x86/kernel/irq_32-xen.c 2008-03-03 14:54:20.000000000 +0100
627     @@ -235,7 +235,9 @@ asmlinkage void do_softirq(void)
628     * Interrupt statistics:
629     */
630    
631     +#ifndef CONFIG_XEN
632     atomic_t irq_err_count;
633     +#endif
634    
635     /*
636     * /proc/interrupts printing:
637     @@ -291,7 +293,7 @@ skip:
638     for_each_online_cpu(j)
639     seq_printf(p, "%10u ", nmi_count(j));
640     seq_printf(p, " Non-maskable interrupts\n");
641     -#ifdef CONFIG_X86_LOCAL_APIC
642     +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN)
643     seq_printf(p, "LOC: ");
644     for_each_online_cpu(j)
645     seq_printf(p, "%10u ",
646     @@ -324,6 +326,7 @@ skip:
647     per_cpu(irq_stat,j).irq_thermal_count);
648     seq_printf(p, " Thermal event interrupts\n");
649     #endif
650     +#ifndef CONFIG_XEN
651     #ifdef CONFIG_X86_LOCAL_APIC
652     seq_printf(p, "SPU: ");
653     for_each_online_cpu(j)
654     @@ -335,6 +338,7 @@ skip:
655     #if defined(CONFIG_X86_IO_APIC)
656     seq_printf(p, "MIS: %10u\n", atomic_read(&irq_mis_count));
657     #endif
658     +#endif
659     }
660     return 0;
661     }
662     Index: head-2008-03-11/arch/x86/kernel/irq_64-xen.c
663     ===================================================================
664     --- head-2008-03-11.orig/arch/x86/kernel/irq_64-xen.c 2008-03-13 12:24:15.000000000 +0100
665     +++ head-2008-03-11/arch/x86/kernel/irq_64-xen.c 2008-03-03 14:58:47.000000000 +0100
666     @@ -18,7 +18,9 @@
667     #include <asm/idle.h>
668     #include <asm/smp.h>
669    
670     +#ifndef CONFIG_XEN
671     atomic_t irq_err_count;
672     +#endif
673    
674     /*
675     * 'what should we do if we get a hw irq event on an illegal vector'.
676     @@ -27,19 +29,6 @@ atomic_t irq_err_count;
677     void ack_bad_irq(unsigned int irq)
678     {
679     printk(KERN_WARNING "unexpected IRQ trap at irq %02x\n", irq);
680     -#ifdef CONFIG_X86_LOCAL_APIC
681     - /*
682     - * Currently unexpected vectors happen only on SMP and APIC.
683     - * We _must_ ack these because every local APIC has only N
684     - * irq slots per priority level, and a 'hanging, unacked' IRQ
685     - * holds up an irq slot - in excessive cases (when multiple
686     - * unexpected vectors occur) that might lock up the APIC
687     - * completely.
688     - * But don't ack when the APIC is disabled. -AK
689     - */
690     - if (!disable_apic)
691     - ack_APIC_irq();
692     -#endif
693     }
694    
695     #ifdef CONFIG_DEBUG_STACKOVERFLOW
696     @@ -119,7 +108,7 @@ skip:
697     for_each_online_cpu(j)
698     seq_printf(p, "%10u ", cpu_pda(j)->__nmi_count);
699     seq_printf(p, " Non-maskable interrupts\n");
700     -#ifdef CONFIG_X86_LOCAL_APIC
701     +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN)
702     seq_printf(p, "LOC: ");
703     for_each_online_cpu(j)
704     seq_printf(p, "%10u ", cpu_pda(j)->apic_timer_irqs);
705     @@ -151,6 +140,7 @@ skip:
706     seq_printf(p, "%10u ", cpu_pda(j)->irq_threshold_count);
707     seq_printf(p, " Threshold APIC interrupts\n");
708     #endif
709     +#ifndef CONFIG_XEN
710     #ifdef CONFIG_X86_LOCAL_APIC
711     seq_printf(p, "SPU: ");
712     for_each_online_cpu(j)
713     @@ -158,6 +148,7 @@ skip:
714     seq_printf(p, " Spurious interrupts\n");
715     #endif
716     seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
717     +#endif
718     }
719     return 0;
720     }
721     Index: head-2008-03-11/arch/x86/kernel/mpparse_32-xen.c
722     ===================================================================
723     --- head-2008-03-11.orig/arch/x86/kernel/mpparse_32-xen.c 2008-03-13 12:24:15.000000000 +0100
724     +++ head-2008-03-11/arch/x86/kernel/mpparse_32-xen.c 2008-03-10 13:19:37.000000000 +0100
725     @@ -29,7 +29,6 @@
726     #include <asm/io_apic.h>
727    
728     #include <mach_apic.h>
729     -#include <mach_apicdef.h>
730     #include <mach_mpparse.h>
731     #include <bios_ebda.h>
732    
733     @@ -61,7 +60,9 @@ int mp_irq_entries;
734     int nr_ioapics;
735    
736     int pic_mode;
737     +#ifndef CONFIG_XEN
738     unsigned long mp_lapic_addr;
739     +#endif
740    
741     unsigned int def_to_bigsmp = 0;
742    
743     @@ -412,6 +413,7 @@ static int __init smp_read_mpc(struct mp
744    
745     mps_oem_check(mpc, oem, str);
746    
747     +#ifndef CONFIG_XEN
748     printk("APIC at: 0x%X\n", mpc->mpc_lapic);
749    
750     /*
751     @@ -420,6 +422,7 @@ static int __init smp_read_mpc(struct mp
752     */
753     if (!acpi_lapic)
754     mp_lapic_addr = mpc->mpc_lapic;
755     +#endif
756    
757     /*
758     * Now process the configuration blocks.
759     @@ -572,10 +575,12 @@ static inline void __init construct_defa
760     int linttypes[2] = { mp_ExtINT, mp_NMI };
761     int i;
762    
763     +#ifndef CONFIG_XEN
764     /*
765     * local APIC has default address
766     */
767     mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
768     +#endif
769    
770     /*
771     * 2 CPUs, numbered 0 & 1.
772     @@ -827,9 +832,9 @@ int es7000_plat;
773    
774     #ifdef CONFIG_ACPI
775    
776     +#ifndef CONFIG_XEN
777     void __init mp_register_lapic_address(u64 address)
778     {
779     -#ifndef CONFIG_XEN
780     mp_lapic_addr = (unsigned long) address;
781    
782     set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr);
783     @@ -838,8 +843,8 @@ void __init mp_register_lapic_address(u6
784     boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));
785    
786     Dprintk("Boot CPU = %d\n", boot_cpu_physical_apicid);
787     -#endif
788     }
789     +#endif
790    
791     void __cpuinit mp_register_lapic (u8 id, u8 enabled)
792     {
793     @@ -923,11 +928,11 @@ void __init mp_register_ioapic(u8 id, u3
794    
795     #ifndef CONFIG_XEN
796     set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address);
797     -#endif
798     if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
799     && !APIC_XAPIC(apic_version[boot_cpu_physical_apicid]))
800     tmpid = io_apic_get_unique_id(idx, id);
801     else
802     +#endif
803     tmpid = id;
804     if (tmpid == -1) {
805     nr_ioapics--;
806     @@ -1092,8 +1097,10 @@ int mp_register_gsi(u32 gsi, int trigger
807    
808     ioapic_pin = gsi - mp_ioapic_routing[ioapic].gsi_base;
809    
810     +#ifndef CONFIG_XEN
811     if (ioapic_renumber_irq)
812     gsi = ioapic_renumber_irq(ioapic, gsi);
813     +#endif
814    
815     /*
816     * Avoid pin reprogramming. PRTs typically include entries
817     Index: head-2008-03-11/arch/x86/kernel/mpparse_64-xen.c
818     ===================================================================
819     --- head-2008-03-11.orig/arch/x86/kernel/mpparse_64-xen.c 2008-03-13 12:24:15.000000000 +0100
820     +++ head-2008-03-11/arch/x86/kernel/mpparse_64-xen.c 2008-03-03 14:54:20.000000000 +0100
821     @@ -51,8 +51,9 @@ struct mpc_config_intsrc mp_irqs[MAX_IRQ
822     int mp_irq_entries;
823    
824     int nr_ioapics;
825     +#ifndef CONFIG_XEN
826     unsigned long mp_lapic_addr = 0;
827     -
828     +#endif
829    
830    
831     /* Processor that is doing the boot up */
832     @@ -262,11 +263,13 @@ static int __init smp_read_mpc(struct mp
833     str[12] = 0;
834     printk("MPTABLE: Product ID: %s ",str);
835    
836     +#ifndef CONFIG_XEN
837     printk("MPTABLE: APIC at: 0x%X\n",mpc->mpc_lapic);
838    
839     /* save the local APIC address, it might be non-default */
840     if (!acpi_lapic)
841     mp_lapic_addr = mpc->mpc_lapic;
842     +#endif
843    
844     /*
845     * Now process the configuration blocks.
846     @@ -411,10 +414,12 @@ static inline void __init construct_defa
847     int linttypes[2] = { mp_ExtINT, mp_NMI };
848     int i;
849    
850     +#ifndef CONFIG_XEN
851     /*
852     * local APIC has default address
853     */
854     mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
855     +#endif
856    
857     /*
858     * 2 CPUs, numbered 0 & 1.
859     @@ -615,15 +620,15 @@ void __init find_smp_config(void)
860    
861     #ifdef CONFIG_ACPI
862    
863     +#ifndef CONFIG_XEN
864     void __init mp_register_lapic_address(u64 address)
865     {
866     -#ifndef CONFIG_XEN
867     mp_lapic_addr = (unsigned long) address;
868     set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr);
869     if (boot_cpu_id == -1U)
870     boot_cpu_id = GET_APIC_ID(apic_read(APIC_ID));
871     -#endif
872     }
873     +#endif
874    
875     void __cpuinit mp_register_lapic (u8 id, u8 enabled)
876     {
877     Index: head-2008-03-11/arch/x86/kernel/smp_32-xen.c
878     ===================================================================
879     --- head-2008-03-11.orig/arch/x86/kernel/smp_32-xen.c 2008-03-13 12:24:15.000000000 +0100
880     +++ head-2008-03-11/arch/x86/kernel/smp_32-xen.c 2008-03-03 14:54:20.000000000 +0100
881     @@ -115,6 +115,7 @@ DEFINE_PER_CPU(struct tlb_state, cpu_tlb
882     * We use 'broadcast', CPU->CPU IPIs and self-IPIs too.
883     */
884    
885     +#ifndef CONFIG_XEN
886     static inline int __prepare_ICR (unsigned int shortcut, int vector)
887     {
888     unsigned int icr = shortcut | APIC_DEST_LOGICAL;
889     @@ -134,6 +135,7 @@ static inline int __prepare_ICR2 (unsign
890     {
891     return SET_APIC_DEST_FIELD(mask);
892     }
893     +#endif
894    
895     DECLARE_PER_CPU(int, ipi_to_irq[NR_IPIS]);
896    
897     Index: head-2008-03-11/arch/x86/kernel/traps_64-xen.c
898     ===================================================================
899     --- head-2008-03-11.orig/arch/x86/kernel/traps_64-xen.c 2008-03-06 10:52:57.000000000 +0100
900     +++ head-2008-03-11/arch/x86/kernel/traps_64-xen.c 2008-03-03 14:54:20.000000000 +0100
901     @@ -1160,15 +1160,15 @@ asmlinkage void do_spurious_interrupt_bu
902     {
903     }
904    
905     -#if 0
906     +#ifndef CONFIG_XEN
907     asmlinkage void __attribute__((weak)) smp_thermal_interrupt(void)
908     {
909     }
910     -#endif
911    
912     asmlinkage void __attribute__((weak)) mce_threshold_interrupt(void)
913     {
914     }
915     +#endif
916    
917     /*
918     * 'math_state_restore()' saves the current math information in the
919     Index: head-2008-03-11/include/asm-x86/apic.h
920     ===================================================================
921     --- head-2008-03-11.orig/include/asm-x86/apic.h 2008-03-13 12:24:15.000000000 +0100
922     +++ head-2008-03-11/include/asm-x86/apic.h 2008-03-03 15:17:31.000000000 +0100
923     @@ -3,7 +3,9 @@
924    
925     #include <linux/pm.h>
926     #include <linux/delay.h>
927     +#ifndef CONFIG_XEN
928     #include <asm/fixmap.h>
929     +#endif
930     #include <asm/apicdef.h>
931     #include <asm/processor.h>
932     #include <asm/system.h>
933     @@ -38,6 +40,7 @@ extern void generic_apic_probe(void);
934     #ifdef CONFIG_X86_LOCAL_APIC
935    
936     extern int apic_verbosity;
937     +#ifndef CONFIG_XEN
938     extern int timer_over_8254;
939     extern int local_apic_timer_c2_ok;
940     extern int local_apic_timer_disabled;
941     @@ -102,6 +105,7 @@ static inline void ack_APIC_irq(void)
942     /* Docs say use 0 for future compatibility */
943     apic_write_around(APIC_EOI, 0);
944     }
945     +#endif
946    
947     extern int lapic_get_maxlvt(void);
948     extern void clear_local_APIC(void);
949     Index: head-2008-03-11/include/asm-x86/apicdef.h
950     ===================================================================
951     --- head-2008-03-11.orig/include/asm-x86/apicdef.h 2008-03-13 12:24:15.000000000 +0100
952     +++ head-2008-03-11/include/asm-x86/apicdef.h 2008-03-04 14:23:56.000000000 +0100
953     @@ -1,6 +1,8 @@
954     #ifndef _ASM_X86_APICDEF_H
955     #define _ASM_X86_APICDEF_H
956    
957     +#ifndef CONFIG_XEN
958     +
959     /*
960     * Constants for various Intel APICs. (local APIC, IOAPIC, etc.)
961     *
962     @@ -131,6 +133,16 @@
963    
964     #define APIC_BASE (fix_to_virt(FIX_APIC_BASE))
965    
966     +#else /* CONFIG_XEN */
967     +
968     +enum {
969     + APIC_DEST_ALLBUT = 0x1,
970     + APIC_DEST_SELF,
971     + APIC_DEST_ALLINC
972     +};
973     +
974     +#endif /* CONFIG_XEN */
975     +
976     #ifdef CONFIG_X86_32
977     # define MAX_IO_APICS 64
978     #else
979     @@ -138,6 +150,8 @@
980     # define MAX_LOCAL_APIC 256
981     #endif
982    
983     +#ifndef CONFIG_XEN
984     +
985     /*
986     * All x86-64 systems are xAPIC compatible.
987     * In the following, "apicid" is a physical APIC ID.
988     @@ -408,6 +422,8 @@ struct local_apic {
989    
990     #undef u32
991    
992     +#endif /* CONFIG_XEN */
993     +
994     #define BAD_APICID 0xFFu
995    
996     #endif
997     Index: head-2008-03-11/include/asm-x86/ipi.h
998     ===================================================================
999     --- head-2008-03-11.orig/include/asm-x86/ipi.h 2008-01-24 23:58:37.000000000 +0100
1000     +++ head-2008-03-11/include/asm-x86/ipi.h 2008-03-03 14:54:20.000000000 +0100
1001     @@ -1,6 +1,8 @@
1002     #ifndef __ASM_IPI_H
1003     #define __ASM_IPI_H
1004    
1005     +#ifndef CONFIG_XEN
1006     +
1007     /*
1008     * Copyright 2004 James Cleverdon, IBM.
1009     * Subject to the GNU Public License, v.2
1010     @@ -125,4 +127,6 @@ static inline void send_IPI_mask_sequenc
1011     local_irq_restore(flags);
1012     }
1013    
1014     +#endif /* CONFIG_XEN */
1015     +
1016     #endif /* __ASM_IPI_H */
1017     Index: head-2008-03-11/include/asm-x86/mach-xen/asm/fixmap_32.h
1018     ===================================================================
1019     --- head-2008-03-11.orig/include/asm-x86/mach-xen/asm/fixmap_32.h 2008-03-13 12:24:15.000000000 +0100
1020     +++ head-2008-03-11/include/asm-x86/mach-xen/asm/fixmap_32.h 2008-03-03 14:54:20.000000000 +0100
1021     @@ -55,13 +55,15 @@ enum fixed_addresses {
1022     FIX_VDSO,
1023     FIX_DBGP_BASE,
1024     FIX_EARLYCON_MEM_BASE,
1025     +#ifndef CONFIG_XEN
1026     #ifdef CONFIG_X86_LOCAL_APIC
1027     FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
1028     #endif
1029     -#if defined(CONFIG_X86_IO_APIC) && !defined(CONFIG_XEN)
1030     +#ifdef CONFIG_X86_IO_APIC
1031     FIX_IO_APIC_BASE_0,
1032     FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1,
1033     #endif
1034     +#endif
1035     #ifdef CONFIG_X86_VISWS_APIC
1036     FIX_CO_CPU, /* Cobalt timer */
1037     FIX_CO_APIC, /* Cobalt APIC Redirection Table */
1038     Index: head-2008-03-11/include/asm-x86/mach-xen/asm/fixmap_64.h
1039     ===================================================================
1040     --- head-2008-03-11.orig/include/asm-x86/mach-xen/asm/fixmap_64.h 2008-03-13 12:24:15.000000000 +0100
1041     +++ head-2008-03-11/include/asm-x86/mach-xen/asm/fixmap_64.h 2008-03-13 12:24:37.000000000 +0100
1042     @@ -12,7 +12,6 @@
1043     #define _ASM_FIXMAP_H
1044    
1045     #include <linux/kernel.h>
1046     -#include <asm/apicdef.h>
1047     #include <asm/page.h>
1048     #include <asm/vsyscall.h>
1049     #include <asm/efi.h>
1050     @@ -40,10 +39,8 @@ enum fixed_addresses {
1051     FIX_DBGP_BASE,
1052     FIX_EARLYCON_MEM_BASE,
1053     FIX_HPET_BASE,
1054     -#ifdef CONFIG_X86_LOCAL_APIC
1055     - FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
1056     -#endif
1057     #ifndef CONFIG_XEN
1058     + FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
1059     FIX_IO_APIC_BASE_0,
1060     FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1,
1061     #endif
1062     Index: head-2008-03-11/include/asm-x86/mach-xen/asm/hw_irq_32.h
1063     ===================================================================
1064     --- head-2008-03-11.orig/include/asm-x86/mach-xen/asm/hw_irq_32.h 2008-03-13 12:24:15.000000000 +0100
1065     +++ head-2008-03-11/include/asm-x86/mach-xen/asm/hw_irq_32.h 2008-03-03 14:54:20.000000000 +0100
1066     @@ -17,8 +17,6 @@
1067     #include <asm/irq.h>
1068     #include <asm/sections.h>
1069    
1070     -#define NMI_VECTOR 0x02
1071     -
1072     /*
1073     * Various low-level irq details needed by irq.c, process.c,
1074     * time.c, io_apic.c and smp.c
1075     @@ -58,9 +56,6 @@ void setup_ioapic_dest(void);
1076    
1077     extern unsigned long io_apic_irqs;
1078    
1079     -extern atomic_t irq_err_count;
1080     -extern atomic_t irq_mis_count;
1081     -
1082     #define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs))
1083    
1084     #endif /* _ASM_HW_IRQ_H */
1085     Index: head-2008-03-11/include/asm-x86/mach-xen/asm/hw_irq_64.h
1086     ===================================================================
1087     --- head-2008-03-11.orig/include/asm-x86/mach-xen/asm/hw_irq_64.h 2008-03-13 12:24:15.000000000 +0100
1088     +++ head-2008-03-11/include/asm-x86/mach-xen/asm/hw_irq_64.h 2008-03-03 14:54:20.000000000 +0100
1089     @@ -22,7 +22,6 @@
1090     #include <linux/percpu.h>
1091     #endif
1092    
1093     -#define NMI_VECTOR 0x02
1094     /*
1095     * IDT vectors usable for external interrupt sources start
1096     * at 0x20:
1097     @@ -147,9 +146,6 @@ extern void native_init_IRQ(void);
1098    
1099     extern unsigned long io_apic_irqs;
1100    
1101     -extern atomic_t irq_err_count;
1102     -extern atomic_t irq_mis_count;
1103     -
1104     #define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs))
1105    
1106     #include <asm/ptrace.h>
1107     Index: head-2008-03-11/include/asm-x86/mach-xen/asm/smp_32.h
1108     ===================================================================
1109     --- head-2008-03-11.orig/include/asm-x86/mach-xen/asm/smp_32.h 2008-03-13 12:24:15.000000000 +0100
1110     +++ head-2008-03-11/include/asm-x86/mach-xen/asm/smp_32.h 2008-03-11 18:01:40.000000000 +0100
1111     @@ -147,7 +147,7 @@ static inline int num_booting_cpus(void)
1112    
1113     #endif /* !CONFIG_SMP */
1114    
1115     -#ifdef CONFIG_X86_LOCAL_APIC
1116     +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN)
1117    
1118     static __inline int logical_smp_processor_id(void)
1119     {
1120     Index: head-2008-03-11/include/asm-x86/mach-xen/asm/smp_64.h
1121     ===================================================================
1122     --- head-2008-03-11.orig/include/asm-x86/mach-xen/asm/smp_64.h 2008-03-13 12:24:15.000000000 +0100
1123     +++ head-2008-03-11/include/asm-x86/mach-xen/asm/smp_64.h 2008-03-03 15:14:55.000000000 +0100
1124     @@ -3,6 +3,7 @@
1125    
1126     #include <linux/cpumask.h>
1127     #include <linux/init.h>
1128     +#include <linux/thread_info.h>
1129    
1130     #ifdef CONFIG_X86_LOCAL_APIC
1131     /*
1132     @@ -15,7 +16,6 @@
1133     #include <asm/mpspec.h>
1134     #endif
1135     #include <asm/pda.h>
1136     -#include <asm/thread_info.h>
1137    
1138     extern cpumask_t cpu_initialized;
1139    
1140     @@ -85,7 +85,7 @@ extern unsigned int boot_cpu_id;
1141    
1142     #define safe_smp_processor_id() smp_processor_id()
1143    
1144     -#ifdef CONFIG_X86_LOCAL_APIC
1145     +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN)
1146     static __inline int logical_smp_processor_id(void)
1147     {
1148     /* we don't want to mark this access volatile - bad code generation */
1149     Index: head-2008-03-11/include/asm-x86/mach-xen/irq_vectors.h
1150     ===================================================================
1151     --- head-2008-03-11.orig/include/asm-x86/mach-xen/irq_vectors.h 2008-03-13 12:24:15.000000000 +0100
1152     +++ head-2008-03-11/include/asm-x86/mach-xen/irq_vectors.h 2008-03-03 14:54:20.000000000 +0100
1153     @@ -34,7 +34,7 @@
1154     * Vectors 0x20-0x2f are used for ISA interrupts.
1155     */
1156    
1157     -#if 0
1158     +#ifndef CONFIG_XEN
1159     /*
1160     * Special IRQ vectors used by the SMP architecture, 0xf0-0xff
1161     *
1162     @@ -57,7 +57,6 @@
1163     * sources per level' errata.
1164     */
1165     #define LOCAL_TIMER_VECTOR 0xef
1166     -#endif
1167    
1168     #define SPURIOUS_APIC_VECTOR 0xff
1169     #define ERROR_APIC_VECTOR 0xfe
1170     @@ -79,6 +78,7 @@
1171     * Since vectors 0x00-0x1f are used/reserved for the CPU,
1172     * the usable vector space is 0x20-0xff (224 vectors)
1173     */
1174     +#endif
1175    
1176     #define RESCHEDULE_VECTOR 0
1177     #define CALL_FUNCTION_VECTOR 1
1178     Index: head-2008-03-11/include/asm-x86/mach-xen/mach_apic.h
1179     ===================================================================
1180     --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1181     +++ head-2008-03-11/include/asm-x86/mach-xen/mach_apic.h 2008-03-05 14:55:03.000000000 +0100
1182     @@ -0,0 +1,34 @@
1183     +#ifndef __ASM_MACH_APIC_H
1184     +#define __ASM_MACH_APIC_H
1185     +
1186     +#include <linux/cpumask.h>
1187     +
1188     +#ifdef CONFIG_SMP
1189     +#define TARGET_CPUS cpu_online_map
1190     +#else
1191     +#define TARGET_CPUS cpumask_of_cpu(0)
1192     +#endif
1193     +
1194     +#define INT_DELIVERY_MODE dest_LowestPrio
1195     +#define INT_DEST_MODE 1
1196     +
1197     +static inline void setup_apic_routing(void)
1198     +{
1199     +}
1200     +
1201     +static inline int multi_timer_check(int apic, int irq)
1202     +{
1203     + return 0;
1204     +}
1205     +
1206     +static inline int apicid_to_node(int logical_apicid)
1207     +{
1208     + return 0;
1209     +}
1210     +
1211     +static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
1212     +{
1213     + return cpus_addr(cpumask)[0];
1214     +}
1215     +
1216     +#endif /* __ASM_MACH_APIC_H */