diff options
author | Paul Mackerras <paulus@samba.org> | 2009-06-17 07:52:09 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-06-18 05:11:45 -0400 |
commit | 079b3c569c87819e7a19d9b9f51d4746fc47bf9a (patch) | |
tree | 63dd236c582eebebb0667a3e5235b02b14c850be /arch/powerpc/kernel/perf_counter.c | |
parent | 448d64f8f4c147db466c549550767cc515a4d34c (diff) |
perf_counter: powerpc: Change how processor-specific back-ends get selected
At present, the powerpc generic (processor-independent) perf_counter
code has list of processor back-end modules, and at initialization,
it looks at the PVR (processor version register) and has a switch
statement to select a suitable processor-specific back-end.
This is going to become inconvenient as we add more processor-specific
back-ends, so this inverts the order: now each back-end checks whether
it applies to the current processor, and registers itself if so.
Furthermore, instead of looking at the PVR, back-ends now check the
cur_cpu_spec->oprofile_cpu_type string and match on that.
Lastly, each back-end now specifies a name for itself so the core can
print a nice message when a back-end registers itself.
This doesn't provide any support for unregistering back-ends, but that
wouldn't be hard to do and would allow back-ends to be modules.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: linuxppc-dev@ozlabs.org
Cc: benh@kernel.crashing.org
LKML-Reference: <19000.55529.762227.518531@cargo.ozlabs.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/powerpc/kernel/perf_counter.c')
-rw-r--r-- | arch/powerpc/kernel/perf_counter.c | 44 |
1 files changed, 7 insertions, 37 deletions
diff --git a/arch/powerpc/kernel/perf_counter.c b/arch/powerpc/kernel/perf_counter.c index 9300638b8c26..25e656c14945 100644 --- a/arch/powerpc/kernel/perf_counter.c +++ b/arch/powerpc/kernel/perf_counter.c | |||
@@ -1214,42 +1214,14 @@ void hw_perf_counter_setup(int cpu) | |||
1214 | cpuhw->mmcr[0] = MMCR0_FC; | 1214 | cpuhw->mmcr[0] = MMCR0_FC; |
1215 | } | 1215 | } |
1216 | 1216 | ||
1217 | extern struct power_pmu power4_pmu; | 1217 | int register_power_pmu(struct power_pmu *pmu) |
1218 | extern struct power_pmu ppc970_pmu; | ||
1219 | extern struct power_pmu power5_pmu; | ||
1220 | extern struct power_pmu power5p_pmu; | ||
1221 | extern struct power_pmu power6_pmu; | ||
1222 | extern struct power_pmu power7_pmu; | ||
1223 | |||
1224 | static int init_perf_counters(void) | ||
1225 | { | 1218 | { |
1226 | unsigned long pvr; | 1219 | if (ppmu) |
1227 | 1220 | return -EBUSY; /* something's already registered */ | |
1228 | /* XXX should get this from cputable */ | 1221 | |
1229 | pvr = mfspr(SPRN_PVR); | 1222 | ppmu = pmu; |
1230 | switch (PVR_VER(pvr)) { | 1223 | pr_info("%s performance monitor hardware support registered\n", |
1231 | case PV_POWER4: | 1224 | pmu->name); |
1232 | case PV_POWER4p: | ||
1233 | ppmu = &power4_pmu; | ||
1234 | break; | ||
1235 | case PV_970: | ||
1236 | case PV_970FX: | ||
1237 | case PV_970MP: | ||
1238 | ppmu = &ppc970_pmu; | ||
1239 | break; | ||
1240 | case PV_POWER5: | ||
1241 | ppmu = &power5_pmu; | ||
1242 | break; | ||
1243 | case PV_POWER5p: | ||
1244 | ppmu = &power5p_pmu; | ||
1245 | break; | ||
1246 | case 0x3e: | ||
1247 | ppmu = &power6_pmu; | ||
1248 | break; | ||
1249 | case 0x3f: | ||
1250 | ppmu = &power7_pmu; | ||
1251 | break; | ||
1252 | } | ||
1253 | 1225 | ||
1254 | /* | 1226 | /* |
1255 | * Use FCHV to ignore kernel events if MSR.HV is set. | 1227 | * Use FCHV to ignore kernel events if MSR.HV is set. |
@@ -1259,5 +1231,3 @@ static int init_perf_counters(void) | |||
1259 | 1231 | ||
1260 | return 0; | 1232 | return 0; |
1261 | } | 1233 | } |
1262 | |||
1263 | arch_initcall(init_perf_counters); | ||