aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/perf_event.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/cpu/perf_event.c')
-rw-r--r--arch/x86/kernel/cpu/perf_event.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 316194330da..10bfe2472d1 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -321,14 +321,22 @@ again:
321 return new_raw_count; 321 return new_raw_count;
322} 322}
323 323
324/* using X86_FEATURE_PERFCTR_CORE to later implement ALTERNATIVE() here */
325static inline int x86_pmu_addr_offset(int index)
326{
327 if (boot_cpu_has(X86_FEATURE_PERFCTR_CORE))
328 return index << 1;
329 return index;
330}
331
324static inline unsigned int x86_pmu_config_addr(int index) 332static inline unsigned int x86_pmu_config_addr(int index)
325{ 333{
326 return x86_pmu.eventsel + index; 334 return x86_pmu.eventsel + x86_pmu_addr_offset(index);
327} 335}
328 336
329static inline unsigned int x86_pmu_event_addr(int index) 337static inline unsigned int x86_pmu_event_addr(int index)
330{ 338{
331 return x86_pmu.perfctr + index; 339 return x86_pmu.perfctr + x86_pmu_addr_offset(index);
332} 340}
333 341
334static atomic_t active_events; 342static atomic_t active_events;