Skip to content

Commit c43ca50

Browse files
Jacob ShinIngo Molnar
authored andcommitted
perf/x86/amd: Add support for AMD NB and L2I "uncore" counters
Add support for AMD Family 15h [and above] northbridge performance counters. MSRs 0xc0010240 ~ 0xc0010247 are shared across all cores that share a common northbridge. Add support for AMD Family 16h L2 performance counters. MSRs 0xc0010230 ~ 0xc0010237 are shared across all cores that share a common L2 cache. We do not enable counter overflow interrupts. Sampling mode and per-thread events are not supported. Signed-off-by: Jacob Shin <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/20130419213428.GA8229@jshin-Toonie Signed-off-by: Ingo Molnar <[email protected]>
1 parent e850f9c commit c43ca50

File tree

4 files changed

+553
-1
lines changed

4 files changed

+553
-1
lines changed

arch/x86/include/asm/cpufeature.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@
168168
#define X86_FEATURE_TOPOEXT (6*32+22) /* topology extensions CPUID leafs */
169169
#define X86_FEATURE_PERFCTR_CORE (6*32+23) /* core performance counter extensions */
170170
#define X86_FEATURE_PERFCTR_NB (6*32+24) /* NB performance counter extensions */
171+
#define X86_FEATURE_PERFCTR_L2 (6*32+28) /* L2 performance counter extensions */
171172

172173
/*
173174
* Auxiliary flags: Linux defined - For features scattered in various
@@ -311,6 +312,7 @@ extern const char * const x86_power_flags[32];
311312
#define cpu_has_pclmulqdq boot_cpu_has(X86_FEATURE_PCLMULQDQ)
312313
#define cpu_has_perfctr_core boot_cpu_has(X86_FEATURE_PERFCTR_CORE)
313314
#define cpu_has_perfctr_nb boot_cpu_has(X86_FEATURE_PERFCTR_NB)
315+
#define cpu_has_perfctr_l2 boot_cpu_has(X86_FEATURE_PERFCTR_L2)
314316
#define cpu_has_cx8 boot_cpu_has(X86_FEATURE_CX8)
315317
#define cpu_has_cx16 boot_cpu_has(X86_FEATURE_CX16)
316318
#define cpu_has_eager_fpu boot_cpu_has(X86_FEATURE_EAGER_FPU)

arch/x86/include/uapi/asm/msr-index.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@
196196
#define MSR_AMD64_IBSBRTARGET 0xc001103b
197197
#define MSR_AMD64_IBS_REG_COUNT_MAX 8 /* includes MSR_AMD64_IBSBRTARGET */
198198

199+
/* Fam 16h MSRs */
200+
#define MSR_F16H_L2I_PERF_CTL 0xc0010230
201+
#define MSR_F16H_L2I_PERF_CTR 0xc0010231
202+
199203
/* Fam 15h MSRs */
200204
#define MSR_F15H_PERF_CTL 0xc0010200
201205
#define MSR_F15H_PERF_CTR 0xc0010201

arch/x86/kernel/cpu/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ obj-$(CONFIG_CPU_SUP_UMC_32) += umc.o
3131
obj-$(CONFIG_PERF_EVENTS) += perf_event.o
3232

3333
ifdef CONFIG_PERF_EVENTS
34-
obj-$(CONFIG_CPU_SUP_AMD) += perf_event_amd.o
34+
obj-$(CONFIG_CPU_SUP_AMD) += perf_event_amd.o perf_event_amd_uncore.o
3535
obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_p6.o perf_event_knc.o perf_event_p4.o
3636
obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_lbr.o perf_event_intel_ds.o perf_event_intel.o
3737
obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_uncore.o

0 commit comments

Comments
 (0)