mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Pallipadi, Venkatesh" <venkatesh.pallipadi@intel.com>
To: "Martin J. Bligh" <mbligh@aracnet.com>,
	"Nakajima, Jun" <jun.nakajima@intel.com>,
	"Van Maren, Kevin" <kevin.vanmaren@unisys.com>,
	"William Lee Irwin III" <wli@holomorphy.com>,
	"Christoph Hellwig" <hch@infradead.org>,
	"James Cleverdon" <jamesclv@us.ibm.com>,
	"John Stultz" <johnstul@us.ibm.com>,
	"Mallick, Asit K" <asit.k.mallick@intel.com>,
	"Saxena, Sunil" <sunil.saxena@intel.com>,
	"Linux Kernel" <linux-kernel@vger.kernel.org>
Cc: "Protasevich, Natalie" <Natalie.Protasevich@unisys.com>
Subject: [PATCH][2.4]  generic support for systems with more than 8 CPUs (1/2)
Date: Sat, 21 Dec 2002 22:59:06 -0800	[thread overview]
Message-ID: <C8C38546F90ABF408A5961FC01FDBF1912E1B2@fmsmsx405.fm.intel.com> (raw)

[-- 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

             reply	other threads:[~2002-12-22  6:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-22  6:59 Pallipadi, Venkatesh [this message]
2002-12-22 17:34 ` Martin J. Bligh
2002-12-23  1:24 Pallipadi, Venkatesh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C8C38546F90ABF408A5961FC01FDBF1912E1B2@fmsmsx405.fm.intel.com \
    --to=venkatesh.pallipadi@intel.com \
    --cc=Natalie.Protasevich@unisys.com \
    --cc=asit.k.mallick@intel.com \
    --cc=hch@infradead.org \
    --cc=jamesclv@us.ibm.com \
    --cc=johnstul@us.ibm.com \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.vanmaren@unisys.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbligh@aracnet.com \
    --cc=sunil.saxena@intel.com \
    --cc=wli@holomorphy.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®