]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] Summit: APIC ID mapping
authorMartin J. Bligh <martin.bligh@us.ibm.com>
Tue, 15 Oct 2002 12:38:07 +0000 (05:38 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Tue, 15 Oct 2002 12:38:07 +0000 (05:38 -0700)
Adds a raw_phys_apicid array that maps from the mps cpu number
to the apicid - this is needed because the apicids for Summit can be
larger than 32, and thus won't fit into the bitmap. Also adds little wrappers
to map neatly between the two.

Bumps up MAX_APICS for Summit.

arch/i386/kernel/mpparse.c
arch/i386/kernel/smpboot.c
arch/i386/mach-generic/mach_apic.h
arch/i386/mach-summit/mach_apic.h
include/asm-i386/mpspec.h
include/asm-i386/smp.h
include/asm-i386/smpboot.h

index 0768f1f09941a087a57265fe43531f4a648af3af..c9bdad8cb3f15d58e7a89ea92f73bca1687d42ba 100644 (file)
@@ -71,6 +71,7 @@ static unsigned int __initdata num_processors;
 unsigned long phys_cpu_present_map;
 
 int summit_x86 = 0;
+u8 raw_phys_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID };
 
 /*
  * Intel MP BIOS table parsing routines:
@@ -192,7 +193,7 @@ void __init MP_processor_info (struct mpc_config_processor *m)
        if (clustered_apic_mode) {
                phys_cpu_present_map |= (logical_apicid&0xf) << (4*quad);
        } else {
-               phys_cpu_present_map |= 1 << m->mpc_apicid;
+               phys_cpu_present_map |= apicid_to_cpu_present(m->mpc_apicid);
        }
        /*
         * Validate version
@@ -202,6 +203,7 @@ void __init MP_processor_info (struct mpc_config_processor *m)
                ver = 0x10;
        }
        apic_version[m->mpc_apicid] = ver;
+       raw_phys_apicid[num_processors - 1] = m->mpc_apicid;
 }
 
 static void __init MP_bus_info (struct mpc_config_bus *m)
index 9d513dc1ceb201e9f98e2ec4a35ccdab93f4509b..acc6d8e48075901824a3063c3d5c7e49ad63c029 100644 (file)
@@ -51,6 +51,7 @@
 #include <asm/desc.h>
 #include <asm/arch_hooks.h>
 #include "smpboot_hooks.h"
+#include "mach_apic.h"
 
 /* Set if we find a B stepping CPU */
 static int __initdata smp_b_stepping;
index 6b3dd2e232cc2668dbf9ab03c0d5fa7e83033cac..f7be859e761efdc74f9be00d2b780c3e3041137a 100644 (file)
@@ -30,4 +30,17 @@ static inline void clustered_apic_check(void)
                (clustered_apic_mode ? "NUMA-Q" : "Flat"), nr_ioapics);
 }
 
+static inline int cpu_present_to_apicid(int mps_cpu)
+{
+       if (clustered_apic_mode)
+               return ( ((mps_cpu/4)*16) + (1<<(mps_cpu%4)) );
+       else
+               return mps_cpu;
+}
+
+static inline unsigned long apicid_to_cpu_present(int apicid)
+{
+       return (1ul << apicid);
+}
+
 #endif /* __ASM_MACH_APIC_H */
index 0c21ed845c1a8000e26867437fda59f12585fdcf..4cc36cd80092f8c0d822b17763a95112c72009aa 100644 (file)
@@ -38,4 +38,20 @@ static inline void clustered_apic_check(void)
                (x86_summit ? "Summit" : "Flat"), nr_ioapics);
 }
 
+static inline int cpu_present_to_apicid(int mps_cpu)
+{
+       if (x86_summit)
+               return (int) raw_phys_apicid[mps_cpu];
+       else
+               return mps_cpu;
+}
+
+static inline unsigned long apicid_to_phys_cpu_present(int apicid)
+{
+       if (x86_summit)
+               return (1ul << (((apicid >> 4) << 2) | (apicid & 0x3)));
+       else
+               return (1ul << apicid);
+}
+
 #endif /* __ASM_MACH_APIC_H */
index f2a73c118d33d18820a91fb41a01c40400d454ef..6fee20b0ef9f829a6a7f9f724340e7c0cfc518cf 100644 (file)
 /*
  * a maximum of 16 APICs with the current APIC ID architecture.
  */
-#ifdef CONFIG_X86_NUMAQ
+#ifdef CONFIG_X86_NUMA
 #define MAX_APICS 256
-#else /* !CONFIG_X86_NUMAQ */
+#else /* !CONFIG_X86_NUMA */
 #define MAX_APICS 16
-#endif /* CONFIG_X86_NUMAQ */
+#endif /* CONFIG_X86_NUMA */
 
 #define MAX_MPC_ENTRY 1024
 
index a0d552e5d8435c28704b1fdcc99b4fe0d731683e..6df7592b84f54e7a0b764b8d6e2cd47e8dada3af 100644 (file)
@@ -65,6 +65,7 @@ extern void zap_low_mappings (void);
  * the real APIC ID <-> CPU # mapping.
  */
 #define MAX_APICID 256
+#define BAD_APICID 0xFFu
 extern volatile int cpu_to_physical_apicid[NR_CPUS];
 extern volatile int physical_apicid_to_cpu[MAX_APICID];
 extern volatile int cpu_to_logical_apicid[NR_CPUS];
index 6a77a1663ca91484dcf25873e0280147ea5ea37e..a3840aa6eca85b6b7067165c6d5202b92bbe1df1 100644 (file)
  #define boot_cpu_apicid boot_cpu_physical_apicid
 #endif /* CONFIG_CLUSTERED_APIC */
 
-/*
- * How to map from the cpu_present_map
- */
-#ifdef CONFIG_CLUSTERED_APIC
- #define cpu_present_to_apicid(mps_cpu) ( ((mps_cpu/4)*16) + (1<<(mps_cpu%4)) )
-#else /* !CONFIG_CLUSTERED_APIC */
- #define cpu_present_to_apicid(apicid) (apicid)
-#endif /* CONFIG_CLUSTERED_APIC */
-
 /*
  * Mappings between logical cpu number and logical / physical apicid
  * The first four macros are trivial, but it keeps the abstraction consistent