Skip to contentSkip to conversation

linux/x86: Disable all accesses to the local APIC page

PATCH New Jan Beulich 1 participant 1 message Jul 27, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 linux/x86: Disable all accesses to the local APIC page

While the original problem that triggered the creation of this patch was in the 3.0-testing tree (and has not been applicable to the -unstable one after the introduction of xenoprof), the cleanup done here should still be merged to prevent other similar problems: With all the APIC related definitions left intact, there was no way to determine at build time if there was actually a user of these, and if occasionally a code path using these then gets actually run, the domain would oops at best. Additionally, cleanup like this manages or at least helps to eliminate dead code.

Subject: Disallow all accesses to the local APIC page

arch/i386/kernel/acpi/boot-xen.c +7 -1
Index: 2006-07-27/arch/i386/kernel/acpi/boot-xen.c
===================================================================
@@ -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);
arch/i386/kernel/acpi/earlyquirk.c +2 -0
Index: 2006-07-27/arch/i386/kernel/acpi/earlyquirk.c
===================================================================
@@ -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;
 }
 
arch/i386/kernel/apic-xen.c +2 -0
Index: 2006-07-27/arch/i386/kernel/apic-xen.c
===================================================================
@@ -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)
arch/i386/kernel/io_apic-xen.c +6 -0
Index: 2006-07-27/arch/i386/kernel/io_apic-xen.c
===================================================================
@@ -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
arch/i386/kernel/mpparse-xen.c +8 -2
Index: 2006-07-27/arch/i386/kernel/mpparse-xen.c
===================================================================
@@ -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 (
arch/i386/kernel/nmi.c +21 -3
Index: 2006-07-27/arch/i386/kernel/nmi.c
===================================================================
@@ -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
arch/i386/kernel/setup-xen.c +1 -1
Index: 2006-07-27/arch/i386/kernel/setup-xen.c
===================================================================
@@ -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;
 
arch/i386/kernel/smp-xen.c +2 -0
Index: 2006-07-27/arch/i386/kernel/smp-xen.c
===================================================================
@@ -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]);
 
arch/i386/kernel/traps-xen.c +1 -1
Index: 2006-07-27/arch/i386/kernel/traps-xen.c
===================================================================
@@ -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.
arch/x86_64/kernel/Makefile +2 -1
Index: 2006-07-27/arch/x86_64/kernel/Makefile
===================================================================
@@ -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
 
arch/x86_64/kernel/apic-xen.c +0 -130

142 lines not on this page · raw message

arch/x86_64/kernel/genapic-xen.c +2 -2
Index: 2006-07-27/arch/x86_64/kernel/genapic-xen.c
===================================================================
@@ -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
 }
arch/x86_64/kernel/genapic_xen.c +4 -5
Index: 2006-07-27/arch/x86_64/kernel/genapic_xen.c
===================================================================
@@ -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,
arch/x86_64/kernel/head64-xen.c +1 -1
Index: 2006-07-27/arch/x86_64/kernel/head64-xen.c
===================================================================
@@ -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
arch/x86_64/kernel/io_apic-xen.c +1 -1
Index: 2006-07-27/arch/x86_64/kernel/io_apic-xen.c
===================================================================
@@ -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 */
arch/x86_64/kernel/mpparse-xen.c +8 -3
Index: 2006-07-27/arch/x86_64/kernel/mpparse-xen.c
===================================================================
@@ -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 (
arch/x86_64/kernel/nmi.c +17 -0
Index: 2006-07-27/arch/x86_64/kernel/nmi.c
===================================================================
@@ -35,6 +35,8 @@
 #include <asm/kdebug.h>
 #include <asm/local.h>
 
+#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 */
arch/x86_64/kernel/traps-xen.c +3 -3
Index: 2006-07-27/arch/x86_64/kernel/traps-xen.c
===================================================================
@@ -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.
include/asm-i386/apic.h +6 -4
Index: 2006-07-27/include/asm-i386/apic.h
===================================================================
@@ -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 */
include/asm-i386/apicdef.h +16 -0
Index: 2006-07-27/include/asm-i386/apicdef.h
===================================================================
@@ -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
include/asm-i386/irq.h +1 -1
Index: 2006-07-27/include/asm-i386/irq.h
===================================================================
@@ -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
 
include/asm-i386/mach-xen/asm/fixmap.h +1 -1
Index: 2006-07-27/include/asm-i386/mach-xen/asm/fixmap.h
===================================================================
@@ -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
include/asm-i386/mach-xen/asm/smp.h +1 -1
Index: 2006-07-27/include/asm-i386/mach-xen/asm/smp.h
===================================================================
@@ -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);
include/asm-i386/mach-xen/mach_apic.h new file +44 -0

44 lines not on this page · raw message

include/asm-x86_64/apic.h +6 -3
Index: 2006-07-27/include/asm-x86_64/apic.h
===================================================================
@@ -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 */
 
include/asm-x86_64/apicdef.h +19 -0
Index: 2006-07-27/include/asm-x86_64/apicdef.h
===================================================================
@@ -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
include/asm-x86_64/ipi.h +4 -0
Index: 2006-07-27/include/asm-x86_64/ipi.h
===================================================================
@@ -23,6 +23,8 @@
 #include <asm/apicdef.h>
 #include <asm/genapic.h>
 
+#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 */
include/asm-x86_64/mach-xen/asm/fixmap.h +1 -1
Index: 2006-07-27/include/asm-x86_64/mach-xen/asm/fixmap.h
===================================================================
@@ -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
include/asm-x86_64/mach-xen/asm/irq.h +1 -1
Index: 2006-07-27/include/asm-x86_64/mach-xen/asm/irq.h
===================================================================
@@ -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
 
include/asm-x86_64/mach-xen/asm/smp.h +2 -2
Index: 2006-07-27/include/asm-x86_64/mach-xen/asm/smp.h
===================================================================
@@ -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 */

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel