public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* setup_ioapic_ids_from_mpc()
@ 2003-01-19 13:01 William Lee Irwin III
  2003-01-19 13:15 ` setup_ioapic_ids_from_mpc() William Lee Irwin III
  2003-01-20  1:19 ` setup_ioapic_ids_from_mpc() William Lee Irwin III
  0 siblings, 2 replies; 6+ messages in thread
From: William Lee Irwin III @ 2003-01-19 13:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: Martin.Bligh

By means of Zen, voodoo, and guessing the method from the results, I
came to a conclusion somewhat resembling this patch.

Since this has approximately zero resemblance to the "Pee Cee" case,
I think it best to avoid crossdressing the box to get it to survive
IO-APIC init and just break off our own version which blindly trusts
the BIOS and doesn't panic() at the drop of a hat, much unlike the
Pee Cee version. It also runs (mostly) silent, which I consider a bonus.

100% untested. I'll spin it sometime tomorrow.


-- wli

===== arch/i386/kernel/io_apic.c 1.40 vs edited =====
--- 1.40/arch/i386/kernel/io_apic.c	Tue Jan 14 03:02:28 2003
+++ edited/arch/i386/kernel/io_apic.c	Sun Jan 19 04:59:04 2003
@@ -1132,7 +1132,40 @@
  * by Matt Domsch <Matt_Domsch@dell.com>  Tue Dec 21 12:25:05 CST 1999
  */
 
-static void __init setup_ioapic_ids_from_mpc (void)
+#ifdef CONFIG_X86_NUMAQ
+static void __init setup_ioapic_ids_from_mpc(void)
+{
+	int io_apic;
+
+	for (io_apic = 0; io_apic < nr_ioapics; ++io_apic) {
+		struct IO_APIC_reg_00 reg;
+		int node, local, global, *regval = (int *)&reg;
+
+		global = mp_ioapics[apic].mpc_apicid;
+		for (node = 0; node < MAX_NUMNODES; ++node) {
+			if (mp_ioapic_id_map[node][0][0] == global)
+				local = mp_ioapic_id_map[node][0][1];
+			else if (mp_ioapic_id_map[node][1][0] == global)
+				local = mp_ioapic_id_map[node][1][1];
+		}
+
+		if (!local) {
+			printk("mystery IO-APIC, it will die\n");
+			continue;
+		}
+
+		
+		spin_lock_irqsave(&ioapic_lock, flags);
+		*regval = io_apic_read(apic, 0);
+		if (reg.ID != local) {
+			reg.ID = local;
+			io_apic_write(apic, 0, *regval);
+		}
+		spin_unlock_irqrestore(&ioapic_lock, flags);
+	}
+}
+#else /* !CONFIG_X86_NUMAQ */
+static void __init setup_ioapic_ids_from_mpc(void)
 {
 	struct IO_APIC_reg_00 reg_00;
 	unsigned long phys_id_present_map;
@@ -1225,6 +1258,7 @@
 			printk(" ok.\n");
 	}
 }
+#endif
 
 /*
  * There is a nasty bug in some older SMP boards, their mptable lies
===== arch/i386/kernel/mpparse.c 1.32 vs edited =====
--- 1.32/arch/i386/kernel/mpparse.c	Mon Jan 13 16:41:17 2003
+++ edited/arch/i386/kernel/mpparse.c	Sun Jan 19 04:19:09 2003
@@ -47,6 +47,7 @@
 int mp_bus_id_to_local [MAX_MP_BUSSES];
 int quad_local_to_mp_bus_id [NR_CPUS/4][4];
 int mp_bus_id_to_pci_bus [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 };
+int mp_ioapic_id_map [MAX_NUMNODES][2][2];
 int mp_current_pci_id;
 
 /* I/O APIC entries */
@@ -232,6 +233,7 @@
 		return;
 	}
 	mp_ioapics[nr_ioapics] = *m;
+	mpc_oem_ioapic(m, str, translation_table[mpc_record]);
 	nr_ioapics++;
 }
 
===== include/asm-i386/mpspec.h 1.11 vs edited =====
--- 1.11/include/asm-i386/mpspec.h	Tue Jan 14 03:02:28 2003
+++ edited/include/asm-i386/mpspec.h	Sun Jan 19 04:40:31 2003
@@ -204,6 +204,7 @@
 extern int mp_bus_id_to_local [MAX_MP_BUSSES];
 extern int quad_local_to_mp_bus_id [NR_CPUS/4][4];
 extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES];
+extern int mp_ioapic_id_map [MAX_NUMNODES][2][2];
 
 extern unsigned int boot_cpu_physical_apicid;
 extern unsigned long phys_cpu_present_map;
===== include/asm-i386/mach-default/mach_mpparse.h 1.2 vs edited =====
--- 1.2/include/asm-i386/mach-default/mach_mpparse.h	Mon Jan 13 16:41:17 2003
+++ edited/include/asm-i386/mach-default/mach_mpparse.h	Sun Jan 19 04:26:45 2003
@@ -12,6 +12,11 @@
 {
 }
 
+static inline void mpc_oem_ioapic(struct mpc_config_ioapic *m, 
+				struct mpc_config_translation *translation)
+{
+}
+
 static inline void mps_oem_check(struct mp_config_table *mpc, char *oem, 
 		char *productid)
 {
===== include/asm-i386/mach-numaq/mach_mpparse.h 1.4 vs edited =====
--- 1.4/include/asm-i386/mach-numaq/mach_mpparse.h	Mon Jan 13 16:41:17 2003
+++ edited/include/asm-i386/mach-numaq/mach_mpparse.h	Sun Jan 19 04:57:29 2003
@@ -24,6 +24,25 @@
 	quad_local_to_mp_bus_id[quad][local] = m->mpc_busid;
 }
 
+static inline void mpc_oem_ioapic(struct mpc_config_ioapic *m, 
+				struct mpc_config_translation *translation)
+{
+	int quad = translation->trans_quad;
+	int local = translation->trans_local;
+	int *info;
+
+	if (!mp_ioapic_id_map[quad][0][0])
+		info = mp_ioapic_id_map[quad][0];
+	else if (!mp_ioapic_id_map[quad][1][0])
+		info = mp_ioapic_id_map[quad][1];
+	else {
+		printk("bad IO-APIC! go to your quad!\n");
+		return;
+	}
+	info[0] = global;
+	info[1] = local;
+}
+
 static inline void mps_oem_check(struct mp_config_table *mpc, char *oem, 
 		char *productid)
 {
===== include/asm-i386/mach-summit/mach_mpparse.h 1.3 vs edited =====
--- 1.3/include/asm-i386/mach-summit/mach_mpparse.h	Tue Jan 14 03:02:28 2003
+++ edited/include/asm-i386/mach-summit/mach_mpparse.h	Sun Jan 19 04:30:32 2003
@@ -12,6 +12,11 @@
 {
 }
 
+static inline void mpc_oem_ioapic(struct mpc_config_ioapic *m, 
+				struct mpc_config_translation *translation)
+{
+}
+
 static inline void mps_oem_check(struct mp_config_table *mpc, char *oem, 
 		char *productid)
 {

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: setup_ioapic_ids_from_mpc()
  2003-01-19 13:01 setup_ioapic_ids_from_mpc() William Lee Irwin III
@ 2003-01-19 13:15 ` William Lee Irwin III
  2003-01-19 13:29   ` setup_ioapic_ids_from_mpc() William Lee Irwin III
  2003-01-20  1:19 ` setup_ioapic_ids_from_mpc() William Lee Irwin III
  1 sibling, 1 reply; 6+ messages in thread
From: William Lee Irwin III @ 2003-01-19 13:15 UTC (permalink / raw)
  To: linux-kernel, Martin.Bligh

On Sun, Jan 19, 2003 at 05:01:18AM -0800, William Lee Irwin III wrote:
> 100% untested. I'll spin it sometime tomorrow.

Take 2: I eyeballed a couple bogosities.


===== arch/i386/kernel/io_apic.c 1.40 vs edited =====
--- 1.40/arch/i386/kernel/io_apic.c	Tue Jan 14 03:02:28 2003
+++ edited/arch/i386/kernel/io_apic.c	Sun Jan 19 05:13:21 2003
@@ -1132,7 +1132,41 @@
  * by Matt Domsch <Matt_Domsch@dell.com>  Tue Dec 21 12:25:05 CST 1999
  */
 
-static void __init setup_ioapic_ids_from_mpc (void)
+#ifdef CONFIG_X86_NUMAQ
+static void __init setup_ioapic_ids_from_mpc(void)
+{
+	int io_apic;
+
+	for (io_apic = 0; io_apic < nr_ioapics; ++io_apic) {
+		struct IO_APIC_reg_00 reg;
+		int node, local, global, *regval = (int *)&reg;
+
+		global = mp_ioapics[apic].mpc_apicid;
+		local = 0;
+		for (node = 0; node < MAX_NUMNODES; ++node) {
+			if (mp_ioapic_id_map[node][0][0] == global)
+				local = mp_ioapic_id_map[node][0][1];
+			else if (mp_ioapic_id_map[node][1][0] == global)
+				local = mp_ioapic_id_map[node][1][1];
+		}
+
+		if (!local) {
+			printk("mystery IO-APIC, it will die\n");
+			continue;
+		}
+
+		
+		spin_lock_irqsave(&ioapic_lock, flags);
+		*regval = io_apic_read(io_apic, 0);
+		if (reg.ID != local) {
+			reg.ID = local;
+			io_apic_write(io_apic, 0, *regval);
+		}
+		spin_unlock_irqrestore(&ioapic_lock, flags);
+	}
+}
+#else /* !CONFIG_X86_NUMAQ */
+static void __init setup_ioapic_ids_from_mpc(void)
 {
 	struct IO_APIC_reg_00 reg_00;
 	unsigned long phys_id_present_map;
@@ -1225,6 +1259,7 @@
 			printk(" ok.\n");
 	}
 }
+#endif
 
 /*
  * There is a nasty bug in some older SMP boards, their mptable lies
===== arch/i386/kernel/mpparse.c 1.32 vs edited =====
--- 1.32/arch/i386/kernel/mpparse.c	Mon Jan 13 16:41:17 2003
+++ edited/arch/i386/kernel/mpparse.c	Sun Jan 19 04:19:09 2003
@@ -47,6 +47,7 @@
 int mp_bus_id_to_local [MAX_MP_BUSSES];
 int quad_local_to_mp_bus_id [NR_CPUS/4][4];
 int mp_bus_id_to_pci_bus [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 };
+int mp_ioapic_id_map [MAX_NUMNODES][2][2];
 int mp_current_pci_id;
 
 /* I/O APIC entries */
@@ -232,6 +233,7 @@
 		return;
 	}
 	mp_ioapics[nr_ioapics] = *m;
+	mpc_oem_ioapic(m, str, translation_table[mpc_record]);
 	nr_ioapics++;
 }
 
===== include/asm-i386/mpspec.h 1.11 vs edited =====
--- 1.11/include/asm-i386/mpspec.h	Tue Jan 14 03:02:28 2003
+++ edited/include/asm-i386/mpspec.h	Sun Jan 19 04:40:31 2003
@@ -204,6 +204,7 @@
 extern int mp_bus_id_to_local [MAX_MP_BUSSES];
 extern int quad_local_to_mp_bus_id [NR_CPUS/4][4];
 extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES];
+extern int mp_ioapic_id_map [MAX_NUMNODES][2][2];
 
 extern unsigned int boot_cpu_physical_apicid;
 extern unsigned long phys_cpu_present_map;
===== include/asm-i386/mach-default/mach_mpparse.h 1.2 vs edited =====
--- 1.2/include/asm-i386/mach-default/mach_mpparse.h	Mon Jan 13 16:41:17 2003
+++ edited/include/asm-i386/mach-default/mach_mpparse.h	Sun Jan 19 04:26:45 2003
@@ -12,6 +12,11 @@
 {
 }
 
+static inline void mpc_oem_ioapic(struct mpc_config_ioapic *m, 
+				struct mpc_config_translation *translation)
+{
+}
+
 static inline void mps_oem_check(struct mp_config_table *mpc, char *oem, 
 		char *productid)
 {
===== include/asm-i386/mach-numaq/mach_mpparse.h 1.4 vs edited =====
--- 1.4/include/asm-i386/mach-numaq/mach_mpparse.h	Mon Jan 13 16:41:17 2003
+++ edited/include/asm-i386/mach-numaq/mach_mpparse.h	Sun Jan 19 04:57:29 2003
@@ -24,6 +24,25 @@
 	quad_local_to_mp_bus_id[quad][local] = m->mpc_busid;
 }
 
+static inline void mpc_oem_ioapic(struct mpc_config_ioapic *m, 
+				struct mpc_config_translation *translation)
+{
+	int quad = translation->trans_quad;
+	int local = translation->trans_local;
+	int *info;
+
+	if (!mp_ioapic_id_map[quad][0][0])
+		info = mp_ioapic_id_map[quad][0];
+	else if (!mp_ioapic_id_map[quad][1][0])
+		info = mp_ioapic_id_map[quad][1];
+	else {
+		printk("bad IO-APIC! go to your quad!\n");
+		return;
+	}
+	info[0] = global;
+	info[1] = local;
+}
+
 static inline void mps_oem_check(struct mp_config_table *mpc, char *oem, 
 		char *productid)
 {
===== include/asm-i386/mach-summit/mach_mpparse.h 1.3 vs edited =====
--- 1.3/include/asm-i386/mach-summit/mach_mpparse.h	Tue Jan 14 03:02:28 2003
+++ edited/include/asm-i386/mach-summit/mach_mpparse.h	Sun Jan 19 04:30:32 2003
@@ -12,6 +12,11 @@
 {
 }
 
+static inline void mpc_oem_ioapic(struct mpc_config_ioapic *m, 
+				struct mpc_config_translation *translation)
+{
+}
+
 static inline void mps_oem_check(struct mp_config_table *mpc, char *oem, 
 		char *productid)
 {

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: setup_ioapic_ids_from_mpc()
  2003-01-19 13:15 ` setup_ioapic_ids_from_mpc() William Lee Irwin III
@ 2003-01-19 13:29   ` William Lee Irwin III
  0 siblings, 0 replies; 6+ messages in thread
From: William Lee Irwin III @ 2003-01-19 13:29 UTC (permalink / raw)
  To: linux-kernel, Martin.Bligh

On Sun, Jan 19, 2003 at 05:01:18AM -0800, William Lee Irwin III wrote:
>> 100% untested. I'll spin it sometime tomorrow.

On Sun, Jan 19, 2003 at 05:15:56AM -0800, William Lee Irwin III wrote:
> Take 2: I eyeballed a couple bogosities.

Take 3: flags undeclared, regval/reg aliasing might need barriers; speed
is not an issue at boot-time, so slap down the heaviest barrier imaginable.



===== arch/i386/kernel/io_apic.c 1.40 vs edited =====
--- 1.40/arch/i386/kernel/io_apic.c	Tue Jan 14 03:02:28 2003
+++ edited/arch/i386/kernel/io_apic.c	Sun Jan 19 05:27:35 2003
@@ -1132,7 +1132,44 @@
  * by Matt Domsch <Matt_Domsch@dell.com>  Tue Dec 21 12:25:05 CST 1999
  */
 
-static void __init setup_ioapic_ids_from_mpc (void)
+#ifdef CONFIG_X86_NUMAQ
+static void __init setup_ioapic_ids_from_mpc(void)
+{
+	int io_apic;
+
+	for (io_apic = 0; io_apic < nr_ioapics; ++io_apic) {
+		struct IO_APIC_reg_00 reg;
+		int node, local, global, *regval = (int *)&reg;
+		unsigned long flags;
+
+		global = mp_ioapics[apic].mpc_apicid;
+		local = 0;
+		for (node = 0; node < MAX_NUMNODES; ++node) {
+			if (mp_ioapic_id_map[node][0][0] == global)
+				local = mp_ioapic_id_map[node][0][1];
+			else if (mp_ioapic_id_map[node][1][0] == global)
+				local = mp_ioapic_id_map[node][1][1];
+		}
+
+		if (!local) {
+			printk("mystery IO-APIC, it will die\n");
+			continue;
+		}
+
+		
+		spin_lock_irqsave(&ioapic_lock, flags);
+		*regval = io_apic_read(io_apic, 0);
+		mb();				/* b/c regval aliases &reg */
+		if (reg.ID != local) {
+			reg.ID = local;
+			mb();			/* b/c regval aliases &reg */
+			io_apic_write(io_apic, 0, *regval);
+		}
+		spin_unlock_irqrestore(&ioapic_lock, flags);
+	}
+}
+#else /* !CONFIG_X86_NUMAQ */
+static void __init setup_ioapic_ids_from_mpc(void)
 {
 	struct IO_APIC_reg_00 reg_00;
 	unsigned long phys_id_present_map;
@@ -1225,6 +1262,7 @@
 			printk(" ok.\n");
 	}
 }
+#endif
 
 /*
  * There is a nasty bug in some older SMP boards, their mptable lies
===== arch/i386/kernel/mpparse.c 1.32 vs edited =====
--- 1.32/arch/i386/kernel/mpparse.c	Mon Jan 13 16:41:17 2003
+++ edited/arch/i386/kernel/mpparse.c	Sun Jan 19 04:19:09 2003
@@ -47,6 +47,7 @@
 int mp_bus_id_to_local [MAX_MP_BUSSES];
 int quad_local_to_mp_bus_id [NR_CPUS/4][4];
 int mp_bus_id_to_pci_bus [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 };
+int mp_ioapic_id_map [MAX_NUMNODES][2][2];
 int mp_current_pci_id;
 
 /* I/O APIC entries */
@@ -232,6 +233,7 @@
 		return;
 	}
 	mp_ioapics[nr_ioapics] = *m;
+	mpc_oem_ioapic(m, str, translation_table[mpc_record]);
 	nr_ioapics++;
 }
 
===== include/asm-i386/mpspec.h 1.11 vs edited =====
--- 1.11/include/asm-i386/mpspec.h	Tue Jan 14 03:02:28 2003
+++ edited/include/asm-i386/mpspec.h	Sun Jan 19 04:40:31 2003
@@ -204,6 +204,7 @@
 extern int mp_bus_id_to_local [MAX_MP_BUSSES];
 extern int quad_local_to_mp_bus_id [NR_CPUS/4][4];
 extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES];
+extern int mp_ioapic_id_map [MAX_NUMNODES][2][2];
 
 extern unsigned int boot_cpu_physical_apicid;
 extern unsigned long phys_cpu_present_map;
===== include/asm-i386/mach-default/mach_mpparse.h 1.2 vs edited =====
--- 1.2/include/asm-i386/mach-default/mach_mpparse.h	Mon Jan 13 16:41:17 2003
+++ edited/include/asm-i386/mach-default/mach_mpparse.h	Sun Jan 19 04:26:45 2003
@@ -12,6 +12,11 @@
 {
 }
 
+static inline void mpc_oem_ioapic(struct mpc_config_ioapic *m, 
+				struct mpc_config_translation *translation)
+{
+}
+
 static inline void mps_oem_check(struct mp_config_table *mpc, char *oem, 
 		char *productid)
 {
===== include/asm-i386/mach-numaq/mach_mpparse.h 1.4 vs edited =====
--- 1.4/include/asm-i386/mach-numaq/mach_mpparse.h	Mon Jan 13 16:41:17 2003
+++ edited/include/asm-i386/mach-numaq/mach_mpparse.h	Sun Jan 19 04:57:29 2003
@@ -24,6 +24,25 @@
 	quad_local_to_mp_bus_id[quad][local] = m->mpc_busid;
 }
 
+static inline void mpc_oem_ioapic(struct mpc_config_ioapic *m, 
+				struct mpc_config_translation *translation)
+{
+	int quad = translation->trans_quad;
+	int local = translation->trans_local;
+	int *info;
+
+	if (!mp_ioapic_id_map[quad][0][0])
+		info = mp_ioapic_id_map[quad][0];
+	else if (!mp_ioapic_id_map[quad][1][0])
+		info = mp_ioapic_id_map[quad][1];
+	else {
+		printk("bad IO-APIC! go to your quad!\n");
+		return;
+	}
+	info[0] = global;
+	info[1] = local;
+}
+
 static inline void mps_oem_check(struct mp_config_table *mpc, char *oem, 
 		char *productid)
 {
===== include/asm-i386/mach-summit/mach_mpparse.h 1.3 vs edited =====
--- 1.3/include/asm-i386/mach-summit/mach_mpparse.h	Tue Jan 14 03:02:28 2003
+++ edited/include/asm-i386/mach-summit/mach_mpparse.h	Sun Jan 19 04:30:32 2003
@@ -12,6 +12,11 @@
 {
 }
 
+static inline void mpc_oem_ioapic(struct mpc_config_ioapic *m, 
+				struct mpc_config_translation *translation)
+{
+}
+
 static inline void mps_oem_check(struct mp_config_table *mpc, char *oem, 
 		char *productid)
 {

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: setup_ioapic_ids_from_mpc()
  2003-01-19 13:01 setup_ioapic_ids_from_mpc() William Lee Irwin III
  2003-01-19 13:15 ` setup_ioapic_ids_from_mpc() William Lee Irwin III
@ 2003-01-20  1:19 ` William Lee Irwin III
  2003-01-20  2:17   ` setup_ioapic_ids_from_mpc() Martin J. Bligh
  1 sibling, 1 reply; 6+ messages in thread
From: William Lee Irwin III @ 2003-01-20  1:19 UTC (permalink / raw)
  To: linux-kernel, Martin.Bligh; +Cc: akpm

On Sun, Jan 19, 2003 at 05:01:18AM -0800, William Lee Irwin III wrote:
> 100% untested. I'll spin it sometime tomorrow.

This one is tested, and works.


Use NUMA-Q specific MP OEM tables to program the physical APIC ID's of
the IO-APIC's. This fixes boot-time panic()'s on NUMA-Q's in the stock
version of setup_ioapic_ids_from_mpc().

 arch/i386/kernel/io_apic.c                   |   40 ++++++++++++++++++++++++++-
 arch/i386/kernel/mpparse.c                   |    2 +
 include/asm-i386/mach-default/mach_mpparse.h |    5 +++
 include/asm-i386/mach-numaq/mach_mpparse.h   |   19 ++++++++++++
 include/asm-i386/mach-summit/mach_mpparse.h  |    5 +++
 include/asm-i386/mpspec.h                    |    3 ++
 6 files changed, 73 insertions(+), 1 deletion(-)


diff -urpN numaq-2.5.59-virgin/arch/i386/kernel/io_apic.c mpc-2.5.59-1/arch/i386/kernel/io_apic.c
--- numaq-2.5.59-virgin/arch/i386/kernel/io_apic.c	2003-01-19 17:14:25.000000000 -0800
+++ mpc-2.5.59-1/arch/i386/kernel/io_apic.c	2003-01-19 16:41:02.000000000 -0800
@@ -1438,7 +1438,44 @@ void disable_IO_APIC(void)
  * by Matt Domsch <Matt_Domsch@dell.com>  Tue Dec 21 12:25:05 CST 1999
  */
 
-static void __init setup_ioapic_ids_from_mpc (void)
+#ifdef CONFIG_X86_NUMAQ
+static void __init setup_ioapic_ids_from_mpc(void)
+{
+	int io_apic;
+
+	for (io_apic = 0; io_apic < nr_ioapics; ++io_apic) {
+		struct IO_APIC_reg_00 reg;
+		int node, local, global, *regval = (int *)&reg;
+		unsigned long flags;
+
+		global = mp_ioapics[io_apic].mpc_apicid;
+		local = 0;
+		for (node = 0; node < MAX_NUMNODES; ++node) {
+			if (mp_ioapic_id_map[node][0][0] == global)
+				local = mp_ioapic_id_map[node][0][1];
+			else if (mp_ioapic_id_map[node][1][0] == global)
+				local = mp_ioapic_id_map[node][1][1];
+		}
+
+		if (!local) {
+			printk("mystery IO-APIC, it will die\n");
+			continue;
+		}
+
+		
+		spin_lock_irqsave(&ioapic_lock, flags);
+		*regval = io_apic_read(io_apic, 0);
+		mb();				/* b/c regval aliases &reg */
+		if (reg.ID != local) {
+			reg.ID = local;
+			mb();			/* b/c regval aliases &reg */
+			io_apic_write(io_apic, 0, *regval);
+		}
+		spin_unlock_irqrestore(&ioapic_lock, flags);
+	}
+}
+#else /* !CONFIG_X86_NUMAQ */
+static void __init setup_ioapic_ids_from_mpc(void)
 {
 	struct IO_APIC_reg_00 reg_00;
 	unsigned long phys_id_present_map;
@@ -1531,6 +1568,7 @@ static void __init setup_ioapic_ids_from
 			printk(" ok.\n");
 	}
 }
+#endif
 
 /*
  * There is a nasty bug in some older SMP boards, their mptable lies
diff -urpN numaq-2.5.59-virgin/arch/i386/kernel/mpparse.c mpc-2.5.59-1/arch/i386/kernel/mpparse.c
--- numaq-2.5.59-virgin/arch/i386/kernel/mpparse.c	2003-01-19 17:14:25.000000000 -0800
+++ mpc-2.5.59-1/arch/i386/kernel/mpparse.c	2003-01-19 16:38:37.000000000 -0800
@@ -47,6 +47,7 @@ int mp_bus_id_to_node [MAX_MP_BUSSES];
 int mp_bus_id_to_local [MAX_MP_BUSSES];
 int quad_local_to_mp_bus_id [NR_CPUS/4][4];
 int mp_bus_id_to_pci_bus [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 };
+int mp_ioapic_id_map [MAX_NUMNODES][2][2];
 int mp_current_pci_id;
 
 /* I/O APIC entries */
@@ -232,6 +233,7 @@ static void __init MP_ioapic_info (struc
 		return;
 	}
 	mp_ioapics[nr_ioapics] = *m;
+	mpc_oem_ioapic(m, translation_table[mpc_record]);
 	nr_ioapics++;
 }
 
diff -urpN numaq-2.5.59-virgin/include/asm-i386/mach-default/mach_mpparse.h mpc-2.5.59-1/include/asm-i386/mach-default/mach_mpparse.h
--- numaq-2.5.59-virgin/include/asm-i386/mach-default/mach_mpparse.h	2003-01-16 18:22:39.000000000 -0800
+++ mpc-2.5.59-1/include/asm-i386/mach-default/mach_mpparse.h	2003-01-19 16:29:59.000000000 -0800
@@ -12,6 +12,11 @@ static inline void mpc_oem_pci_bus(struc
 {
 }
 
+static inline void mpc_oem_ioapic(struct mpc_config_ioapic *m, 
+				struct mpc_config_translation *translation)
+{
+}
+
 static inline void mps_oem_check(struct mp_config_table *mpc, char *oem, 
 		char *productid)
 {
diff -urpN numaq-2.5.59-virgin/include/asm-i386/mach-numaq/mach_mpparse.h mpc-2.5.59-1/include/asm-i386/mach-numaq/mach_mpparse.h
--- numaq-2.5.59-virgin/include/asm-i386/mach-numaq/mach_mpparse.h	2003-01-16 18:22:01.000000000 -0800
+++ mpc-2.5.59-1/include/asm-i386/mach-numaq/mach_mpparse.h	2003-01-19 16:36:46.000000000 -0800
@@ -24,6 +24,25 @@ static inline void mpc_oem_pci_bus(struc
 	quad_local_to_mp_bus_id[quad][local] = m->mpc_busid;
 }
 
+static inline void mpc_oem_ioapic(struct mpc_config_ioapic *m, 
+				struct mpc_config_translation *translation)
+{
+	int quad = translation->trans_quad;
+	int local = translation->trans_local;
+	int *info;
+
+	if (!mp_ioapic_id_map[quad][0][0])
+		info = mp_ioapic_id_map[quad][0];
+	else if (!mp_ioapic_id_map[quad][1][0])
+		info = mp_ioapic_id_map[quad][1];
+	else {
+		printk("bad IO-APIC! go to your quad!\n");
+		return;
+	}
+	info[0] = m->mpc_apicid;
+	info[1] = local;
+}
+
 static inline void mps_oem_check(struct mp_config_table *mpc, char *oem, 
 		char *productid)
 {
diff -urpN numaq-2.5.59-virgin/include/asm-i386/mach-summit/mach_mpparse.h mpc-2.5.59-1/include/asm-i386/mach-summit/mach_mpparse.h
--- numaq-2.5.59-virgin/include/asm-i386/mach-summit/mach_mpparse.h	2003-01-16 18:22:05.000000000 -0800
+++ mpc-2.5.59-1/include/asm-i386/mach-summit/mach_mpparse.h	2003-01-19 16:29:59.000000000 -0800
@@ -12,6 +12,11 @@ static inline void mpc_oem_pci_bus(struc
 {
 }
 
+static inline void mpc_oem_ioapic(struct mpc_config_ioapic *m, 
+				struct mpc_config_translation *translation)
+{
+}
+
 static inline void mps_oem_check(struct mp_config_table *mpc, char *oem, 
 		char *productid)
 {
diff -urpN numaq-2.5.59-virgin/include/asm-i386/mpspec.h mpc-2.5.59-1/include/asm-i386/mpspec.h
--- numaq-2.5.59-virgin/include/asm-i386/mpspec.h	2003-01-16 18:21:33.000000000 -0800
+++ mpc-2.5.59-1/include/asm-i386/mpspec.h	2003-01-19 16:34:43.000000000 -0800
@@ -1,6 +1,8 @@
 #ifndef __ASM_MPSPEC_H
 #define __ASM_MPSPEC_H
 
+#include <asm/numnodes.h>
+
 /*
  * Structure definitions for SMP machines following the
  * Intel Multiprocessing Specification 1.1 and 1.4.
@@ -204,6 +206,7 @@ extern int mp_bus_id_to_node [MAX_MP_BUS
 extern int mp_bus_id_to_local [MAX_MP_BUSSES];
 extern int quad_local_to_mp_bus_id [NR_CPUS/4][4];
 extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES];
+extern int mp_ioapic_id_map [MAX_NUMNODES][2][2];
 
 extern unsigned int boot_cpu_physical_apicid;
 extern unsigned long phys_cpu_present_map;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: setup_ioapic_ids_from_mpc()
  2003-01-20  1:19 ` setup_ioapic_ids_from_mpc() William Lee Irwin III
@ 2003-01-20  2:17   ` Martin J. Bligh
  2003-01-20  2:21     ` setup_ioapic_ids_from_mpc() William Lee Irwin III
  0 siblings, 1 reply; 6+ messages in thread
From: Martin J. Bligh @ 2003-01-20  2:17 UTC (permalink / raw)
  To: William Lee Irwin III, linux-kernel; +Cc: akpm

> Use NUMA-Q specific MP OEM tables to program the physical APIC ID's of
> the IO-APIC's. This fixes boot-time panic()'s on NUMA-Q's in the stock
> version of setup_ioapic_ids_from_mpc().

I think you can just skip this whole routine altogether on NUMA-Q,
it's all pre-programmed for us by firmware. Much smaller patch ;-)

M.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: setup_ioapic_ids_from_mpc()
  2003-01-20  2:17   ` setup_ioapic_ids_from_mpc() Martin J. Bligh
@ 2003-01-20  2:21     ` William Lee Irwin III
  0 siblings, 0 replies; 6+ messages in thread
From: William Lee Irwin III @ 2003-01-20  2:21 UTC (permalink / raw)
  To: Martin J. Bligh; +Cc: linux-kernel, akpm

At some point in the past, I wrote:
>> Use NUMA-Q specific MP OEM tables to program the physical APIC ID's of
>> the IO-APIC's. This fixes boot-time panic()'s on NUMA-Q's in the stock
>> version of setup_ioapic_ids_from_mpc().

On Sun, Jan 19, 2003 at 06:17:48PM -0800, Martin J. Bligh wrote:
> I think you can just skip this whole routine altogether on NUMA-Q,
> it's all pre-programmed for us by firmware. Much smaller patch ;-)


Don't touch IO-APIC physid's on NUMA-Q. The BIOS pre-programs them.

 io_apic.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletion(-)


--- mm1-2.5.59/arch/i386/kernel/io_apic.c	2003-01-17 01:04:43.000000000 -0800
+++ mpc-2.5.59-1/arch/i386/kernel/io_apic.c	2003-01-19 18:19:13.000000000 -0800
@@ -1438,7 +1438,8 @@ void disable_IO_APIC(void)
  * by Matt Domsch <Matt_Domsch@dell.com>  Tue Dec 21 12:25:05 CST 1999
  */
 
-static void __init setup_ioapic_ids_from_mpc (void)
+#ifndef CONFIG_X86_NUMAQ
+static void __init setup_ioapic_ids_from_mpc(void)
 {
 	struct IO_APIC_reg_00 reg_00;
 	unsigned long phys_id_present_map;
@@ -1531,6 +1532,9 @@ static void __init setup_ioapic_ids_from
 			printk(" ok.\n");
 	}
 }
+#else
+static void __init setup_ioapic_ids_from_mpc(void) { }
+#endif
 
 /*
  * There is a nasty bug in some older SMP boards, their mptable lies

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-01-20  2:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-19 13:01 setup_ioapic_ids_from_mpc() William Lee Irwin III
2003-01-19 13:15 ` setup_ioapic_ids_from_mpc() William Lee Irwin III
2003-01-19 13:29   ` setup_ioapic_ids_from_mpc() William Lee Irwin III
2003-01-20  1:19 ` setup_ioapic_ids_from_mpc() William Lee Irwin III
2003-01-20  2:17   ` setup_ioapic_ids_from_mpc() Martin J. Bligh
2003-01-20  2:21     ` setup_ioapic_ids_from_mpc() William Lee Irwin III

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox