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
This archive was generated by hypermail 2b29 : Mon Dec 23 2002 - 22:00:30 EST