aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/events/amd/uncore.c10
-rw-r--r--arch/x86/include/asm/perf_event.h8
2 files changed, 18 insertions, 0 deletions
diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c
index 981ba5e8241b..8671de126eac 100644
--- a/arch/x86/events/amd/uncore.c
+++ b/arch/x86/events/amd/uncore.c
@@ -36,6 +36,7 @@
36 36
37static int num_counters_llc; 37static int num_counters_llc;
38static int num_counters_nb; 38static int num_counters_nb;
39static bool l3_mask;
39 40
40static HLIST_HEAD(uncore_unused_list); 41static HLIST_HEAD(uncore_unused_list);
41 42
@@ -209,6 +210,13 @@ static int amd_uncore_event_init(struct perf_event *event)
209 hwc->config = event->attr.config & AMD64_RAW_EVENT_MASK_NB; 210 hwc->config = event->attr.config & AMD64_RAW_EVENT_MASK_NB;
210 hwc->idx = -1; 211 hwc->idx = -1;
211 212
213 /*
214 * SliceMask and ThreadMask need to be set for certain L3 events in
215 * Family 17h. For other events, the two fields do not affect the count.
216 */
217 if (l3_mask)
218 hwc->config |= (AMD64_L3_SLICE_MASK | AMD64_L3_THREAD_MASK);
219
212 if (event->cpu < 0) 220 if (event->cpu < 0)
213 return -EINVAL; 221 return -EINVAL;
214 222
@@ -525,6 +533,7 @@ static int __init amd_uncore_init(void)
525 amd_llc_pmu.name = "amd_l3"; 533 amd_llc_pmu.name = "amd_l3";
526 format_attr_event_df.show = &event_show_df; 534 format_attr_event_df.show = &event_show_df;
527 format_attr_event_l3.show = &event_show_l3; 535 format_attr_event_l3.show = &event_show_l3;
536 l3_mask = true;
528 } else { 537 } else {
529 num_counters_nb = NUM_COUNTERS_NB; 538 num_counters_nb = NUM_COUNTERS_NB;
530 num_counters_llc = NUM_COUNTERS_L2; 539 num_counters_llc = NUM_COUNTERS_L2;
@@ -532,6 +541,7 @@ static int __init amd_uncore_init(void)
532 amd_llc_pmu.name = "amd_l2"; 541 amd_llc_pmu.name = "amd_l2";
533 format_attr_event_df = format_attr_event; 542 format_attr_event_df = format_attr_event;
534 format_attr_event_l3 = format_attr_event; 543 format_attr_event_l3 = format_attr_event;
544 l3_mask = false;
535 } 545 }
536 546
537 amd_nb_pmu.attr_groups = amd_uncore_attr_groups_df; 547 amd_nb_pmu.attr_groups = amd_uncore_attr_groups_df;
diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h
index 12f54082f4c8..78241b736f2a 100644
--- a/arch/x86/include/asm/perf_event.h
+++ b/arch/x86/include/asm/perf_event.h
@@ -46,6 +46,14 @@
46#define INTEL_ARCH_EVENT_MASK \ 46#define INTEL_ARCH_EVENT_MASK \
47 (ARCH_PERFMON_EVENTSEL_UMASK | ARCH_PERFMON_EVENTSEL_EVENT) 47 (ARCH_PERFMON_EVENTSEL_UMASK | ARCH_PERFMON_EVENTSEL_EVENT)
48 48
49#define AMD64_L3_SLICE_SHIFT 48
50#define AMD64_L3_SLICE_MASK \
51 ((0xFULL) << AMD64_L3_SLICE_SHIFT)
52
53#define AMD64_L3_THREAD_SHIFT 56
54#define AMD64_L3_THREAD_MASK \
55 ((0xFFULL) << AMD64_L3_THREAD_SHIFT)
56
49#define X86_RAW_EVENT_MASK \ 57#define X86_RAW_EVENT_MASK \
50 (ARCH_PERFMON_EVENTSEL_EVENT | \ 58 (ARCH_PERFMON_EVENTSEL_EVENT | \
51 ARCH_PERFMON_EVENTSEL_UMASK | \ 59 ARCH_PERFMON_EVENTSEL_UMASK | \