Skip to contentSkip to conversation

An generic subarchitecture for 2.5.68

PATCH In review Andi Kleen 3 participants 7 messages Apr 27, 2003

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 An generic subarchitecture for 2.5.68

This patch adds an generic x86 subarchitecture. It is intended to provide an dynamic interface for APIC drivers. There are already three subarchitectures (bigsmp, summit, default) that only differ in how they drive the local APIC. A fourth - Unisys ES7000 - is scheduled to be merged soon.

The subarchitecture concept separated this nicely, but it has the big drawback that they are compile time options. A Linux vendor cannot ship own binary kernel rpms for all of these machines. Runtime probing is needed instead.

This patch adds a new "generic" subarchitecture that just acts as a dynamic switching layer for APIC drivers. It only tries to virtualize the APICs, no attempt is made to cover further incompatiblities. This means machines like the Visual Workstation, pc9800 or Voyager are not covered; but these are unlikely to be supported by binary distributions anyways.

The generic arch reuses the existing interface in mach_ipi / mach_mpparse.h / mach_apic.h and just pulls it using some macros into an "struct genapic" object. The main APIC code does not recognize it, it is all hidden in the mach-generic include files.

Auto detection of APIC types is supported in the usual way used by existing ports like Summit - checking ACPI or mptables for specific signatures - or it can be specified by the user using a new "apic=" boot option. I also moved the DMI scan to before the generic subarchitecture probe, so DMI could be used in future too to probe specific machines.

Some minor hacks were needed to avoid circular declaration of a few symbols, but overall it's fairly clean.

The patch has been tested on a Summit machine, an generic 4 virtual CPUs Xeon and on an ES7000.

Patch for 2.5.68+bkcvs

Please consider applying,

-Andi

arch/i386/kernel/timers/Makefile renamed from arch/i386/kernel/timers/Makefile-o +1 -1
diff -u linux-apic/arch/i386/kernel/timers/Makefile-o linux-apic/arch/i386/kernel/timers/Makefile
@@ -4,4 +4,4 @@
 
 obj-y := timer.o timer_none.o timer_tsc.o timer_pit.o
 
-obj-$(CONFIG_X86_SUMMIT)	+= timer_cyclone.o
+obj-$(CONFIG_X86_CYCLONE_TIMER)	+= timer_cyclone.o
arch/i386/kernel/timers/timer.c renamed from arch/i386/kernel/timers/timer.c-o +2 -2
diff -u linux-apic/arch/i386/kernel/timers/timer.c-o linux-apic/arch/i386/kernel/timers/timer.c
@@ -6,12 +6,12 @@
 /* list of externed timers */
 extern struct timer_opts timer_pit;
 extern struct timer_opts timer_tsc;
-#ifdef CONFIG_X86_SUMMIT
+#ifdef CONFIG_X86_CYCLONE_TIMER
 extern struct timer_opts timer_cyclone;
 #endif
 /* list of timers, ordered by preference, NULL terminated */
 static struct timer_opts* timers[] = {
-#ifdef CONFIG_X86_SUMMIT
+#ifdef CONFIG_X86_CYCLONE_TIMER
 	&timer_cyclone,
 #endif
 	&timer_tsc,
arch/i386/kernel/setup.c renamed from arch/i386/kernel/setup.c-o +8 -1
diff -u linux-apic/arch/i386/kernel/setup.c-o linux-apic/arch/i386/kernel/setup.c
@@ -91,6 +91,7 @@
 
 extern void early_cpu_init(void);
 extern void dmi_scan_machine(void);
+extern void generic_apic_probe(char *);
 extern int root_mountflags;
 extern char _text, _etext, _edata, _end;
 extern int blk_nohighio;
@@ -909,6 +910,13 @@
 	smp_alloc_memory(); /* AP processor realmode stacks in low memory*/
 #endif
 	paging_init();
+
+	dmi_scan_machine();
+
+#ifdef CONFIG_X86_GENERICARCH
+	generic_apic_probe(*cmdline_p);
+#endif	
+
 #ifdef CONFIG_ACPI_BOOT
 	/*
 	 * Parse the ACPI tables for possible boot-time SMP configuration.
@@ -930,7 +938,6 @@
 	conswitchp = &dummy_con;
 #endif
 #endif
-	dmi_scan_machine();
 }
 
 static int __init highio_setup(char *str)
arch/i386/kernel/io_apic.c renamed from arch/i386/kernel/io_apic.c-o +6 -2
diff -u linux-apic/arch/i386/kernel/io_apic.c-o linux-apic/arch/i386/kernel/io_apic.c
@@ -280,7 +280,9 @@
 extern unsigned long irq_affinity[NR_IRQS];
 
 static int __cacheline_aligned pending_irq_balance_apicid[NR_IRQS];
-static int irqbalance_disabled = NO_BALANCE_IRQ;
+
+#define IRQBALANCE_CHECK_ARCH -999
+static int irqbalance_disabled = IRQBALANCE_CHECK_ARCH;
 static int physical_balance = 0;
 
 struct irq_cpu_info {
@@ -342,8 +344,10 @@
 	unsigned long allowed_mask;
 	unsigned int new_cpu;
 		
-	if (irqbalance_disabled)
+	if (irqbalance_disabled == IRQBALANCE_CHECK_ARCH && NO_BALANCE_IRQ)
 		return;
+	else if (irqbalance_disabled) 
+		return; 
 
 	allowed_mask = cpu_online_map & irq_affinity[irq];
 	new_cpu = move(cpu, allowed_mask, now, 1);
arch/i386/kernel/mpparse.c renamed from arch/i386/kernel/mpparse.c-o +2 -0
diff -u linux-apic/arch/i386/kernel/mpparse.c-o linux-apic/arch/i386/kernel/mpparse.c
@@ -73,7 +73,9 @@
 /* Bitmask of physically existing CPUs */
 unsigned long phys_cpu_present_map;
 
+#ifndef CONFIG_X86_GENERICARCH
 int x86_summit = 0;
+#endif
 u8 bios_cpu_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID };
 
 /*
arch/i386/kernel/smp.c renamed from arch/i386/kernel/smp.c-o +3 -3
diff -u linux-apic/arch/i386/kernel/smp.c-o linux-apic/arch/i386/kernel/smp.c
@@ -123,7 +123,7 @@
 	return SET_APIC_DEST_FIELD(mask);
 }
 
-static inline void __send_IPI_shortcut(unsigned int shortcut, int vector)
+inline void __send_IPI_shortcut(unsigned int shortcut, int vector)
 {
 	/*
 	 * Subtle. In the case of the 'never do double writes' workaround
@@ -155,7 +155,7 @@
 	__send_IPI_shortcut(APIC_DEST_SELF, vector);
 }
 
-static inline void send_IPI_mask_bitmask(int mask, int vector)
+inline void send_IPI_mask_bitmask(int mask, int vector)
 {
 	unsigned long cfg;
 	unsigned long flags;
@@ -186,7 +186,7 @@
 	local_irq_restore(flags);
 }
 
-static inline void send_IPI_mask_sequence(int mask, int vector)
+inline void send_IPI_mask_sequence(int mask, int vector)
 {
 	unsigned long cfg, flags;
 	unsigned int query_cpu, query_mask;
arch/i386/mach-generic/default.c renamed from arch/i386/mach-generic/default.c-o +22 -0
diff -u linux-apic/arch/i386/mach-generic/default.c-o linux-apic/arch/i386/mach-generic/default.c
@@ -0,0 +1,22 @@
+/* 
+ * Default generic APIC driver. This handles upto 8 CPUs.
+ */
+#define APIC_DEFINITION 1
+#include <asm/genapic.h>
+#include <asm/fixmap.h>
+#include <asm/apicdef.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/smp.h>
+#include <linux/init.h>
+#include <asm/mach-default/mach_apic.h>
+#include <asm/mach-default/mach_ipi.h>
+#include <asm/mach-default/mach_mpparse.h>
+
+/* should be called last. */
+static __init int probe_default(void)
+{ 
+	return 1;
+} 
+
+struct genapic apic_default = APIC_INIT("default", probe_default); 
arch/i386/mach-generic/Makefile renamed from arch/i386/mach-generic/Makefile-o +9 -0
diff -u linux-apic/arch/i386/mach-generic/Makefile-o linux-apic/arch/i386/mach-generic/Makefile
@@ -0,0 +1,9 @@
+#
+# Makefile for the generic architecture
+#
+
+EXTRA_CFLAGS	+= -I../kernel
+
+obj-y				:= probe.o summit.o bigsmp.o default.o
+
+
arch/i386/mach-generic/summit.c renamed from arch/i386/mach-generic/summit.c-o +22 -0
diff -u linux-apic/arch/i386/mach-generic/summit.c-o linux-apic/arch/i386/mach-generic/summit.c
@@ -0,0 +1,22 @@
+/* 
+ * APIC driver for the IBM "Summit" chipset.
+ */
+#define APIC_DEFINITION 1
+#include <asm/genapic.h>
+#include <asm/fixmap.h>
+#include <asm/apicdef.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/smp.h>
+#include <linux/init.h>
+#include <asm/mach-summit/mach_apic.h>
+#include <asm/mach-summit/mach_ipi.h>
+#include <asm/mach-summit/mach_mpparse.h>
+
+static __init int probe_summit(void)
+{ 
+	/* probed later in mptable/ACPI hooks */
+	return 0;
+} 
+
+struct genapic apic_summit = APIC_INIT("summit", probe_summit); 
arch/i386/mach-generic/bigsmp.c renamed from arch/i386/mach-generic/bigsmp.c-o +23 -0
diff -u linux-apic/arch/i386/mach-generic/bigsmp.c-o linux-apic/arch/i386/mach-generic/bigsmp.c
@@ -0,0 +1,23 @@
+/* 
+ * APIC driver for "bigsmp" XAPIC machines with more than 8 virtual CPUs.
+ * Drives the local APIC in "clustered mode".
+ */
+#define APIC_DEFINITION 1
+#include <asm/genapic.h>
+#include <asm/fixmap.h>
+#include <asm/apicdef.h>
+#include <linux/kernel.h>
+#include <linux/smp.h>
+#include <linux/init.h>
+#include <asm/mach-bigsmp/mach_apic.h>
+#include <asm/mach-bigsmp/mach_ipi.h>
+#include <asm/mach-default/mach_mpparse.h>
+
+int dmi_bigsmp; /* can be set by dmi scanners */
+
+static __init int probe_bigsmp(void)
+{ 
+	return dmi_bigsmp; 
+} 
+
+struct genapic apic_bigsmp = APIC_INIT("bigsmp", probe_bigsmp); 
arch/i386/mach-generic/probe.c renamed from arch/i386/mach-generic/probe.c-o +96 -0

96 lines not on this page · raw message

arch/i386/Makefile renamed from arch/i386/Makefile-o +5 -0
diff -u linux-apic/arch/i386/Makefile-o linux-apic/arch/i386/Makefile
@@ -73,6 +73,11 @@
 mflags-$(CONFIG_X86_SUMMIT) := -Iinclude/asm-i386/mach-summit
 mcore-$(CONFIG_X86_SUMMIT)  := mach-default
 
+# generic subarchitecture
+mflags-$(CONFIG_X86_GENERICARCH) := -Iinclude/asm-i386/mach-generic
+mcore-$(CONFIG_X86_GENERICARCH) := mach-default
+core-$(CONFIG_X86_GENERICARCH) += arch/i386/mach-generic/
+
 # default subarch .h files
 mflags-y += -Iinclude/asm-i386/mach-default
 
arch/i386/Kconfig renamed from arch/i386/Kconfig-o +17 -7
diff -u linux-apic/arch/i386/Kconfig-o linux-apic/arch/i386/Kconfig
@@ -71,11 +71,6 @@
 
 	  If you don't have one of these computers, you should say N here.
 
-config ACPI_SRAT
-	bool
-	default y
-	depends on NUMA && X86_SUMMIT
-
 config X86_BIGSMP
 	bool "Support for other sub-arch SMP systems with more than 8 CPUs"
 	help
@@ -95,8 +90,23 @@
 	  A kernel compiled for the Visual Workstation will not run on PCs
 	  and vice versa. See <file:Documentation/sgi-visws.txt> for details.
 
+config X86_GENERICARCH
+       bool "Generic architecture (Summit, bigsmp, default)"
+       help
+          This option compiles in the Summit, bigsmp, default subarchitectures.
+	  It is intended for a generic binary kernel.
+
 endchoice
 
+config ACPI_SRAT
+	bool
+	default y
+	depends on NUMA && (X86_SUMMIT || X86_GENERICARCH)
+
+config X86_CYCLONE_TIMER
+       bool 
+       default y
+       depends on X86_SUMMIT || X86_GENERICARCH
 
 choice
 	prompt "Processor family"
@@ -669,7 +679,7 @@
 # Common NUMA Features
 config NUMA
 	bool "Numa Memory Allocation Support"
-	depends on SMP && HIGHMEM64G && (X86_PC || X86_NUMAQ || (X86_SUMMIT && ACPI && !ACPI_HT_ONLY))
+	depends on SMP && HIGHMEM64G && (X86_PC || X86_NUMAQ || X86_GENERICARCH || (X86_SUMMIT && ACPI && !ACPI_HT_ONLY))
 	default n if X86_PC
 	default y if (X86_NUMAQ || X86_SUMMIT)
 
@@ -767,7 +777,7 @@
 # Summit needs it only when NUMA is on
 config BOOT_IOREMAP
 	bool
-	depends on (X86_SUMMIT && NUMA)
+	depends on ((X86_SUMMIT || X86_GENERICARCH) && NUMA)
 	default y
 
 endmenu
include/asm-i386/mach-bigsmp/mach_apic.h renamed from include/asm-i386/mach-bigsmp/mach_apic.h-o +23 -4
diff -u linux-apic/include/asm-i386/mach-bigsmp/mach_apic.h-o linux-apic/include/asm-i386/mach-bigsmp/mach_apic.h
@@ -15,18 +15,28 @@
 
 static inline int apic_id_registered(void)
 {
-	        return (1);
+	return (1);
 }
 
 #define APIC_DFR_VALUE	(APIC_DFR_CLUSTER)
-#define TARGET_CPUS	((cpu_online_map < 0xf)?cpu_online_map:0xf)
+static inline unsigned long target_cpus(void)
+{ 
+	return ((cpu_online_map < 0xf)?cpu_online_map:0xf);
+}
+#define TARGET_CPUS	(target_cpus())
 
 #define INT_DELIVERY_MODE dest_LowestPrio
 #define INT_DEST_MODE 1     /* logical delivery broadcast to all procs */
 
 #define APIC_BROADCAST_ID     (0x0f)
-#define check_apicid_used(bitmap, apicid) (0)
-#define check_apicid_present(bit) (phys_cpu_present_map & (1 << bit))
+static inline unsigned long check_apicid_used(unsigned long bitmap, int apicid) 
+{ 
+	return 0;
+} 
+static inline unsigned long check_apicid_present(int bit) 
+{ 
+	return (phys_cpu_present_map & (1 << bit));
+}
 
 static inline unsigned long calculate_ldr(unsigned long old)
 {
@@ -115,4 +125,13 @@
 	return (1);
 }
 
+#define		APIC_ID_MASK		(0x0F<<24)
+
+static inline unsigned get_apic_id(unsigned long x) 
+{ 
+	return (((x)>>24)&0x0F);
+} 
+
+#define		GET_APIC_ID(x)	get_apic_id(x)
+
 #endif /* __ASM_MACH_APIC_H */
include/asm-i386/mach-bigsmp/mach_ipi.h renamed from include/asm-i386/mach-bigsmp/mach_ipi.h-o +1 -1
diff -u linux-apic/include/asm-i386/mach-bigsmp/mach_ipi.h-o linux-apic/include/asm-i386/mach-bigsmp/mach_ipi.h
@@ -1,7 +1,7 @@
 #ifndef __ASM_MACH_IPI_H
 #define __ASM_MACH_IPI_H
 
-static inline void send_IPI_mask_sequence(int mask, int vector);
+inline void send_IPI_mask_sequence(int mask, int vector);
 
 static inline void send_IPI_mask(int mask, int vector)
 {
include/asm-i386/mach-default/mach_mpparse.h renamed from include/asm-i386/mach-default/mach_mpparse.h-o +4 -2
diff -u linux-apic/include/asm-i386/mach-default/mach_mpparse.h-o linux-apic/include/asm-i386/mach-default/mach_mpparse.h
@@ -12,14 +12,16 @@
 {
 }
 
-static inline void mps_oem_check(struct mp_config_table *mpc, char *oem, 
+static inline int mps_oem_check(struct mp_config_table *mpc, char *oem, 
 		char *productid)
 {
+	return 0;
 }
 
 /* Hook from generic ACPI tables.c */
-static inline void acpi_madt_oem_check(char *oem_id, char *oem_table_id)
+static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 {
+	return 0;
 }
 
 
include/asm-i386/mach-default/mach_apic.h renamed from include/asm-i386/mach-default/mach_apic.h-o +29 -8
diff -u linux-apic/include/asm-i386/mach-default/mach_apic.h-o linux-apic/include/asm-i386/mach-default/mach_apic.h
@@ -3,11 +3,15 @@
 
 #define APIC_DFR_VALUE	(APIC_DFR_FLAT)
 
+static inline unsigned long target_cpus(void)
+{ 
 #ifdef CONFIG_SMP
- #define TARGET_CPUS (cpu_online_map)
+	return cpu_online_map;
 #else
- #define TARGET_CPUS 0x01
+	return 1; 
 #endif
+} 
+#define TARGET_CPUS (target_cpus())
 
 #define NO_BALANCE_IRQ (0)
 #define esr_disable (0)
@@ -16,13 +20,15 @@
 #define INT_DEST_MODE 1     /* logical delivery broadcast to all procs */
 
 #define APIC_BROADCAST_ID      0x0F
-#define check_apicid_used(bitmap, apicid) (bitmap & (1 << apicid))
-#define check_apicid_present(bit) (phys_cpu_present_map & (1 << bit))
 
-static inline int apic_id_registered(void)
+static inline unsigned long check_apicid_used(unsigned long bitmap, int apicid) 
+{ 
+	return (bitmap & (1UL << apicid)); 
+} 
+
+static inline unsigned long check_apicid_present(int bit) 
 {
-	return (test_bit(GET_APIC_ID(apic_read(APIC_ID)), 
-						&phys_cpu_present_map));
+	return (phys_cpu_present_map & (1UL << bit));
 }
 
 /*
@@ -42,7 +48,7 @@
 	apic_write_around(APIC_LDR, val);
 }
 
-static inline ulong ioapic_phys_id_map(ulong phys_map)
+static inline unsigned long ioapic_phys_id_map(unsigned long phys_map)
 {
 	return phys_map;
 }
@@ -99,4 +105,19 @@
 	return test_bit(boot_cpu_physical_apicid, &phys_cpu_present_map);
 }
 
+#define		APIC_ID_MASK		(0xF<<24)
+
+static inline unsigned get_apic_id(unsigned long x) 
+{ 
+	return (((x)>>24)&0xF);
+} 
+
+#define		GET_APIC_ID(x)	get_apic_id(x)
+
+static inline int apic_id_registered(void)
+{
+	return (test_bit(GET_APIC_ID(apic_read(APIC_ID)), 
+						&phys_cpu_present_map));
+}
+
 #endif /* __ASM_MACH_APIC_H */
include/asm-i386/mach-default/mach_ipi.h renamed from include/asm-i386/mach-default/mach_ipi.h-o +2 -2
diff -u linux-apic/include/asm-i386/mach-default/mach_ipi.h-o linux-apic/include/asm-i386/mach-default/mach_ipi.h
@@ -1,8 +1,8 @@
 #ifndef __ASM_MACH_IPI_H
 #define __ASM_MACH_IPI_H
 
-static inline void send_IPI_mask_bitmask(int mask, int vector);
-static inline void __send_IPI_shortcut(unsigned int shortcut, int vector);
+inline void send_IPI_mask_bitmask(int mask, int vector);
+inline void __send_IPI_shortcut(unsigned int shortcut, int vector);
 
 static inline void send_IPI_mask(int mask, int vector)
 {
include/asm-i386/mach-summit/mach_mpparse.h renamed from include/asm-i386/mach-summit/mach_mpparse.h-o +10 -2
diff -u linux-apic/include/asm-i386/mach-summit/mach_mpparse.h-o linux-apic/include/asm-i386/mach-summit/mach_mpparse.h
@@ -14,26 +14,34 @@
 {
 }
 
-static inline void mps_oem_check(struct mp_config_table *mpc, char *oem, 
+static inline int mps_oem_check(struct mp_config_table *mpc, char *oem, 
 		char *productid)
 {
 	if (!strncmp(oem, "IBM ENSW", 8) && 
 			(!strncmp(productid, "VIGIL SMP", 9) 
 			 || !strncmp(productid, "EXA", 3)
 			 || !strncmp(productid, "RUTHLESS SMP", 12))){
+#ifndef CONFIG_X86_GENERICARCH
 		x86_summit = 1;
+#endif
 		use_cyclone = 1; /*enable cyclone-timer*/
+		return 1;
 	}
+	return 0;
 }
 
 /* Hook from generic ACPI tables.c */
-static inline void acpi_madt_oem_check(char *oem_id, char *oem_table_id)
+static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 {
 	if (!strncmp(oem_id, "IBM", 3) &&
 	    (!strncmp(oem_table_id, "SERVIGIL", 8)
 	     || !strncmp(oem_table_id, "EXA", 3))){
+#ifndef CONFIG_X86_GENERICARCH
 		x86_summit = 1;
+#endif
 		use_cyclone = 1; /*enable cyclone-timer*/
+		return 1;
 	}
+	return 0;
 }
 #endif /* __ASM_MACH_MPPARSE_H */
include/asm-i386/mach-summit/mach_apic.h renamed from include/asm-i386/mach-summit/mach_apic.h-o +35 -6

66 lines not on this page · raw message

include/asm-i386/mach-summit/mach_ipi.h renamed from include/asm-i386/mach-summit/mach_ipi.h-o +1 -1
diff -u linux-apic/include/asm-i386/mach-summit/mach_ipi.h-o linux-apic/include/asm-i386/mach-summit/mach_ipi.h
@@ -1,7 +1,7 @@
 #ifndef __ASM_MACH_IPI_H
 #define __ASM_MACH_IPI_H
 
-static inline void send_IPI_mask_sequence(int mask, int vector);
+inline void send_IPI_mask_sequence(int mask, int vector);
 
 static inline void send_IPI_mask(int mask, int vector)
 {
include/asm-i386/mach-generic/mach_apic.h renamed from include/asm-i386/mach-generic/mach_apic.h-o +30 -0
diff -u linux-apic/include/asm-i386/mach-generic/mach_apic.h-o linux-apic/include/asm-i386/mach-generic/mach_apic.h
@@ -0,0 +1,30 @@
+#ifndef __ASM_MACH_APIC_H
+#define __ASM_MACH_APIC_H
+
+#include <asm/genapic.h>
+
+#define esr_disable (genapic->esr_disable)
+#define NO_BALANCE_IRQ (genapic->no_balance_irq)
+#define APIC_BROADCAST_ID (genapic->apic_broadcast_id)
+#define INT_DELIVERY_MODE (genapic->int_delivery_mode)
+#define INT_DEST_MODE (genapic->int_dest_mode)
+#define TARGET_CPUS	  (genapic->target_cpus())
+#define apic_id_registered (genapic->apic_id_registered)
+#define apic_id_registered (genapic->apic_id_registered)
+#define init_apic_ldr (genapic->init_apic_ldr)
+#define ioapic_phys_id_map (genapic->ioapic_phys_id_map)
+#define clustered_apic_check (genapic->clustered_apic_check) 
+#define multi_timer_check (genapic->multi_timer_check)
+#define apicid_to_node (genapic->apicid_to_node)
+#define cpu_to_logical_apicid (genapic->cpu_to_logical_apicid) 
+#define cpu_present_to_apicid (genapic->cpu_present_to_apicid)
+#define apicid_to_cpu_present (genapic->apicid_to_cpu_present)
+#define mpc_apic_id (genapic->mpc_apic_id) 
+#define setup_portio_remap (genapic->setup_portio_remap)
+#define check_apicid_present (genapic->check_apicid_present)
+#define check_phys_apicid_present (genapic->check_phys_apicid_present)
+#define check_apicid_used (genapic->check_apicid_used)
+#define GET_APIC_ID (genapic->get_apic_id)
+#define APIC_ID_MASK (genapic->apic_id_mask)
+
+#endif /* __ASM_MACH_APIC_H */
include/asm-i386/mach-generic/mach_ipi.h renamed from include/asm-i386/mach-generic/mach_ipi.h-o +10 -0
diff -u linux-apic/include/asm-i386/mach-generic/mach_ipi.h-o linux-apic/include/asm-i386/mach-generic/mach_ipi.h
@@ -0,0 +1,10 @@
+#ifndef _MACH_IPI_H
+#define _MACH_IPI_H 1
+
+#include <asm/genapic.h>
+
+#define send_IPI_mask (genapic->send_IPI_mask)
+#define send_IPI_allbutself (genapic->send_IPI_allbutself)
+#define send_IPI_all (genapic->send_IPI_all)
+
+#endif
include/asm-i386/mach-generic/mach_mpparse.h renamed from include/asm-i386/mach-generic/mach_mpparse.h-o +12 -0
diff -u linux-apic/include/asm-i386/mach-generic/mach_mpparse.h-o linux-apic/include/asm-i386/mach-generic/mach_mpparse.h
@@ -0,0 +1,12 @@
+#ifndef _MACH_MPPARSE_H
+#define _MACH_MPPARSE_H 1
+
+#include <asm/genapic.h>
+
+#define mpc_oem_bus_info (genapic->mpc_oem_bus_info)
+#define mpc_oem_pci_bus (genapic->mpc_oem_pci_bus)
+
+int mps_oem_check(struct mp_config_table *mpc, char *oem, char *productid); 
+int acpi_madt_oem_check(char *oem_id, char *oem_table_id); 
+
+#endif
include/asm-i386/fixmap.h renamed from include/asm-i386/fixmap.h-o +1 -1
diff -u linux-apic/include/asm-i386/fixmap.h-o linux-apic/include/asm-i386/fixmap.h
@@ -60,7 +60,7 @@
 #ifdef CONFIG_X86_F00F_BUG
 	FIX_F00F_IDT,	/* Virtual mapping for IDT */
 #endif
-#ifdef CONFIG_X86_SUMMIT
+#ifdef CONFIG_X86_CYCLONE_TIMER
 	FIX_CYCLONE_TIMER, /*cyclone timer register*/
 #endif 
 #ifdef CONFIG_HIGHMEM
include/asm-i386/smp.h renamed from include/asm-i386/smp.h-o +7 -1
diff -u linux-apic/include/asm-i386/smp.h-o linux-apic/include/asm-i386/smp.h
@@ -87,11 +87,17 @@
 	return -1;
 }
 #ifdef CONFIG_X86_LOCAL_APIC
-static __inline int hard_smp_processor_id(void)
+
+#ifdef APIC_DEFINITION
+extern int hard_smp_processor_id(void);
+#else
+#include <mach_apic.h>
+static inline int hard_smp_processor_id(void)
 {
 	/* we don't want to mark this access volatile - bad code generation */
 	return GET_APIC_ID(*(unsigned long *)(APIC_BASE+APIC_ID));
 }
+#endif
 
 static __inline int logical_smp_processor_id(void)
 {
include/asm-i386/mpspec.h renamed from include/asm-i386/mpspec.h-o +1 -1
diff -u linux-apic/include/asm-i386/mpspec.h-o linux-apic/include/asm-i386/mpspec.h
@@ -16,7 +16,7 @@
 /*
  * a maximum of 16 APICs with the current APIC ID architecture.
  */
-#if defined(CONFIG_X86_NUMAQ) || defined (CONFIG_X86_SUMMIT)
+#if defined(CONFIG_X86_NUMAQ) || defined (CONFIG_X86_SUMMIT) || defined(CONFIG_X86_GENERICARCH)
 #define MAX_APICS 256
 #else
 #define MAX_APICS 16
include/asm-i386/apicdef.h renamed from include/asm-i386/apicdef.h-o +0 -7
diff -u linux-apic/include/asm-i386/apicdef.h-o linux-apic/include/asm-i386/apicdef.h
@@ -11,13 +11,6 @@
 #define		APIC_DEFAULT_PHYS_BASE	0xfee00000
  
 #define		APIC_ID		0x20
-#ifdef CONFIG_X86_SUMMIT
- #define		APIC_ID_MASK		(0xFF<<24)
- #define		GET_APIC_ID(x)		(((x)>>24)&0xFF)
-#else
- #define		APIC_ID_MASK		(0x0F<<24)
- #define		GET_APIC_ID(x)		(((x)>>24)&0x0F)
-#endif
 #define		APIC_LVR	0x30
 #define			APIC_LVR_MASK		0xFF00FF
 #define			GET_APIC_VERSION(x)	((x)&0xFF)
include/asm-i386/numnodes.h renamed from include/asm-i386/numnodes.h-o +1 -1
diff -u linux-apic/include/asm-i386/numnodes.h-o linux-apic/include/asm-i386/numnodes.h
@@ -5,7 +5,7 @@
 
 #ifdef CONFIG_X86_NUMAQ
 #include <asm/numaq.h>
-#elif CONFIG_X86_SUMMIT
+#elif CONFIG_NUMA
 #include <asm/srat.h>
 #else
 #define MAX_NUMNODES	1
include/asm-i386/mmzone.h renamed from include/asm-i386/mmzone.h-o +1 -1
diff -u linux-apic/include/asm-i386/mmzone.h-o linux-apic/include/asm-i386/mmzone.h
@@ -120,7 +120,7 @@
 
 #ifdef CONFIG_X86_NUMAQ
 #include <asm/numaq.h>
-#elif CONFIG_X86_SUMMIT
+#elif CONFIG_NUMA	/* summit or generic arch */
 #include <asm/srat.h>
 #elif CONFIG_X86_PC
 #define get_memcfg_numa get_memcfg_numa_flat
include/asm-i386/genapic.h renamed from include/asm-i386/genapic.h-o +106 -0

106 lines not on this page · raw message

author
#2 lore raw
Quoted 9 lines · Andrew Morton
Quoted 3 lines · Andi Kleen

This patch adds an generic x86 subarchitecture.

It causes a large number of compilation errors with the config at
http://www.zip.com.au/~akpm/linux/patches/stuff/config

Some Kconfig help would be nice...

Ah - you didn't compile it with CONFIG_SMP. Ok, that was not tested and frankly doesn't make any sense because you don't need an APIC driver for > 8 CPUs for an UP kernel.

Really BIGSMP, SUMMIT, GENERICARCH need to be only enabled with SMP is enabled.

But Kconfig seems to ignore depends inside choice. Roman, any ideas how to fix that?

-Andi

#3 lore raw

Hi,

Quoted 5 lines · Andi Kleen

Really BIGSMP, SUMMIT, GENERICARCH need to be only enabled with SMP is enabled.

But Kconfig seems to ignore depends inside choice. Roman, any ideas how to fix that?

What did you try? E.g. this works fine here:

config X86_BIGSMP
bool "Support for other sub-arch SMP systems with more than 8 CPUs" depends on SMP
help
...

bye, Roman

author
#4 lore raw
Quoted 10 lines · Roman Zippel

Hi,

Quoted 5 lines · Andi Kleen

Really BIGSMP, SUMMIT, GENERICARCH need to be only enabled with SMP is enabled.

But Kconfig seems to ignore depends inside choice. Roman, any ideas how to fix that?

Quoted 7 lines

What did you try? E.g. this works fine here:

config X86_BIGSMP
bool "Support for other sub-arch SMP systems with more than 8 CPUs" depends on SMP
help
...

I made GENERICARCH depend on SMP and it was still defined after an make oldconfig

-Andi

author
#5 lore raw
Quoted 2 lines

I made GENERICARCH depend on SMP and it was still defined after an make oldconfig

Never mind. It was a typo on my side.

-Andi

author
#6 lore raw
In reply to Andrew Morton
Quoted 9 lines · Andrew Morton
Quoted 3 lines · Andi Kleen

This patch adds an generic x86 subarchitecture.

It causes a large number of compilation errors with the config at
http://www.zip.com.au/~akpm/linux/patches/stuff/config

Some Kconfig help would be nice...

This incremental patch fixes it by just disallowing SMP in the dependencies.

-Andi

arch/i386/Kconfig renamed from arch/i386/Kconfig-o +3 -0
@@ -66,6 +66,7 @@
 
 config X86_SUMMIT
 	bool "Summit/EXA (IBM x440)"
+	depends on SMP
 	help
 	  This option is needed for IBM systems that use the Summit/EXA chipset.
 	  In particular, it is needed for the x440.
@@ -74,6 +75,7 @@
 
 config X86_BIGSMP
 	bool "Support for other sub-arch SMP systems with more than 8 CPUs"
+	depends on SMP
 	help
 	  This option is needed for the systems that have more than 8 CPUs
 	  and if the system is not of any sub-arch type above.
@@ -93,6 +95,7 @@
 
 config X86_GENERICARCH
        bool "Generic architecture (Summit, bigsmp, default)"
+       depends on SMP
        help
           This option compiles in the Summit, bigsmp, default subarchitectures.
 	  It is intended for a generic binary kernel.