[PATCH][2.4] generic support for systems with more than 8 CPUs (1/2)

Pallipadi, Venkatesh (venkatesh.pallipadi@intel.com)
Sat, 21 Dec 2002 22:59:06 -0800


This is a multi-part message in MIME format.

------_=_NextPart_001_01C2A987.9E66EE60
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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;
=20
extern void __init MP_processor_info(struct mpc_config_processor *);
+extern unsigned int xapic_support;
=20
static void __init
acpi_parse_lapic(struct acpi_table_lapic *local_apic)
{
struct mpc_config_processor proc_entry;
int ix =3D 0;
+ static unsigned long apic_ver;
+ static int first_time =3D 1;
=20
if (!local_apic)
return;
@@ -357,7 +360,16 @@
proc_entry.mpc_featureflag =3D boot_cpu_data.x86_capability[0];
proc_entry.mpc_reserved[0] =3D 0;
proc_entry.mpc_reserved[1] =3D 0;
- proc_entry.mpc_apicver =3D 0x10; /* integrated APIC */
+ if (first_time) {
+ first_time =3D 0;
+ set_fixmap(FIX_APIC_BASE, APIC_DEFAULT_PHYS_BASE);
+ Dprintk("Local APIC ID %lx\n", apic_read(APIC_ID));
+ apic_ver =3D apic_read(APIC_LVR);
+ Dprintk("Local APIC Version %lx\n", apic_ver);
+ if (APIC_XAPIC_SUPPORT(apic_ver))
+ xapic_support =3D 1;
+ }
+ proc_entry.mpc_apicver =3D 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 @@
=20
unsigned int int_dest_addr_mode =3D APIC_DEST_LOGICAL;
unsigned char int_delivery_mode =3D dest_LowestPrio;
-
+extern unsigned int xapic_support;
=20
/*
* # of IRQ routing registers
@@ -1067,7 +1067,8 @@
=09
old_id =3D mp_ioapics[apic].mpc_apicid;
=20
- if (mp_ioapics[apic].mpc_apicid >=3D apic_broadcast_id) {
+ if (!xapic_support &&=20
+ (mp_ioapics[apic].mpc_apicid >=3D 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 !=3D CLUSTERED_APIC_XAPIC) &&
+ if (!xapic_support &&
+ (clustered_apic_mode !=3D 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 =3D CLUSTERED_APIC_NONE;
unsigned int apic_broadcast_id =3D APIC_BROADCAST_ID_APIC;
#endif
+unsigned int xapic_support =3D 0;
unsigned char raw_phys_apicid[NR_CPUS] =3D { [0 ... NR_CPUS-1] =3D =
BAD_APICID };
=20
/*
@@ -238,6 +239,8 @@
return;
}
ver =3D m->mpc_apicver;
+ if (APIC_XAPIC_SUPPORT(ver))
+ xapic_support =3D 1;
=20
logical_cpu_present_map |=3D 1 << (num_processors-1);
phys_cpu_present_map |=3D apicid_to_phys_cpu_present(m->mpc_apicid);
@@ -830,6 +833,7 @@
BUG();
=20
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)>=3D0x14)
#define APIC_TASKPRI 0x80
#define APIC_TPRI_MASK 0xFF
#define APIC_ARBPRI 0x90

------_=_NextPart_001_01C2A987.9E66EE60
Content-Type: application/octet-stream;
name="xapic_2.4.21-pre2.patch"
Content-Transfer-Encoding: base64
Content-Description: xapic_2.4.21-pre2.patch
Content-Disposition: attachment;
filename="xapic_2.4.21-pre2.patch"

ZGlmZiAtdXJOIGxpbnV4LTIuNC4yMS1wcmUyLm9yZy9hcmNoL2kzODYva2VybmVsL2FjcGl0YWJs
ZS5jIGxpbnV4LTIuNC4yMS1wcmUyL2FyY2gvaTM4Ni9rZXJuZWwvYWNwaXRhYmxlLmMKLS0tIGxp
bnV4LTIuNC4yMS1wcmUyLm9yZy9hcmNoL2kzODYva2VybmVsL2FjcGl0YWJsZS5jCTIwMDItMDgt
MDIgMTc6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lBUElDX1RQUklfTUFTSwkJMHhGRgog
I2RlZmluZQkJQVBJQ19BUkJQUkkJMHg5MAo=

------_=_NextPart_001_01C2A987.9E66EE60--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/