Merge branch 'for-linus' of git://neil.brown.name/md
[sfrench/cifs-2.6.git] / arch / powerpc / kernel / cputable.c
index f7f3c215d06f30f3251ceea62bf6521f3813bb81..25c273c761d19855f2d8861720c24f7cb095bb2f 100644 (file)
@@ -23,6 +23,9 @@
 struct cpu_spec* cur_cpu_spec = NULL;
 EXPORT_SYMBOL(cur_cpu_spec);
 
+/* The platform string corresponding to the real PVR */
+const char *powerpc_base_platform;
+
 /* NOTE:
  * Unlike ppc32, ppc64 will only call this once for the boot CPU, it's
  * the responsibility of the appropriate CPU save/restore functions to
@@ -355,6 +358,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
                .icache_bsize           = 128,
                .dcache_bsize           = 128,
                .machine_check          = machine_check_generic,
+               .oprofile_cpu_type      = "ppc64/compat-power5+",
                .platform               = "power5+",
        },
        {       /* Power6 */
@@ -386,6 +390,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
                .icache_bsize           = 128,
                .dcache_bsize           = 128,
                .machine_check          = machine_check_generic,
+               .oprofile_cpu_type      = "ppc64/compat-power6",
                .platform               = "power6",
        },
        {       /* 2.06-compliant processor, i.e. Power7 "architected" mode */
@@ -397,6 +402,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
                .icache_bsize           = 128,
                .dcache_bsize           = 128,
                .machine_check          = machine_check_generic,
+               .oprofile_cpu_type      = "ppc64/compat-power7",
                .platform               = "power7",
        },
        {       /* Power7 */
@@ -1629,9 +1635,34 @@ struct cpu_spec * __init identify_cpu(unsigned long offset, unsigned int pvr)
                                t->cpu_setup = s->cpu_setup;
                                t->cpu_restore = s->cpu_restore;
                                t->platform = s->platform;
+                               /*
+                                * If we have passed through this logic once
+                                * before and have pulled the default case
+                                * because the real PVR was not found inside
+                                * cpu_specs[], then we are possibly running in
+                                * compatibility mode. In that case, let the
+                                * oprofiler know which set of compatibility
+                                * counters to pull from by making sure the
+                                * oprofile_cpu_type string is set to that of
+                                * compatibility mode. If the oprofile_cpu_type
+                                * already has a value, then we are possibly
+                                * overriding a real PVR with a logical one, and,
+                                * in that case, keep the current value for
+                                * oprofile_cpu_type.
+                                */
+                               if (t->oprofile_cpu_type == NULL)
+                                       t->oprofile_cpu_type = s->oprofile_cpu_type;
                        } else
                                *t = *s;
                        *PTRRELOC(&cur_cpu_spec) = &the_cpu_spec;
+
+                       /*
+                        * Set the base platform string once; assumes
+                        * we're called with real pvr first.
+                        */
+                       if (*PTRRELOC(&powerpc_base_platform) == NULL)
+                               *PTRRELOC(&powerpc_base_platform) = t->platform;
+
 #if defined(CONFIG_PPC64) || defined(CONFIG_BOOKE)
                        /* ppc64 and booke expect identify_cpu to also call
                         * setup_cpu for that processor. I will consolidate