[PATCH 7/8] perf/POWER7: Create a sysfs format entry for Power7 events

Arnaldo Carvalho de Melo acme at infradead.org
Thu Mar 14 23:23:14 EST 2013

From: Sukadev Bhattiprolu <sukadev at linux.vnet.ibm.com>

Create a sysfs entry, '/sys/bus/event_source/devices/cpu/format/event'
which describes the format of the POWER7 PMU events.

This code is based on corresponding code in x86.

Changelog[v4]:  [Michael Ellerman, Paul Mckerras] The event format is different
		for other POWER cpus. So move the code to POWER7-specific,
		power7-pmu.c Also, the POWER7 format uses bits 0-19 not 0-20.

Changelog[v2]: [Jiri Osla] Use PMU_FORMAT_ATTR rather than duplicating code.

Signed-off-by: Sukadev Bhattiprolu <sukadev at linux.vnet.ibm.com>
Acked-by: Paul Mackerras <paulus at samba.org>
Tested-by: Michael Ellerman <michael at ellerman.id.au>
Cc: Andi Kleen <ak at linux.intel.com>
Cc: Anton Blanchard <anton at au1.ibm.com>
Cc: Ingo Molnar <mingo at redhat.com>
Cc: Jiri Olsa <jolsa at redhat.com>
Cc: Michael Ellerman <michael at ellerman.id.au>
Cc: Paul Mackerras <paulus at samba.org>
Cc: Peter Zijlstra <a.p.zijlstra at chello.nl>
Cc: Robert Richter <robert.richter at amd.com>
Cc: Stephane Eranian <eranian at google.com>
Cc: benh at kernel.crashing.org
Cc: linuxppc-dev at ozlabs.org
Link: http://lkml.kernel.org/r/20130306054826.GA14627@us.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme at redhat.com>
 arch/powerpc/perf/power7-pmu.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/perf/power7-pmu.c b/arch/powerpc/perf/power7-pmu.c
index b554879..3c475d6 100644
--- a/arch/powerpc/perf/power7-pmu.c
+++ b/arch/powerpc/perf/power7-pmu.c
@@ -420,7 +420,20 @@ static struct attribute_group power7_pmu_events_group = {
 	.attrs = power7_events_attr,
+PMU_FORMAT_ATTR(event, "config:0-19");
+static struct attribute *power7_pmu_format_attr[] = {
+	&format_attr_event.attr,
+struct attribute_group power7_pmu_format_group = {
+	.name = "format",
+	.attrs = power7_pmu_format_attr,
 static const struct attribute_group *power7_pmu_attr_groups[] = {
+	&power7_pmu_format_group,

More information about the Linuxppc-dev mailing list