Subject: Disallow all accesses to the local APIC page Index: 2006-07-27/arch/i386/kernel/acpi/boot-xen.c =================================================================== --- 2006-07-27.orig/arch/i386/kernel/acpi/boot-xen.c 2006-04-03 11:48:19.000000000 +0200 +++ 2006-07-27/arch/i386/kernel/acpi/boot-xen.c 2006-07-27 15:03:07.236743208 +0200 @@ -77,7 +77,7 @@ acpi_interrupt_flags acpi_sci_flags __in int acpi_sci_override_gsi __initdata; int acpi_skip_timer_override __initdata; -#ifdef CONFIG_X86_LOCAL_APIC +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN) static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE; #endif @@ -226,12 +226,14 @@ static int __init acpi_parse_madt(unsign return -ENODEV; } +#ifndef CONFIG_XEN if (madt->lapic_address) { acpi_lapic_addr = (u64) madt->lapic_address; printk(KERN_DEBUG PREFIX "Local APIC address 0x%08x\n", madt->lapic_address); } +#endif acpi_madt_oem_check(madt->header.oem_id, madt->header.oem_table_id); @@ -271,6 +273,7 @@ static int __init acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header, const unsigned long end) { +#ifndef CONFIG_XEN struct acpi_table_lapic_addr_ovr *lapic_addr_ovr = NULL; lapic_addr_ovr = (struct acpi_table_lapic_addr_ovr *)header; @@ -279,6 +282,7 @@ acpi_parse_lapic_addr_ovr(acpi_table_ent return -EINVAL; acpi_lapic_addr = lapic_addr_ovr->address; +#endif return 0; } @@ -710,7 +714,9 @@ static int __init acpi_parse_madt_lapic_ return count; } +#ifndef CONFIG_XEN mp_register_lapic_address(acpi_lapic_addr); +#endif count = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic, MAX_APICS); Index: 2006-07-27/arch/i386/kernel/acpi/earlyquirk.c =================================================================== --- 2006-07-27.orig/arch/i386/kernel/acpi/earlyquirk.c 2006-03-20 06:53:29.000000000 +0100 +++ 2006-07-27/arch/i386/kernel/acpi/earlyquirk.c 2006-07-27 15:03:07.237743056 +0200 @@ -11,6 +11,7 @@ static int __init check_bridge(int vendor, int device) { +#ifndef CONFIG_XEN #ifdef CONFIG_ACPI /* According to Nvidia all timer overrides are bogus. Just ignore them all. */ @@ -23,6 +24,7 @@ static int __init check_bridge(int vendo printk(KERN_INFO "ATI board detected. Disabling timer routing " "over 8254.\n"); } +#endif return 0; } Index: 2006-07-27/arch/i386/kernel/apic-xen.c =================================================================== --- 2006-07-27.orig/arch/i386/kernel/apic-xen.c 2006-02-20 16:30:07.000000000 +0100 +++ 2006-07-27/arch/i386/kernel/apic-xen.c 2006-07-27 15:03:07.240742600 +0200 @@ -67,6 +67,7 @@ int apic_verbosity; void ack_bad_irq(unsigned int irq) { printk("unexpected IRQ trap at vector %02x\n", irq); +#ifndef CONFIG_XEN /* * Currently unexpected vectors happen only on SMP and APIC. * We _must_ ack these because every local APIC has only N @@ -78,6 +79,7 @@ void ack_bad_irq(unsigned int irq) */ if (cpu_has_apic) ack_APIC_irq(); +#endif } int get_physical_broadcast(void) Index: 2006-07-27/arch/i386/kernel/io_apic-xen.c =================================================================== --- 2006-07-27.orig/arch/i386/kernel/io_apic-xen.c 2006-05-02 16:41:34.000000000 +0200 +++ 2006-07-27/arch/i386/kernel/io_apic-xen.c 2006-07-27 15:03:07.245741840 +0200 @@ -91,7 +91,9 @@ static struct { int pin, apic; } ioapic_ static DEFINE_SPINLOCK(ioapic_lock); +#ifndef CONFIG_XEN int timer_over_8254 __initdata = 1; +#endif /* * Is the SiS APIC rmw bug present ? @@ -104,7 +106,9 @@ int sis_apic_bug = -1; */ int nr_ioapic_registers[MAX_IO_APICS]; +#ifndef CONFIG_XEN int disable_timer_pin_1 __initdata; +#endif /* * Rough estimation of how many shared IRQs there are, can @@ -2457,6 +2461,7 @@ void __init setup_IO_APIC(void) print_IO_APIC(); } +#ifndef CONFIG_XEN static int __init setup_disable_8254_timer(char *s) { timer_over_8254 = -1; @@ -2470,6 +2475,7 @@ static int __init setup_enable_8254_time __setup("disable_8254_timer", setup_disable_8254_timer); __setup("enable_8254_timer", setup_enable_8254_timer); +#endif /* * Called after all the initialization is done. If we didnt find any Index: 2006-07-27/arch/i386/kernel/mpparse-xen.c =================================================================== --- 2006-07-27.orig/arch/i386/kernel/mpparse-xen.c 2006-02-28 17:35:08.000000000 +0100 +++ 2006-07-27/arch/i386/kernel/mpparse-xen.c 2006-07-27 15:03:07.249741232 +0200 @@ -68,7 +68,9 @@ int mp_irq_entries; int nr_ioapics; int pic_mode; +#ifndef CONFIG_XEN unsigned long mp_lapic_addr; +#endif unsigned int def_to_bigsmp = 0; @@ -439,6 +441,7 @@ static int __init smp_read_mpc(struct mp mps_oem_check(mpc, oem, str); +#ifndef CONFIG_XEN printk("APIC at: 0x%lX\n",mpc->mpc_lapic); /* @@ -447,6 +450,7 @@ static int __init smp_read_mpc(struct mp */ if (!acpi_lapic) mp_lapic_addr = mpc->mpc_lapic; +#endif /* * Now process the configuration blocks. @@ -599,10 +603,12 @@ static inline void __init construct_defa int linttypes[2] = { mp_ExtINT, mp_NMI }; int i; +#ifndef CONFIG_XEN /* * local APIC has default address */ mp_lapic_addr = APIC_DEFAULT_PHYS_BASE; +#endif /* * 2 CPUs, numbered 0 & 1. @@ -850,10 +856,10 @@ void __init find_smp_config (void) #ifdef CONFIG_ACPI +#ifndef CONFIG_XEN void __init mp_register_lapic_address ( u64 address) { -#ifndef CONFIG_XEN mp_lapic_addr = (unsigned long) address; set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr); @@ -862,8 +868,8 @@ void __init mp_register_lapic_address ( boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); Dprintk("Boot CPU = %d\n", boot_cpu_physical_apicid); -#endif } +#endif void __devinit mp_register_lapic ( Index: 2006-07-27/arch/i386/kernel/nmi.c =================================================================== --- 2006-07-27.orig/arch/i386/kernel/nmi.c 2006-03-20 06:53:29.000000000 +0100 +++ 2006-07-27/arch/i386/kernel/nmi.c 2006-07-27 15:03:07.251740928 +0200 @@ -32,8 +32,13 @@ #include "mach_traps.h" -unsigned int nmi_watchdog = NMI_NONE; +extern void die_nmi(struct pt_regs *, const char *msg); + extern int unknown_nmi_panic; + +#ifndef CONFIG_XEN + +unsigned int nmi_watchdog = NMI_NONE; static unsigned int nmi_hz = HZ; static unsigned int nmi_perfctr_msr; /* the MSR to reset in NMI handler */ static unsigned int nmi_p4_cccr_val; @@ -519,8 +524,6 @@ void touch_nmi_watchdog (void) touch_softlockup_watchdog(); } -extern void die_nmi(struct pt_regs *, const char *msg); - void nmi_watchdog_tick (struct pt_regs * regs) { @@ -570,6 +573,19 @@ void nmi_watchdog_tick (struct pt_regs * } } +#else /* CONFIG_XEN */ + +static inline int reserve_lapic_nmi(void) +{ + return 0; +} + +static inline void release_lapic_nmi(void) +{ +} + +#endif /* CONFIG_XEN */ + #ifdef CONFIG_SYSCTL static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu) @@ -613,9 +629,11 @@ int proc_unknown_nmi_panic(ctl_table *ta #endif +#ifndef CONFIG_XEN EXPORT_SYMBOL(nmi_active); EXPORT_SYMBOL(nmi_watchdog); EXPORT_SYMBOL(reserve_lapic_nmi); EXPORT_SYMBOL(release_lapic_nmi); EXPORT_SYMBOL(disable_timer_nmi_watchdog); EXPORT_SYMBOL(enable_timer_nmi_watchdog); +#endif Index: 2006-07-27/arch/i386/kernel/setup-xen.c =================================================================== --- 2006-07-27.orig/arch/i386/kernel/setup-xen.c 2006-06-12 08:24:28.000000000 +0200 +++ 2006-07-27/arch/i386/kernel/setup-xen.c 2006-07-27 15:03:07.255740320 +0200 @@ -908,7 +908,7 @@ static void __init parse_cmdline_early ( else if (!memcmp(from, "acpi_sci=low", 12)) acpi_sci_flags.polarity = 3; -#ifdef CONFIG_X86_IO_APIC +#if defined(CONFIG_X86_IO_APIC) && !defined(CONFIG_XEN) else if (!memcmp(from, "acpi_skip_timer_override", 24)) acpi_skip_timer_override = 1; Index: 2006-07-27/arch/i386/kernel/smp-xen.c =================================================================== --- 2006-07-27.orig/arch/i386/kernel/smp-xen.c 2006-07-17 08:27:43.000000000 +0200 +++ 2006-07-27/arch/i386/kernel/smp-xen.c 2006-07-27 15:03:07.258739864 +0200 @@ -115,6 +115,7 @@ DEFINE_PER_CPU(struct tlb_state, cpu_tlb * We use 'broadcast', CPU->CPU IPIs and self-IPIs too. */ +#ifndef CONFIG_XEN static inline int __prepare_ICR (unsigned int shortcut, int vector) { return APIC_DM_FIXED | shortcut | vector | APIC_DEST_LOGICAL; @@ -124,6 +125,7 @@ static inline int __prepare_ICR2 (unsign { return SET_APIC_DEST_FIELD(mask); } +#endif DECLARE_PER_CPU(int, ipi_to_irq[NR_IPIS]); Index: 2006-07-27/arch/i386/kernel/traps-xen.c =================================================================== --- 2006-07-27.orig/arch/i386/kernel/traps-xen.c 2006-02-28 17:35:09.000000000 +0100 +++ 2006-07-27/arch/i386/kernel/traps-xen.c 2006-07-27 15:03:07.261739408 +0200 @@ -611,7 +611,7 @@ static void default_do_nmi(struct pt_reg if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 0, SIGINT) == NOTIFY_STOP) return; -#ifdef CONFIG_X86_LOCAL_APIC +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN) /* * Ok, so this is none of the documented NMI sources, * so it must be the NMI watchdog. Index: 2006-07-27/arch/x86_64/kernel/Makefile =================================================================== --- 2006-07-27.orig/arch/x86_64/kernel/Makefile 2006-02-28 17:35:09.000000000 +0100 +++ 2006-07-27/arch/x86_64/kernel/Makefile 2006-07-27 15:03:07.263739104 +0200 @@ -59,7 +59,8 @@ pci-dma-y += ../../i386/kernel/pci-dma microcode-$(subst m,y,$(CONFIG_MICROCODE)) := ../../i386/kernel/microcode-xen.o quirks-y := ../../i386/kernel/quirks-xen.o -n-obj-xen := i8259.o reboot.o i8237.o smpboot.o trampoline.o +n-obj-xen := genapic_cluster.o genapic_flat.o i8237.o i8259.o reboot.o \ + smpboot.o trampoline.o include $(srctree)/scripts/Makefile.xen Index: 2006-07-27/arch/x86_64/kernel/apic-xen.c =================================================================== --- 2006-07-27.orig/arch/x86_64/kernel/apic-xen.c 2006-04-03 11:48:19.000000000 +0200 +++ 2006-07-27/arch/x86_64/kernel/apic-xen.c 2006-07-27 15:03:07.265738800 +0200 @@ -45,17 +45,6 @@ int apic_verbosity; void ack_bad_irq(unsigned int irq) { printk("unexpected IRQ trap at vector %02x\n", irq); - /* - * Currently unexpected vectors happen only on SMP and APIC. - * We _must_ ack these because every local APIC has only N - * irq slots per priority level, and a 'hanging, unacked' IRQ - * holds up an irq slot - in excessive cases (when multiple - * unexpected vectors occur) that might lock up the APIC - * completely. - * But don't ack when the APIC is disabled. -AK - */ - if (!disable_apic) - ack_APIC_irq(); } int setup_profiling_timer(unsigned int multiplier) @@ -63,125 +52,6 @@ int setup_profiling_timer(unsigned int m return -EINVAL; } -void smp_local_timer_interrupt(struct pt_regs *regs) -{ - profile_tick(CPU_PROFILING, regs); -#ifndef CONFIG_XEN -#ifdef CONFIG_SMP - update_process_times(user_mode(regs)); -#endif -#endif - /* - * We take the 'long' return path, and there every subsystem - * grabs the appropriate locks (kernel lock/ irq lock). - * - * we might want to decouple profiling from the 'long path', - * and do the profiling totally in assembly. - * - * Currently this isn't too much of an issue (performance wise), - * we can take more than 100K local irqs per second on a 100 MHz P5. - */ -} - -/* - * Local APIC timer interrupt. This is the most natural way for doing - * local interrupts, but local timer interrupts can be emulated by - * broadcast interrupts too. [in case the hw doesn't support APIC timers] - * - * [ if a single-CPU system runs an SMP kernel then we call the local - * interrupt as well. Thus we cannot inline the local irq ... ] - */ -void smp_apic_timer_interrupt(struct pt_regs *regs) -{ - /* - * the NMI deadlock-detector uses this. - */ - add_pda(apic_timer_irqs, 1); - - /* - * NOTE! We'd better ACK the irq immediately, - * because timer handling can be slow. - */ - ack_APIC_irq(); - /* - * update_process_times() expects us to have done irq_enter(). - * Besides, if we don't timer interrupts ignore the global - * interrupt lock, which is the WrongThing (tm) to do. - */ - exit_idle(); - irq_enter(); - smp_local_timer_interrupt(regs); - irq_exit(); -} - -/* - * This interrupt should _never_ happen with our APIC/SMP architecture - */ -asmlinkage void smp_spurious_interrupt(void) -{ - unsigned int v; - exit_idle(); - irq_enter(); - /* - * Check if this really is a spurious interrupt and ACK it - * if it is a vectored one. Just in case... - * Spurious interrupts should not be ACKed. - */ - v = apic_read(APIC_ISR + ((SPURIOUS_APIC_VECTOR & ~0x1f) >> 1)); - if (v & (1 << (SPURIOUS_APIC_VECTOR & 0x1f))) - ack_APIC_irq(); - -#if 0 - static unsigned long last_warning; - static unsigned long skipped; - - /* see sw-dev-man vol 3, chapter 7.4.13.5 */ - if (time_before(last_warning+30*HZ,jiffies)) { - printk(KERN_INFO "spurious APIC interrupt on CPU#%d, %ld skipped.\n", - smp_processor_id(), skipped); - last_warning = jiffies; - skipped = 0; - } else { - skipped++; - } -#endif - irq_exit(); -} - -/* - * This interrupt should never happen with our APIC/SMP architecture - */ - -asmlinkage void smp_error_interrupt(void) -{ - unsigned int v, v1; - - exit_idle(); - irq_enter(); - /* First tickle the hardware, only then report what went on. -- REW */ - v = apic_read(APIC_ESR); - apic_write(APIC_ESR, 0); - v1 = apic_read(APIC_ESR); - ack_APIC_irq(); - atomic_inc(&irq_err_count); - - /* Here is what the APIC error bits mean: - 0: Send CS error - 1: Receive CS error - 2: Send accept error - 3: Receive accept error - 4: Reserved - 5: Send illegal vector - 6: Received illegal vector - 7: Illegal register address - */ - printk (KERN_DEBUG "APIC error on CPU%d: %02x(%02x)\n", - smp_processor_id(), v , v1); - irq_exit(); -} - -int disable_apic; - /* * This initializes the IO-APIC and APIC hardware if this is * a UP kernel. Index: 2006-07-27/arch/x86_64/kernel/genapic-xen.c =================================================================== --- 2006-07-27.orig/arch/x86_64/kernel/genapic-xen.c 2006-02-01 18:28:39.000000000 +0100 +++ 2006-07-27/arch/x86_64/kernel/genapic-xen.c 2006-07-27 15:03:07.267738496 +0200 @@ -131,7 +131,7 @@ print: /* Same for both flat and clustered. */ #ifdef CONFIG_XEN -extern void xen_send_IPI_shortcut(unsigned int shortcut, int vector, unsigned int dest); +extern void xen_send_IPI_shortcut(unsigned int shortcut, int vector); #endif void send_IPI_self(int vector) @@ -139,6 +139,6 @@ void send_IPI_self(int vector) #ifndef CONFIG_XEN __send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL); #else - xen_send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL); + xen_send_IPI_shortcut(APIC_DEST_SELF, vector); #endif } Index: 2006-07-27/arch/x86_64/kernel/genapic_xen.c =================================================================== --- 2006-07-27.orig/arch/x86_64/kernel/genapic_xen.c 2006-02-01 18:28:39.000000000 +0100 +++ 2006-07-27/arch/x86_64/kernel/genapic_xen.c 2006-07-27 15:03:07.268738344 +0200 @@ -36,7 +36,7 @@ static inline void __send_IPI_one(unsign notify_remote_via_irq(irq); } -void xen_send_IPI_shortcut(unsigned int shortcut, int vector, unsigned int dest) +void xen_send_IPI_shortcut(unsigned int shortcut, int vector) { int cpu; @@ -91,13 +91,13 @@ static void xen_send_IPI_allbutself(int */ Dprintk("%s\n", __FUNCTION__); if (num_online_cpus() > 1) - xen_send_IPI_shortcut(APIC_DEST_ALLBUT, vector, APIC_DEST_LOGICAL); + xen_send_IPI_shortcut(APIC_DEST_ALLBUT, vector); } static void xen_send_IPI_all(int vector) { Dprintk("%s\n", __FUNCTION__); - xen_send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL); + xen_send_IPI_shortcut(APIC_DEST_ALLINC, vector); } static void xen_send_IPI_mask(cpumask_t cpumask, int vector) @@ -147,8 +147,7 @@ struct genapic apic_xen = { #ifdef CONFIG_XEN_PRIVILEGED_GUEST .int_delivery_mode = dest_LowestPrio, #endif - .int_dest_mode = (APIC_DEST_LOGICAL != 0), - .int_delivery_dest = APIC_DEST_LOGICAL | APIC_DM_LOWEST, + .int_dest_mode = 1, .target_cpus = xen_target_cpus, #ifdef CONFIG_XEN_PRIVILEGED_GUEST .apic_id_registered = xen_apic_id_registered, Index: 2006-07-27/arch/x86_64/kernel/head64-xen.c =================================================================== --- 2006-07-27.orig/arch/x86_64/kernel/head64-xen.c 2006-06-21 08:46:45.000000000 +0200 +++ 2006-07-27/arch/x86_64/kernel/head64-xen.c 2006-07-27 15:03:07.270738040 +0200 @@ -146,7 +146,7 @@ void __init x86_64_start_kernel(char * r if (s != NULL) numa_setup(s+5); #endif -#ifdef CONFIG_X86_IO_APIC +#if defined(CONFIG_X86_IO_APIC) && !defined(CONFIG_XEN) if (strstr(saved_command_line, "disableapic")) disable_apic = 1; #endif Index: 2006-07-27/arch/x86_64/kernel/io_apic-xen.c =================================================================== --- 2006-07-27.orig/arch/x86_64/kernel/io_apic-xen.c 2006-05-02 16:41:34.000000000 +0200 +++ 2006-07-27/arch/x86_64/kernel/io_apic-xen.c 2006-07-27 15:03:07.274737432 +0200 @@ -48,9 +48,9 @@ int sis_apic_bug; /* not actually suppor static int no_timer_check; +#ifndef CONFIG_XEN int disable_timer_pin_1 __initdata; -#ifndef CONFIG_XEN int timer_over_8254 __initdata = 1; /* Where if anywhere is the i8259 connect in external int mode */ Index: 2006-07-27/arch/x86_64/kernel/mpparse-xen.c =================================================================== --- 2006-07-27.orig/arch/x86_64/kernel/mpparse-xen.c 2006-02-22 09:38:27.000000000 +0100 +++ 2006-07-27/arch/x86_64/kernel/mpparse-xen.c 2006-07-27 15:03:07.277736976 +0200 @@ -58,8 +58,9 @@ int mp_irq_entries; int nr_ioapics; int pic_mode; +#ifndef CONFIG_XEN unsigned long mp_lapic_addr = 0; - +#endif /* Processor that is doing the boot up */ @@ -297,11 +298,13 @@ static int __init smp_read_mpc(struct mp str[12]=0; printk("Product ID: %s ",str); +#ifndef CONFIG_XEN printk("APIC at: 0x%X\n",mpc->mpc_lapic); /* save the local APIC address, it might be non-default */ if (!acpi_lapic) mp_lapic_addr = mpc->mpc_lapic; +#endif /* * Now process the configuration blocks. @@ -446,10 +449,12 @@ static inline void __init construct_defa int linttypes[2] = { mp_ExtINT, mp_NMI }; int i; +#ifndef CONFIG_XEN /* * local APIC has default address */ mp_lapic_addr = APIC_DEFAULT_PHYS_BASE; +#endif /* * 2 CPUs, numbered 0 & 1. @@ -681,10 +686,10 @@ void __init find_smp_config (void) #ifdef CONFIG_ACPI +#ifndef CONFIG_XEN void __init mp_register_lapic_address ( u64 address) { -#ifndef CONFIG_XEN mp_lapic_addr = (unsigned long) address; set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr); @@ -693,8 +698,8 @@ void __init mp_register_lapic_address ( boot_cpu_id = GET_APIC_ID(apic_read(APIC_ID)); Dprintk("Boot CPU = %d\n", boot_cpu_physical_apicid); -#endif } +#endif void __init mp_register_lapic ( Index: 2006-07-27/arch/x86_64/kernel/nmi.c =================================================================== --- 2006-07-27.orig/arch/x86_64/kernel/nmi.c 2006-03-20 06:53:29.000000000 +0100 +++ 2006-07-27/arch/x86_64/kernel/nmi.c 2006-07-27 15:03:07.295734240 +0200 @@ -35,6 +35,8 @@ #include #include +#ifndef CONFIG_XEN + /* * lapic_nmi_owner tracks the ownership of the lapic NMI hardware: * - it may be reserved by some other driver, or not @@ -516,6 +518,19 @@ void __kprobes nmi_watchdog_tick(struct } } +#else /* CONFIG_XEN */ + +static inline int reserve_lapic_nmi(void) +{ + return 0; +} + +static inline void release_lapic_nmi(void) +{ +} + +#endif /* CONFIG_XEN */ + static __kprobes int dummy_nmi_callback(struct pt_regs * regs, int cpu) { return 0; @@ -587,6 +602,7 @@ int proc_unknown_nmi_panic(struct ctl_ta #endif +#ifndef CONFIG_XEN EXPORT_SYMBOL(nmi_active); EXPORT_SYMBOL(nmi_watchdog); EXPORT_SYMBOL(reserve_lapic_nmi); @@ -594,3 +610,4 @@ EXPORT_SYMBOL(release_lapic_nmi); EXPORT_SYMBOL(disable_timer_nmi_watchdog); EXPORT_SYMBOL(enable_timer_nmi_watchdog); EXPORT_SYMBOL(touch_nmi_watchdog); +#endif /* CONFIG_XEN */ Index: 2006-07-27/arch/x86_64/kernel/traps-xen.c =================================================================== --- 2006-07-27.orig/arch/x86_64/kernel/traps-xen.c 2006-02-24 10:39:43.000000000 +0100 +++ 2006-07-27/arch/x86_64/kernel/traps-xen.c 2006-07-27 15:11:35.765435096 +0200 @@ -461,8 +461,8 @@ void __kprobes die_nmi(char *str, struct */ printk(str, safe_smp_processor_id()); show_registers(regs); - if (panic_on_timeout || panic_on_oops) - panic("nmi watchdog"); + if (panic_on_oops) + panic("Non-maskable interrupt"); printk("console shuts up ...\n"); oops_end(flags); do_exit(SIGSEGV); @@ -648,7 +648,7 @@ asmlinkage __kprobes void default_do_nmi if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 2, SIGINT) == NOTIFY_STOP) return; -#ifdef CONFIG_X86_LOCAL_APIC +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN) /* * Ok, so this is none of the documented NMI sources, * so it must be the NMI watchdog. Index: 2006-07-27/include/asm-i386/apic.h =================================================================== --- 2006-07-27.orig/include/asm-i386/apic.h 2006-04-03 11:48:19.000000000 +0200 +++ 2006-07-27/include/asm-i386/apic.h 2006-07-27 15:03:07.301733328 +0200 @@ -43,7 +43,7 @@ static inline void lapic_enable(void) } while (0) -#ifdef CONFIG_X86_LOCAL_APIC +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN) /* * Basic functions accessing APICs. @@ -132,18 +132,20 @@ extern unsigned int nmi_watchdog; extern int disable_timer_pin_1; -#ifndef CONFIG_XEN void smp_send_timer_broadcast_ipi(struct pt_regs *regs); void switch_APIC_timer_to_ipi(void *cpumask); void switch_ipi_to_APIC_timer(void *cpumask); #define ARCH_APICTIMER_STOPS_ON_C3 1 -#endif extern int timer_over_8254; -#else /* !CONFIG_X86_LOCAL_APIC */ +#else /* !CONFIG_X86_LOCAL_APIC || CONFIG_XEN */ static inline void lapic_shutdown(void) { } +#ifdef CONFIG_X86_LOCAL_APIC +extern int APIC_init_uniprocessor (void); +#endif + #endif /* !CONFIG_X86_LOCAL_APIC */ #endif /* __ASM_APIC_H */ Index: 2006-07-27/include/asm-i386/apicdef.h =================================================================== --- 2006-07-27.orig/include/asm-i386/apicdef.h 2006-03-20 06:53:29.000000000 +0100 +++ 2006-07-27/include/asm-i386/apicdef.h 2006-07-27 15:13:52.424659736 +0200 @@ -1,6 +1,8 @@ #ifndef __ASM_APICDEF_H #define __ASM_APICDEF_H +#ifndef CONFIG_XEN + /* * Constants for various Intel APICs. (local APIC, IOAPIC, etc.) * @@ -110,8 +112,20 @@ #define APIC_BASE (fix_to_virt(FIX_APIC_BASE)) +#else /* CONFIG_XEN */ + +enum { + APIC_DEST_ALLBUT = 0x1, + APIC_DEST_SELF, + APIC_DEST_ALLINC +}; + +#endif /* CONFIG_XEN */ + #define MAX_IO_APICS 64 +#ifndef CONFIG_XEN + /* * the local APIC register structure, memory mapped. Not terribly well * tested, but we might eventually use this one in the future - the @@ -372,4 +386,6 @@ struct local_apic { #undef u32 +#endif /* CONFIG_XEN */ + #endif Index: 2006-07-27/include/asm-i386/irq.h =================================================================== --- 2006-07-27.orig/include/asm-i386/irq.h 2006-03-20 06:53:29.000000000 +0100 +++ 2006-07-27/include/asm-i386/irq.h 2006-07-27 15:03:07.306732568 +0200 @@ -21,7 +21,7 @@ static __inline__ int irq_canonicalize(i return ((irq == 2) ? 9 : irq); } -#ifdef CONFIG_X86_LOCAL_APIC +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN) # define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */ #endif Index: 2006-07-27/include/asm-i386/mach-xen/asm/fixmap.h =================================================================== --- 2006-07-27.orig/include/asm-i386/mach-xen/asm/fixmap.h 2006-03-13 10:27:08.000000000 +0100 +++ 2006-07-27/include/asm-i386/mach-xen/asm/fixmap.h 2006-07-27 15:03:07.307732416 +0200 @@ -53,7 +53,7 @@ extern unsigned long __FIXADDR_TOP; */ enum fixed_addresses { FIX_HOLE, -#ifdef CONFIG_X86_LOCAL_APIC +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN) FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ #endif #ifdef CONFIG_X86_IO_APIC Index: 2006-07-27/include/asm-i386/mach-xen/asm/smp.h =================================================================== --- 2006-07-27.orig/include/asm-i386/mach-xen/asm/smp.h 2006-02-06 09:28:08.000000000 +0100 +++ 2006-07-27/include/asm-i386/mach-xen/asm/smp.h 2006-07-27 15:03:07.309732112 +0200 @@ -68,7 +68,7 @@ static inline int num_booting_cpus(void) return cpus_weight(cpu_possible_map); } -#ifdef CONFIG_X86_LOCAL_APIC +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN) #ifdef APIC_DEFINITION extern int hard_smp_processor_id(void); Index: 2006-07-27/include/asm-i386/mach-xen/mach_apic.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ 2006-07-27/include/asm-i386/mach-xen/mach_apic.h 2006-07-27 15:03:07.310731960 +0200 @@ -0,0 +1,44 @@ +#ifndef __ASM_MACH_APIC_H +#define __ASM_MACH_APIC_H + +#include +#include + +static inline cpumask_t target_cpus(void) +{ +#ifdef CONFIG_SMP + return cpu_online_map; +#else + return cpumask_of_cpu(0); +#endif +} +#define TARGET_CPUS (target_cpus()) + +#define INT_DELIVERY_MODE dest_LowestPrio +#define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */ + +static inline void clustered_apic_check(void) +{ +} + +static inline int multi_timer_check(int apic, int irq) +{ + return 0; +} + +static inline int apicid_to_node(int logical_apicid) +{ + return 0; +} + +static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask) +{ + return cpus_addr(cpumask)[0]; +} + +static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) +{ + return cpuid_apic >> index_msb; +} + +#endif /* __ASM_MACH_APIC_H */ Index: 2006-07-27/include/asm-x86_64/apic.h =================================================================== --- 2006-07-27.orig/include/asm-x86_64/apic.h 2006-02-20 16:30:07.000000000 +0100 +++ 2006-07-27/include/asm-x86_64/apic.h 2006-07-27 15:03:07.312731656 +0200 @@ -30,7 +30,7 @@ extern int apic_runs_main_timer; printk(s, ##a); \ } while (0) -#ifdef CONFIG_X86_LOCAL_APIC +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN) struct pt_regs; @@ -105,13 +105,16 @@ extern int disable_timer_pin_1; extern void setup_threshold_lvt(unsigned long lvt_off); -#ifndef CONFIG_XEN void smp_send_timer_broadcast_ipi(void); void switch_APIC_timer_to_ipi(void *cpumask); void switch_ipi_to_APIC_timer(void *cpumask); #define ARCH_APICTIMER_STOPS_ON_C3 1 -#endif + +#elif defined(CONFIG_X86_LOCAL_APIC) + +extern int APIC_init_uniprocessor (void); +extern void clustered_apic_check(void); #endif /* CONFIG_X86_LOCAL_APIC */ Index: 2006-07-27/include/asm-x86_64/apicdef.h =================================================================== --- 2006-07-27.orig/include/asm-x86_64/apicdef.h 2006-03-20 06:53:29.000000000 +0100 +++ 2006-07-27/include/asm-x86_64/apicdef.h 2006-07-27 15:03:07.326729528 +0200 @@ -1,6 +1,8 @@ #ifndef __ASM_APICDEF_H #define __ASM_APICDEF_H +#ifndef CONFIG_XEN + /* * Constants for various Intel APICs. (local APIC, IOAPIC, etc.) * @@ -113,7 +115,22 @@ #define APIC_BASE (fix_to_virt(FIX_APIC_BASE)) +#else /* CONFIG_XEN */ + +#define APIC_ALL_CPUS 0xFFu + +enum { + APIC_DEST_ALLBUT = 0x1, + APIC_DEST_SELF, + APIC_DEST_ALLINC +}; + +#endif /* CONFIG_XEN */ + #define MAX_IO_APICS 128 + +#ifndef CONFIG_XEN + #define MAX_LOCAL_APIC 256 /* @@ -388,6 +405,8 @@ struct local_apic { #undef u32 +#endif /* CONFIG_XEN */ + #define BAD_APICID 0xFFu #endif Index: 2006-07-27/include/asm-x86_64/ipi.h =================================================================== --- 2006-07-27.orig/include/asm-x86_64/ipi.h 2006-03-20 06:53:29.000000000 +0100 +++ 2006-07-27/include/asm-x86_64/ipi.h 2006-07-27 15:03:07.329729072 +0200 @@ -23,6 +23,8 @@ #include #include +#ifndef CONFIG_XEN + /* * the following functions deal with sending IPIs between CPUs. * @@ -114,4 +116,6 @@ static inline void send_IPI_mask_sequenc local_irq_restore(flags); } +#endif /* CONFIG_XEN */ + #endif /* __ASM_IPI_H */ Index: 2006-07-27/include/asm-x86_64/mach-xen/asm/fixmap.h =================================================================== --- 2006-07-27.orig/include/asm-x86_64/mach-xen/asm/fixmap.h 2006-03-13 10:27:08.000000000 +0100 +++ 2006-07-27/include/asm-x86_64/mach-xen/asm/fixmap.h 2006-07-27 15:03:07.331728768 +0200 @@ -40,7 +40,7 @@ enum fixed_addresses { VSYSCALL_FIRST_PAGE = VSYSCALL_LAST_PAGE + ((VSYSCALL_END-VSYSCALL_START) >> PAGE_SHIFT) - 1, VSYSCALL_HPET, FIX_HPET_BASE, -#ifdef CONFIG_X86_LOCAL_APIC +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN) FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ #endif #ifdef CONFIG_X86_IO_APIC Index: 2006-07-27/include/asm-x86_64/mach-xen/asm/irq.h =================================================================== --- 2006-07-27.orig/include/asm-x86_64/mach-xen/asm/irq.h 2006-02-01 18:28:39.000000000 +0100 +++ 2006-07-27/include/asm-x86_64/mach-xen/asm/irq.h 2006-07-27 15:03:07.334728312 +0200 @@ -21,7 +21,7 @@ static __inline__ int irq_canonicalize(i return ((irq == 2) ? 9 : irq); } -#ifdef CONFIG_X86_LOCAL_APIC +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN) #define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */ #endif Index: 2006-07-27/include/asm-x86_64/mach-xen/asm/smp.h =================================================================== --- 2006-07-27.orig/include/asm-x86_64/mach-xen/asm/smp.h 2006-02-16 08:27:24.000000000 +0100 +++ 2006-07-27/include/asm-x86_64/mach-xen/asm/smp.h 2006-07-27 15:03:07.336728008 +0200 @@ -71,7 +71,7 @@ static inline int num_booting_cpus(void) #define raw_smp_processor_id() read_pda(cpunumber) -#ifdef CONFIG_X86_LOCAL_APIC +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN) static inline int hard_smp_processor_id(void) { /* we don't want to mark this access volatile - bad code generation */ @@ -133,7 +133,7 @@ static inline int cpu_present_to_apicid( #endif #ifndef __ASSEMBLY__ -#ifdef CONFIG_X86_LOCAL_APIC +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN) static __inline int logical_smp_processor_id(void) { /* we don't want to mark this access volatile - bad code generation */