public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][2.4]  generic support for systems with more than 8 CPUs (1/2)
@ 2002-12-22  6:59 Pallipadi, Venkatesh
  2002-12-22 17:34 ` Martin J. Bligh
  0 siblings, 1 reply; 3+ messages in thread
From: Pallipadi, Venkatesh @ 2002-12-22  6:59 UTC (permalink / raw)
  To: Martin J. Bligh, Nakajima, Jun, Van Maren, Kevin,
	William Lee Irwin III, Christoph Hellwig, James Cleverdon,
	John Stultz, Mallick, Asit K, Saxena, Sunil, Linux Kernel
  Cc: Protasevich, Natalie

[-- Attachment #1: Type: text/plain, Size: 4368 bytes --]

1/2 : checking for xAPIC support in the system
Thanks,
-Venkatesh
diff -urN linux-2.4.21-pre2.org/arch/i386/kernel/acpitable.c linux-2.4.21-pre2/arch/i386/kernel/acpitable.c
--- linux-2.4.21-pre2.org/arch/i386/kernel/acpitable.c	2002-08-02 17:39:42.000000000 -0700
+++ linux-2.4.21-pre2/arch/i386/kernel/acpitable.c	2002-12-17 20:09:45.000000000 -0800
@@ -314,12 +314,15 @@
 int have_acpi_tables;
 
 extern void __init MP_processor_info(struct mpc_config_processor *);
+extern unsigned int xapic_support;
 
 static void __init
 acpi_parse_lapic(struct acpi_table_lapic *local_apic)
 {
 	struct mpc_config_processor proc_entry;
 	int ix = 0;
+	static unsigned long apic_ver;
+	static int first_time = 1;
 
 	if (!local_apic)
 		return;
@@ -357,7 +360,16 @@
 		proc_entry.mpc_featureflag = boot_cpu_data.x86_capability[0];
 		proc_entry.mpc_reserved[0] = 0;
 		proc_entry.mpc_reserved[1] = 0;
-		proc_entry.mpc_apicver = 0x10;	/* integrated APIC */
+		if (first_time) {
+			first_time = 0;
+			set_fixmap(FIX_APIC_BASE, APIC_DEFAULT_PHYS_BASE);
+			Dprintk("Local APIC ID %lx\n", apic_read(APIC_ID));
+			apic_ver = apic_read(APIC_LVR);
+			Dprintk("Local APIC Version %lx\n", apic_ver);
+			if (APIC_XAPIC_SUPPORT(apic_ver))
+				xapic_support = 1;
+		}
+		proc_entry.mpc_apicver = apic_ver;
 		MP_processor_info(&proc_entry);
 	} else {
 		printk(" disabled");
diff -urN linux-2.4.21-pre2.org/arch/i386/kernel/io_apic.c linux-2.4.21-pre2/arch/i386/kernel/io_apic.c
--- linux-2.4.21-pre2.org/arch/i386/kernel/io_apic.c	2002-12-17 20:05:15.000000000 -0800
+++ linux-2.4.21-pre2/arch/i386/kernel/io_apic.c	2002-12-17 20:09:45.000000000 -0800
@@ -42,7 +42,7 @@
 
 unsigned int int_dest_addr_mode = APIC_DEST_LOGICAL;
 unsigned char int_delivery_mode = dest_LowestPrio;
-
+extern unsigned int xapic_support;
 
 /*
  * # of IRQ routing registers
@@ -1067,7 +1067,8 @@
 		
 		old_id = mp_ioapics[apic].mpc_apicid;
 
-		if (mp_ioapics[apic].mpc_apicid >= apic_broadcast_id) {
+		if (!xapic_support && 
+		    (mp_ioapics[apic].mpc_apicid >= apic_broadcast_id)) {
 			printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n",
 				apic, mp_ioapics[apic].mpc_apicid);
 			printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
@@ -1081,7 +1082,8 @@
 		 * 'stuck on smp_invalidate_needed IPI wait' messages.
 		 * I/O APIC IDs no longer have any meaning for xAPICs and SAPICs.
 		 */
-		if ((clustered_apic_mode != CLUSTERED_APIC_XAPIC) &&
+		if (!xapic_support &&
+		    (clustered_apic_mode != CLUSTERED_APIC_XAPIC) &&
 		    (phys_id_present_map & (1 << mp_ioapics[apic].mpc_apicid))) {
 			printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n",
 				apic, mp_ioapics[apic].mpc_apicid);
diff -urN linux-2.4.21-pre2.org/arch/i386/kernel/mpparse.c linux-2.4.21-pre2/arch/i386/kernel/mpparse.c
--- linux-2.4.21-pre2.org/arch/i386/kernel/mpparse.c	2002-12-17 20:05:15.000000000 -0800
+++ linux-2.4.21-pre2/arch/i386/kernel/mpparse.c	2002-12-17 20:09:45.000000000 -0800
@@ -74,6 +74,7 @@
 unsigned char clustered_apic_mode = CLUSTERED_APIC_NONE;
 unsigned int apic_broadcast_id = APIC_BROADCAST_ID_APIC;
 #endif
+unsigned int xapic_support = 0;
 unsigned char raw_phys_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID };
 
 /*
@@ -238,6 +239,8 @@
 		return;
 	}
 	ver = m->mpc_apicver;
+	if (APIC_XAPIC_SUPPORT(ver))
+		xapic_support = 1;
 
 	logical_cpu_present_map |= 1 << (num_processors-1);
  	phys_cpu_present_map |= apicid_to_phys_cpu_present(m->mpc_apicid);
@@ -830,6 +833,7 @@
 		BUG();
 
 	printk("Processors: %d\n", num_processors);
+	printk("xAPIC support %s present\n", (xapic_support?"is":"is not"));
 	/*
 	 * Only use the first configuration found.
 	 */
diff -urN linux-2.4.21-pre2.org/include/asm-i386/apicdef.h linux-2.4.21-pre2/include/asm-i386/apicdef.h
--- linux-2.4.21-pre2.org/include/asm-i386/apicdef.h	2002-12-17 20:05:16.000000000 -0800
+++ linux-2.4.21-pre2/include/asm-i386/apicdef.h	2002-12-17 20:09:45.000000000 -0800
@@ -18,6 +18,7 @@
 #define			GET_APIC_VERSION(x)	((x)&0xFF)
 #define			GET_APIC_MAXLVT(x)	(((x)>>16)&0xFF)
 #define			APIC_INTEGRATED(x)	((x)&0xF0)
+#define			APIC_XAPIC_SUPPORT(x)	((x)>=0x14)
 #define		APIC_TASKPRI	0x80
 #define			APIC_TPRI_MASK		0xFF
 #define		APIC_ARBPRI	0x90



[-- Attachment #2: xapic_2.4.21-pre2.patch --]
[-- Type: application/octet-stream, Size: 4187 bytes --]

diff -urN linux-2.4.21-pre2.org/arch/i386/kernel/acpitable.c linux-2.4.21-pre2/arch/i386/kernel/acpitable.c
--- linux-2.4.21-pre2.org/arch/i386/kernel/acpitable.c	2002-08-02 17:39:42.000000000 -0700
+++ linux-2.4.21-pre2/arch/i386/kernel/acpitable.c	2002-12-17 20:09:45.000000000 -0800
@@ -314,12 +314,15 @@
 int have_acpi_tables;
 
 extern void __init MP_processor_info(struct mpc_config_processor *);
+extern unsigned int xapic_support;
 
 static void __init
 acpi_parse_lapic(struct acpi_table_lapic *local_apic)
 {
 	struct mpc_config_processor proc_entry;
 	int ix = 0;
+	static unsigned long apic_ver;
+	static int first_time = 1;
 
 	if (!local_apic)
 		return;
@@ -357,7 +360,16 @@
 		proc_entry.mpc_featureflag = boot_cpu_data.x86_capability[0];
 		proc_entry.mpc_reserved[0] = 0;
 		proc_entry.mpc_reserved[1] = 0;
-		proc_entry.mpc_apicver = 0x10;	/* integrated APIC */
+		if (first_time) {
+			first_time = 0;
+			set_fixmap(FIX_APIC_BASE, APIC_DEFAULT_PHYS_BASE);
+			Dprintk("Local APIC ID %lx\n", apic_read(APIC_ID));
+			apic_ver = apic_read(APIC_LVR);
+			Dprintk("Local APIC Version %lx\n", apic_ver);
+			if (APIC_XAPIC_SUPPORT(apic_ver))
+				xapic_support = 1;
+		}
+		proc_entry.mpc_apicver = apic_ver;
 		MP_processor_info(&proc_entry);
 	} else {
 		printk(" disabled");
diff -urN linux-2.4.21-pre2.org/arch/i386/kernel/io_apic.c linux-2.4.21-pre2/arch/i386/kernel/io_apic.c
--- linux-2.4.21-pre2.org/arch/i386/kernel/io_apic.c	2002-12-17 20:05:15.000000000 -0800
+++ linux-2.4.21-pre2/arch/i386/kernel/io_apic.c	2002-12-17 20:09:45.000000000 -0800
@@ -42,7 +42,7 @@
 
 unsigned int int_dest_addr_mode = APIC_DEST_LOGICAL;
 unsigned char int_delivery_mode = dest_LowestPrio;
-
+extern unsigned int xapic_support;
 
 /*
  * # of IRQ routing registers
@@ -1067,7 +1067,8 @@
 		
 		old_id = mp_ioapics[apic].mpc_apicid;
 
-		if (mp_ioapics[apic].mpc_apicid >= apic_broadcast_id) {
+		if (!xapic_support && 
+		    (mp_ioapics[apic].mpc_apicid >= apic_broadcast_id)) {
 			printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n",
 				apic, mp_ioapics[apic].mpc_apicid);
 			printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
@@ -1081,7 +1082,8 @@
 		 * 'stuck on smp_invalidate_needed IPI wait' messages.
 		 * I/O APIC IDs no longer have any meaning for xAPICs and SAPICs.
 		 */
-		if ((clustered_apic_mode != CLUSTERED_APIC_XAPIC) &&
+		if (!xapic_support &&
+		    (clustered_apic_mode != CLUSTERED_APIC_XAPIC) &&
 		    (phys_id_present_map & (1 << mp_ioapics[apic].mpc_apicid))) {
 			printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n",
 				apic, mp_ioapics[apic].mpc_apicid);
diff -urN linux-2.4.21-pre2.org/arch/i386/kernel/mpparse.c linux-2.4.21-pre2/arch/i386/kernel/mpparse.c
--- linux-2.4.21-pre2.org/arch/i386/kernel/mpparse.c	2002-12-17 20:05:15.000000000 -0800
+++ linux-2.4.21-pre2/arch/i386/kernel/mpparse.c	2002-12-17 20:09:45.000000000 -0800
@@ -74,6 +74,7 @@
 unsigned char clustered_apic_mode = CLUSTERED_APIC_NONE;
 unsigned int apic_broadcast_id = APIC_BROADCAST_ID_APIC;
 #endif
+unsigned int xapic_support = 0;
 unsigned char raw_phys_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID };
 
 /*
@@ -238,6 +239,8 @@
 		return;
 	}
 	ver = m->mpc_apicver;
+	if (APIC_XAPIC_SUPPORT(ver))
+		xapic_support = 1;
 
 	logical_cpu_present_map |= 1 << (num_processors-1);
  	phys_cpu_present_map |= apicid_to_phys_cpu_present(m->mpc_apicid);
@@ -830,6 +833,7 @@
 		BUG();
 
 	printk("Processors: %d\n", num_processors);
+	printk("xAPIC support %s present\n", (xapic_support?"is":"is not"));
 	/*
 	 * Only use the first configuration found.
 	 */
diff -urN linux-2.4.21-pre2.org/include/asm-i386/apicdef.h linux-2.4.21-pre2/include/asm-i386/apicdef.h
--- linux-2.4.21-pre2.org/include/asm-i386/apicdef.h	2002-12-17 20:05:16.000000000 -0800
+++ linux-2.4.21-pre2/include/asm-i386/apicdef.h	2002-12-17 20:09:45.000000000 -0800
@@ -18,6 +18,7 @@
 #define			GET_APIC_VERSION(x)	((x)&0xFF)
 #define			GET_APIC_MAXLVT(x)	(((x)>>16)&0xFF)
 #define			APIC_INTEGRATED(x)	((x)&0xF0)
+#define			APIC_XAPIC_SUPPORT(x)	((x)>=0x14)
 #define		APIC_TASKPRI	0x80
 #define			APIC_TPRI_MASK		0xFF
 #define		APIC_ARBPRI	0x90

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

* Re: [PATCH][2.4]  generic support for systems with more than 8 CPUs (1/2)
  2002-12-22  6:59 [PATCH][2.4] generic support for systems with more than 8 CPUs (1/2) Pallipadi, Venkatesh
@ 2002-12-22 17:34 ` Martin J. Bligh
  0 siblings, 0 replies; 3+ messages in thread
From: Martin J. Bligh @ 2002-12-22 17:34 UTC (permalink / raw)
  To: Pallipadi, Venkatesh, Nakajima, Jun, Van Maren, Kevin,
	William Lee Irwin III, Christoph Hellwig, James Cleverdon,
	John Stultz, Mallick, Asit K, Saxena, Sunil, Linux Kernel
  Cc: Protasevich, Natalie

> 1/2 : checking for xAPIC support in the system

OK, that looks pretty sane - one question:

> -		if ((clustered_apic_mode != CLUSTERED_APIC_XAPIC) &&
> +		if (!xapic_support &&
> +		    (clustered_apic_mode != CLUSTERED_APIC_XAPIC) &&

When does xapic_support differ from
(clustered_apic_mode == CLUSTERED_APIC_XAPIC) ?

Do you want to use a physical flat xapic mode for your stuff, or the
same clustered physical mode as the Summit stuff? If the latter, then
the new switch seems unnecessary ....


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

* RE: [PATCH][2.4]  generic support for systems with more than 8 CPUs (1/2)
@ 2002-12-23  1:24 Pallipadi, Venkatesh
  0 siblings, 0 replies; 3+ messages in thread
From: Pallipadi, Venkatesh @ 2002-12-23  1:24 UTC (permalink / raw)
  To: Martin J. Bligh, Nakajima, Jun, Van Maren, Kevin,
	William Lee Irwin III, Christoph Hellwig, James Cleverdon,
	John Stultz, Mallick, Asit K, Saxena, Sunil, Linux Kernel
  Cc: Protasevich, Natalie



> From: Martin J. Bligh [mailto:mbligh@aracnet.com]
> > 1/2 : checking for xAPIC support in the system
> 
> OK, that looks pretty sane - one question:
> 
> > -		if ((clustered_apic_mode != CLUSTERED_APIC_XAPIC) &&
> > +		if (!xapic_support &&
> > +		    (clustered_apic_mode != CLUSTERED_APIC_XAPIC) &&
> 
> When does xapic_support differ from
> (clustered_apic_mode == CLUSTERED_APIC_XAPIC) ?
>

They are quite different. 
Infact CLUSTERED_APIC_XAPIC just means using physical APIC mode and is kind of a
misnomer as xAPIC doesn't necessariy mean physical APIC mode. 
xapic_support says whether xAPIC support is there or not. Then APICs 
can be configured either in physical or logical modes. I mainly need this as
with xAPIC support, we have:
- LAPIC and IOAPIC have there own name space, 
- max or 255 CPUS with 0xff as broadcast, as opposed to 0xf broadcast in case of no xAPIC

> Do you want to use a physical flat xapic mode for your stuff, or the
> same clustered physical mode as the Summit stuff? If the latter, then
> the new switch seems unnecessary ....

Now I am getting a bit confused here. I am using physical mode with no clustering
whatsoever. Thats what I felt even Summit was doing in 2.4.

Thanks,
-Venkatesh

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

end of thread, other threads:[~2002-12-23  1:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-22  6:59 [PATCH][2.4] generic support for systems with more than 8 CPUs (1/2) Pallipadi, Venkatesh
2002-12-22 17:34 ` Martin J. Bligh
  -- strict thread matches above, loose matches on Subject: below --
2002-12-23  1:24 Pallipadi, Venkatesh

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