[tip:perf/urgent] perf/x86: Add perf support for AMD family-17h processors

From: tip-bot for Janakarajan Natarajan
Date: Fri Nov 18 2016 - 04:07:15 EST

Commit-ID: e40ed1542dd779e5037a22c6b534e57127472365
Gitweb: http://git.kernel.org/tip/e40ed1542dd779e5037a22c6b534e57127472365
Author: Janakarajan Natarajan <Janakarajan.Natarajan@xxxxxxx>
AuthorDate: Thu, 17 Nov 2016 10:15:06 -0600
Committer: Ingo Molnar <mingo@xxxxxxxxxx>
CommitDate: Fri, 18 Nov 2016 09:45:57 +0100

perf/x86: Add perf support for AMD family-17h processors

This patch enables perf core PMU support for the new AMD family-17h processors.

In family-17h, there is no PMC-event constraint. All events, irrespective of
the type, can be measured using any of the six generic performance counters.

Signed-off-by: Janakarajan Natarajan <Janakarajan.Natarajan@xxxxxxx>
Acked-by: Borislav Petkov <bp@xxxxxxx>
Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Stephane Eranian <eranian@xxxxxxxxxx>
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Vince Weaver <vincent.weaver@xxxxxxxxx>
Link: http://lkml.kernel.org/r/1479399306-13375-1-git-send-email-Janakarajan.Natarajan@xxxxxxx
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
arch/x86/events/amd/core.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c
index f5f4b3f..afb222b 100644
--- a/arch/x86/events/amd/core.c
+++ b/arch/x86/events/amd/core.c
@@ -662,7 +662,13 @@ static int __init amd_core_pmu_init(void)
pr_cont("Fam15h ");
x86_pmu.get_event_constraints = amd_get_event_constraints_f15h;
+ case 0x17:
+ pr_cont("Fam17h ");
+ /*
+ * In family 17h, there are no event constraints in the PMC hardware.
+ * We fallback to using default amd_get_event_constraints.
+ */
+ break;
pr_err("core perfctr but no constraints; unknown hardware!\n");
return -ENODEV;