[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86: mpparse and cstate need to use 32bit apic id



# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1292413934 0
# Node ID 548c808be2a6f166657ce7cfb86df7a296a9526a
# Parent  c0662cb08260d831ae8d211ba16fc7038cb889b6
x86: mpparse and cstate need to use 32bit apic id

Instead of going with mpc_config_processor struct.
that field ony have 8 bits.

We should not change that struct, because it is shared with mptable.

Also need to increase MAX_APICS.

Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx>

Rather than using a fixed value of 512, make this scale with NR_CPUS
(which obviously still doesn't cover all theoretically possible
systems, but at least allows some build time control).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 xen/arch/x86/acpi/cpu_idle.c                 |    2 +-
 xen/arch/x86/mpparse.c                       |   20 +++++++++++++-------
 xen/common/sched_sedf.c                      |    1 -
 xen/include/asm-x86/mach-generic/mach_apic.h |    6 +++---
 xen/include/asm-x86/mpspec_def.h             |    2 +-
 xen/include/xen/kernel.h                     |    7 +++++++
 6 files changed, 25 insertions(+), 13 deletions(-)

diff -r c0662cb08260 -r 548c808be2a6 xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c      Wed Dec 15 11:21:28 2010 +0000
+++ b/xen/arch/x86/acpi/cpu_idle.c      Wed Dec 15 11:52:14 2010 +0000
@@ -866,7 +866,7 @@ int get_cpu_id(u8 acpi_id)
 int get_cpu_id(u8 acpi_id)
 {
     int i;
-    u8 apic_id;
+    u32 apic_id;
 
     apic_id = x86_acpiid_to_apicid[acpi_id];
     if ( apic_id == 0xff )
diff -r c0662cb08260 -r 548c808be2a6 xen/arch/x86/mpparse.c
--- a/xen/arch/x86/mpparse.c    Wed Dec 15 11:21:28 2010 +0000
+++ b/xen/arch/x86/mpparse.c    Wed Dec 15 11:52:14 2010 +0000
@@ -99,7 +99,8 @@ static struct mpc_config_translation *tr
 static struct mpc_config_translation *translation_table[MAX_MPC_ENTRY] 
__initdata;
 
 /* Return xen's logical cpu_id of the new added cpu or <0 if error */
-static int __devinit MP_processor_info (struct mpc_config_processor *m)
+static int __devinit MP_processor_info_x(struct mpc_config_processor *m,
+                                        u32 apicidx)
 {
        int ver, apicid, cpu = 0;
        physid_mask_t phys_cpu;
@@ -107,7 +108,7 @@ static int __devinit MP_processor_info (
        if (!(m->mpc_cpuflag & CPU_ENABLED))
                return -EINVAL;
 
-       apicid = mpc_apic_id(m, translation_table[mpc_record]);
+       apicid = mpc_apic_id(m, apicidx, translation_table[mpc_record]);
 
        if (m->mpc_featureflag&(1<<0))
                Dprintk("    Floating point unit present.\n");
@@ -159,7 +160,7 @@ static int __devinit MP_processor_info (
 
        if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) {
                Dprintk("    Bootup CPU\n");
-               boot_cpu_physical_apicid = m->mpc_apicid;
+               boot_cpu_physical_apicid = apicid;
        }
 
        ver = m->mpc_apicver;
@@ -170,10 +171,10 @@ static int __devinit MP_processor_info (
        if (ver == 0x0) {
                printk(KERN_WARNING "BIOS bug, APIC version is 0 for CPU#%d! "
                                "fixing up to 0x10. (tell your hw vendor)\n",
-                               m->mpc_apicid);
+                               apicid);
                ver = 0x10;
        }
-       apic_version[m->mpc_apicid] = ver;
+       apic_version[apicid] = ver;
 
        phys_cpu = apicid_to_cpu_present(apicid);
        physids_or(phys_cpu_present_map, phys_cpu_present_map, phys_cpu);
@@ -211,6 +212,11 @@ static int __devinit MP_processor_info (
        }
 
        return cpu;
+}
+
+static int __devinit MP_processor_info(struct mpc_config_processor *m)
+{
+       return MP_processor_info_x(m, m->mpc_apicid);
 }
 
 static void __init MP_bus_info (struct mpc_config_bus *m)
@@ -839,7 +845,7 @@ int __devinit mp_register_lapic (
        struct mpc_config_processor processor;
        int                     boot_cpu = 0;
        
-       if (MAX_APICS - id <= 0) {
+       if (MAX_APICS <= id) {
                printk(KERN_WARNING "Processor #%d invalid (max %d)\n",
                        id, MAX_APICS);
                return -EINVAL;
@@ -859,7 +865,7 @@ int __devinit mp_register_lapic (
        processor.mpc_reserved[0] = 0;
        processor.mpc_reserved[1] = 0;
 
-       return MP_processor_info(&processor);
+       return MP_processor_info_x(&processor, id);
 }
 
 void mp_unregister_lapic(uint32_t apic_id, uint32_t cpu)
diff -r c0662cb08260 -r 548c808be2a6 xen/common/sched_sedf.c
--- a/xen/common/sched_sedf.c   Wed Dec 15 11:21:28 2010 +0000
+++ b/xen/common/sched_sedf.c   Wed Dec 15 11:52:14 2010 +0000
@@ -127,7 +127,6 @@ struct sedf_cpu_info {
 
 #define PERIOD_BEGIN(inf) ((inf)->deadl_abs - (inf)->period)
 
-#define MIN(x,y)    (((x)<(y))?(x):(y))
 #define DIV_UP(x,y) (((x) + (y) - 1) / y)
 
 #define extra_runs(inf)      ((inf->status) & 6)
diff -r c0662cb08260 -r 548c808be2a6 
xen/include/asm-x86/mach-generic/mach_apic.h
--- a/xen/include/asm-x86/mach-generic/mach_apic.h      Wed Dec 15 11:21:28 
2010 +0000
+++ b/xen/include/asm-x86/mach-generic/mach_apic.h      Wed Dec 15 11:52:14 
2010 +0000
@@ -28,15 +28,15 @@ static inline void enable_apic_mode(void
 
 extern u32 bios_cpu_apicid[];
 
-static inline int mpc_apic_id(struct mpc_config_processor *m, 
+static inline int mpc_apic_id(struct mpc_config_processor *m, u32 apicid,
                        struct mpc_config_translation *translation_record)
 {
        printk("Processor #%d %d:%d APIC version %d\n",
-                       m->mpc_apicid,
+                       apicid,
                        (m->mpc_cpufeature & CPU_FAMILY_MASK) >> 8,
                        (m->mpc_cpufeature & CPU_MODEL_MASK) >> 4,
                        m->mpc_apicver);
-       return (m->mpc_apicid);
+       return apicid;
 }
 
 static inline int multi_timer_check(int apic, int irq)
diff -r c0662cb08260 -r 548c808be2a6 xen/include/asm-x86/mpspec_def.h
--- a/xen/include/asm-x86/mpspec_def.h  Wed Dec 15 11:21:28 2010 +0000
+++ b/xen/include/asm-x86/mpspec_def.h  Wed Dec 15 11:52:14 2010 +0000
@@ -14,7 +14,7 @@
 #define SMP_MAGIC_IDENT        (('_'<<24)|('P'<<16)|('M'<<8)|'_')
 
 #define MAX_MPC_ENTRY 1024
-#define MAX_APICS      256
+#define MAX_APICS     MAX(256, 4 * NR_CPUS)
 
 struct intel_mp_floating
 {
diff -r c0662cb08260 -r 548c808be2a6 xen/include/xen/kernel.h
--- a/xen/include/xen/kernel.h  Wed Dec 15 11:21:28 2010 +0000
+++ b/xen/include/xen/kernel.h  Wed Dec 15 11:52:14 2010 +0000
@@ -32,6 +32,13 @@
         ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
 #define max_t(type,x,y) \
         ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
+
+/*
+ * pre-processor, array size, and bit field width suitable variants;
+ * please don't use in "normal" expressions.
+ */
+#define MIN(x,y) ((x) < (y) ? (x) : (y))
+#define MAX(x,y) ((x) > (y) ? (x) : (y))
 
 /**
  * container_of - cast a member of a structure out to the containing structure

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.