aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/perf_event_amd.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2010-03-30 11:00:06 -0400
committerIngo Molnar <mingo@elte.hu>2010-04-02 13:52:04 -0400
commitb4cdc5c264b35c67007800dec3928e9547a9d70b (patch)
tree1e4c723538c5c1c2bb68c96975cea5bc47789991 /arch/x86/kernel/cpu/perf_event_amd.c
parenta098f4484bc7dae23f5b62360954007b99b64600 (diff)
perf, x86: Fix up the ANY flag stuff
Stephane noticed that the ANY flag was in generic arch code, and Cyrill reported that it broke the P4 code. Solve this by merging x86_pmu::raw_event into x86_pmu::hw_config and provide intel_pmu and amd_pmu specific versions of this callback. The intel_pmu one deals with the ANY flag, the amd_pmu adds the few extra event bits AMD64 has. Reported-by: Stephane Eranian <eranian@google.com> Reported-by: Cyrill Gorcunov <gorcunov@gmail.com> Acked-by: Robert Richter <robert.richter@amd.com> Acked-by: Cyrill Gorcunov <gorcunov@gmail.com> Acked-by: Stephane Eranian <eranian@google.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <1269968113.5258.442.camel@laptop> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/cpu/perf_event_amd.c')
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
index 37e9517729df..bbd7339f08a9 100644
--- a/arch/x86/kernel/cpu/perf_event_amd.c
+++ b/arch/x86/kernel/cpu/perf_event_amd.c
@@ -111,9 +111,19 @@ static u64 amd_pmu_event_map(int hw_event)
111 return amd_perfmon_event_map[hw_event]; 111 return amd_perfmon_event_map[hw_event];
112} 112}
113 113
114static u64 amd_pmu_raw_event(u64 hw_event) 114static int amd_pmu_hw_config(struct perf_event *event)
115{ 115{
116 return hw_event & AMD64_RAW_EVENT_MASK; 116 int ret = x86_pmu_hw_config(event);
117
118 if (ret)
119 return ret;
120
121 if (event->attr.type != PERF_TYPE_RAW)
122 return 0;
123
124 event->hw.config |= event->attr.config & AMD64_RAW_EVENT_MASK;
125
126 return 0;
117} 127}
118 128
119/* 129/*
@@ -365,12 +375,11 @@ static __initconst struct x86_pmu amd_pmu = {
365 .enable_all = x86_pmu_enable_all, 375 .enable_all = x86_pmu_enable_all,
366 .enable = x86_pmu_enable_event, 376 .enable = x86_pmu_enable_event,
367 .disable = x86_pmu_disable_event, 377 .disable = x86_pmu_disable_event,
368 .hw_config = x86_hw_config, 378 .hw_config = amd_pmu_hw_config,
369 .schedule_events = x86_schedule_events, 379 .schedule_events = x86_schedule_events,
370 .eventsel = MSR_K7_EVNTSEL0, 380 .eventsel = MSR_K7_EVNTSEL0,
371 .perfctr = MSR_K7_PERFCTR0, 381 .perfctr = MSR_K7_PERFCTR0,
372 .event_map = amd_pmu_event_map, 382 .event_map = amd_pmu_event_map,
373 .raw_event = amd_pmu_raw_event,
374 .max_events = ARRAY_SIZE(amd_perfmon_event_map), 383 .max_events = ARRAY_SIZE(amd_perfmon_event_map),
375 .num_counters = 4, 384 .num_counters = 4,
376 .cntval_bits = 48, 385 .cntval_bits = 48,