diff options
author | Torez Smith <lnxtorez@linux.vnet.ibm.com> | 2008-07-17 16:42:07 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2008-07-21 20:39:36 -0400 |
commit | 79e25bac124a7d1d7bf966f06dd9398a1b5f3d20 (patch) | |
tree | aab261c7e4fc562cc21f81055ad8cab622bd2040 | |
parent | 542a3a3bc9d9c176f7cb332948df1cb8ff91fa64 (diff) |
powerpc: Indicate which oprofile counters to use while in compat mode
While running on a system with new hardware and a kernel where the
cpu_specs[] table does not recognize the new hardware, the identify_cpu()
routine will select the default case as it searches through cpu_specs[]
in an attempt to match the real PVR. Once the default case is selected,
non of the oprofile counters and/or fields have been set up or defined.
When identify_cpu() is called once more with the logical PVR, some of
the cpu specific fields are replaced with the exception of the oprofile
related ones. However, in the case where we have actually taken the
default case while searching for the real PVR, we need to tell
oprofile that we are now running in compatibility mode so it can pick up
the correct counters. We do this by setting the oprofile_cpu_type field
to be that taken from the cpu_specs[] for the cpu we are now emulating.
This change will detect that we are now altering the real PVR and determine
if we also need to update the oprofile_cpu_type field.
Signed-off-by: Torez Smith <lnxtorez@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | arch/powerpc/kernel/cputable.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c index f7f3c215d06f..b936a1dd0a50 100644 --- a/arch/powerpc/kernel/cputable.c +++ b/arch/powerpc/kernel/cputable.c | |||
@@ -355,6 +355,7 @@ static struct cpu_spec __initdata cpu_specs[] = { | |||
355 | .icache_bsize = 128, | 355 | .icache_bsize = 128, |
356 | .dcache_bsize = 128, | 356 | .dcache_bsize = 128, |
357 | .machine_check = machine_check_generic, | 357 | .machine_check = machine_check_generic, |
358 | .oprofile_cpu_type = "ppc64/compat-power5+", | ||
358 | .platform = "power5+", | 359 | .platform = "power5+", |
359 | }, | 360 | }, |
360 | { /* Power6 */ | 361 | { /* Power6 */ |
@@ -386,6 +387,7 @@ static struct cpu_spec __initdata cpu_specs[] = { | |||
386 | .icache_bsize = 128, | 387 | .icache_bsize = 128, |
387 | .dcache_bsize = 128, | 388 | .dcache_bsize = 128, |
388 | .machine_check = machine_check_generic, | 389 | .machine_check = machine_check_generic, |
390 | .oprofile_cpu_type = "ppc64/compat-power6", | ||
389 | .platform = "power6", | 391 | .platform = "power6", |
390 | }, | 392 | }, |
391 | { /* 2.06-compliant processor, i.e. Power7 "architected" mode */ | 393 | { /* 2.06-compliant processor, i.e. Power7 "architected" mode */ |
@@ -397,6 +399,7 @@ static struct cpu_spec __initdata cpu_specs[] = { | |||
397 | .icache_bsize = 128, | 399 | .icache_bsize = 128, |
398 | .dcache_bsize = 128, | 400 | .dcache_bsize = 128, |
399 | .machine_check = machine_check_generic, | 401 | .machine_check = machine_check_generic, |
402 | .oprofile_cpu_type = "ppc64/compat-power7", | ||
400 | .platform = "power7", | 403 | .platform = "power7", |
401 | }, | 404 | }, |
402 | { /* Power7 */ | 405 | { /* Power7 */ |
@@ -1629,6 +1632,23 @@ struct cpu_spec * __init identify_cpu(unsigned long offset, unsigned int pvr) | |||
1629 | t->cpu_setup = s->cpu_setup; | 1632 | t->cpu_setup = s->cpu_setup; |
1630 | t->cpu_restore = s->cpu_restore; | 1633 | t->cpu_restore = s->cpu_restore; |
1631 | t->platform = s->platform; | 1634 | t->platform = s->platform; |
1635 | /* | ||
1636 | * If we have passed through this logic once | ||
1637 | * before and have pulled the default case | ||
1638 | * because the real PVR was not found inside | ||
1639 | * cpu_specs[], then we are possibly running in | ||
1640 | * compatibility mode. In that case, let the | ||
1641 | * oprofiler know which set of compatibility | ||
1642 | * counters to pull from by making sure the | ||
1643 | * oprofile_cpu_type string is set to that of | ||
1644 | * compatibility mode. If the oprofile_cpu_type | ||
1645 | * already has a value, then we are possibly | ||
1646 | * overriding a real PVR with a logical one, and, | ||
1647 | * in that case, keep the current value for | ||
1648 | * oprofile_cpu_type. | ||
1649 | */ | ||
1650 | if (t->oprofile_cpu_type == NULL) | ||
1651 | t->oprofile_cpu_type = s->oprofile_cpu_type; | ||
1632 | } else | 1652 | } else |
1633 | *t = *s; | 1653 | *t = *s; |
1634 | *PTRRELOC(&cur_cpu_spec) = &the_cpu_spec; | 1654 | *PTRRELOC(&cur_cpu_spec) = &the_cpu_spec; |