aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMadhavan Srinivasan <maddy@linux.vnet.ibm.com>2016-12-01 19:34:59 -0500
committerMichael Ellerman <mpe@ellerman.id.au>2016-12-02 00:26:54 -0500
commit60b00025641e2921dcfba4d54b6cf7f0c5903677 (patch)
tree6315ee30caa368f4906e0366d1845ff622c8729a
parent4b6fad7097f883335b6d9627c883cb7f276d94c9 (diff)
powerpc/perf: factor out the event format field
Factor out the format field structure for PowerISA v2.07. Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--arch/powerpc/perf/isa207-common.c34
-rw-r--r--arch/powerpc/perf/power8-pmu.c39
-rw-r--r--arch/powerpc/perf/power9-pmu.c39
3 files changed, 42 insertions, 70 deletions
diff --git a/arch/powerpc/perf/isa207-common.c b/arch/powerpc/perf/isa207-common.c
index 6143c99f3ec5..2a2040ea5f99 100644
--- a/arch/powerpc/perf/isa207-common.c
+++ b/arch/powerpc/perf/isa207-common.c
@@ -12,6 +12,40 @@
12 */ 12 */
13#include "isa207-common.h" 13#include "isa207-common.h"
14 14
15PMU_FORMAT_ATTR(event, "config:0-49");
16PMU_FORMAT_ATTR(pmcxsel, "config:0-7");
17PMU_FORMAT_ATTR(mark, "config:8");
18PMU_FORMAT_ATTR(combine, "config:11");
19PMU_FORMAT_ATTR(unit, "config:12-15");
20PMU_FORMAT_ATTR(pmc, "config:16-19");
21PMU_FORMAT_ATTR(cache_sel, "config:20-23");
22PMU_FORMAT_ATTR(sample_mode, "config:24-28");
23PMU_FORMAT_ATTR(thresh_sel, "config:29-31");
24PMU_FORMAT_ATTR(thresh_stop, "config:32-35");
25PMU_FORMAT_ATTR(thresh_start, "config:36-39");
26PMU_FORMAT_ATTR(thresh_cmp, "config:40-49");
27
28struct attribute *isa207_pmu_format_attr[] = {
29 &format_attr_event.attr,
30 &format_attr_pmcxsel.attr,
31 &format_attr_mark.attr,
32 &format_attr_combine.attr,
33 &format_attr_unit.attr,
34 &format_attr_pmc.attr,
35 &format_attr_cache_sel.attr,
36 &format_attr_sample_mode.attr,
37 &format_attr_thresh_sel.attr,
38 &format_attr_thresh_stop.attr,
39 &format_attr_thresh_start.attr,
40 &format_attr_thresh_cmp.attr,
41 NULL,
42};
43
44struct attribute_group isa207_pmu_format_group = {
45 .name = "format",
46 .attrs = isa207_pmu_format_attr,
47};
48
15static inline bool event_is_fab_match(u64 event) 49static inline bool event_is_fab_match(u64 event)
16{ 50{
17 /* Only check pmc, unit and pmcxsel, ignore the edge bit (0) */ 51 /* Only check pmc, unit and pmcxsel, ignore the edge bit (0) */
diff --git a/arch/powerpc/perf/power8-pmu.c b/arch/powerpc/perf/power8-pmu.c
index ab830d106ec5..d07186382f3a 100644
--- a/arch/powerpc/perf/power8-pmu.c
+++ b/arch/powerpc/perf/power8-pmu.c
@@ -30,6 +30,9 @@ enum {
30#define POWER8_MMCRA_IFM2 0x0000000080000000UL 30#define POWER8_MMCRA_IFM2 0x0000000080000000UL
31#define POWER8_MMCRA_IFM3 0x00000000C0000000UL 31#define POWER8_MMCRA_IFM3 0x00000000C0000000UL
32 32
33/* PowerISA v2.07 format attribute structure*/
34extern struct attribute_group isa207_pmu_format_group;
35
33/* Table of alternatives, sorted by column 0 */ 36/* Table of alternatives, sorted by column 0 */
34static const unsigned int event_alternatives[][MAX_ALT] = { 37static const unsigned int event_alternatives[][MAX_ALT] = {
35 { PM_MRK_ST_CMPL, PM_MRK_ST_CMPL_ALT }, 38 { PM_MRK_ST_CMPL, PM_MRK_ST_CMPL_ALT },
@@ -175,42 +178,8 @@ static struct attribute_group power8_pmu_events_group = {
175 .attrs = power8_events_attr, 178 .attrs = power8_events_attr,
176}; 179};
177 180
178PMU_FORMAT_ATTR(event, "config:0-49");
179PMU_FORMAT_ATTR(pmcxsel, "config:0-7");
180PMU_FORMAT_ATTR(mark, "config:8");
181PMU_FORMAT_ATTR(combine, "config:11");
182PMU_FORMAT_ATTR(unit, "config:12-15");
183PMU_FORMAT_ATTR(pmc, "config:16-19");
184PMU_FORMAT_ATTR(cache_sel, "config:20-23");
185PMU_FORMAT_ATTR(sample_mode, "config:24-28");
186PMU_FORMAT_ATTR(thresh_sel, "config:29-31");
187PMU_FORMAT_ATTR(thresh_stop, "config:32-35");
188PMU_FORMAT_ATTR(thresh_start, "config:36-39");
189PMU_FORMAT_ATTR(thresh_cmp, "config:40-49");
190
191static struct attribute *power8_pmu_format_attr[] = {
192 &format_attr_event.attr,
193 &format_attr_pmcxsel.attr,
194 &format_attr_mark.attr,
195 &format_attr_combine.attr,
196 &format_attr_unit.attr,
197 &format_attr_pmc.attr,
198 &format_attr_cache_sel.attr,
199 &format_attr_sample_mode.attr,
200 &format_attr_thresh_sel.attr,
201 &format_attr_thresh_stop.attr,
202 &format_attr_thresh_start.attr,
203 &format_attr_thresh_cmp.attr,
204 NULL,
205};
206
207static struct attribute_group power8_pmu_format_group = {
208 .name = "format",
209 .attrs = power8_pmu_format_attr,
210};
211
212static const struct attribute_group *power8_pmu_attr_groups[] = { 181static const struct attribute_group *power8_pmu_attr_groups[] = {
213 &power8_pmu_format_group, 182 &isa207_pmu_format_group,
214 &power8_pmu_events_group, 183 &power8_pmu_events_group,
215 NULL, 184 NULL,
216}; 185};
diff --git a/arch/powerpc/perf/power9-pmu.c b/arch/powerpc/perf/power9-pmu.c
index 8e9a81967ff8..443511b18bc5 100644
--- a/arch/powerpc/perf/power9-pmu.c
+++ b/arch/powerpc/perf/power9-pmu.c
@@ -31,6 +31,9 @@ enum {
31#define POWER9_MMCRA_IFM2 0x0000000080000000UL 31#define POWER9_MMCRA_IFM2 0x0000000080000000UL
32#define POWER9_MMCRA_IFM3 0x00000000C0000000UL 32#define POWER9_MMCRA_IFM3 0x00000000C0000000UL
33 33
34/* PowerISA v2.07 format attribute structure*/
35extern struct attribute_group isa207_pmu_format_group;
36
34GENERIC_EVENT_ATTR(cpu-cycles, PM_CYC); 37GENERIC_EVENT_ATTR(cpu-cycles, PM_CYC);
35GENERIC_EVENT_ATTR(stalled-cycles-frontend, PM_ICT_NOSLOT_CYC); 38GENERIC_EVENT_ATTR(stalled-cycles-frontend, PM_ICT_NOSLOT_CYC);
36GENERIC_EVENT_ATTR(stalled-cycles-backend, PM_CMPLU_STALL); 39GENERIC_EVENT_ATTR(stalled-cycles-backend, PM_CMPLU_STALL);
@@ -90,42 +93,8 @@ static struct attribute_group power9_pmu_events_group = {
90 .attrs = power9_events_attr, 93 .attrs = power9_events_attr,
91}; 94};
92 95
93PMU_FORMAT_ATTR(event, "config:0-49");
94PMU_FORMAT_ATTR(pmcxsel, "config:0-7");
95PMU_FORMAT_ATTR(mark, "config:8");
96PMU_FORMAT_ATTR(combine, "config:11");
97PMU_FORMAT_ATTR(unit, "config:12-15");
98PMU_FORMAT_ATTR(pmc, "config:16-19");
99PMU_FORMAT_ATTR(cache_sel, "config:20-23");
100PMU_FORMAT_ATTR(sample_mode, "config:24-28");
101PMU_FORMAT_ATTR(thresh_sel, "config:29-31");
102PMU_FORMAT_ATTR(thresh_stop, "config:32-35");
103PMU_FORMAT_ATTR(thresh_start, "config:36-39");
104PMU_FORMAT_ATTR(thresh_cmp, "config:40-49");
105
106static struct attribute *power9_pmu_format_attr[] = {
107 &format_attr_event.attr,
108 &format_attr_pmcxsel.attr,
109 &format_attr_mark.attr,
110 &format_attr_combine.attr,
111 &format_attr_unit.attr,
112 &format_attr_pmc.attr,
113 &format_attr_cache_sel.attr,
114 &format_attr_sample_mode.attr,
115 &format_attr_thresh_sel.attr,
116 &format_attr_thresh_stop.attr,
117 &format_attr_thresh_start.attr,
118 &format_attr_thresh_cmp.attr,
119 NULL,
120};
121
122static struct attribute_group power9_pmu_format_group = {
123 .name = "format",
124 .attrs = power9_pmu_format_attr,
125};
126
127static const struct attribute_group *power9_pmu_attr_groups[] = { 96static const struct attribute_group *power9_pmu_attr_groups[] = {
128 &power9_pmu_format_group, 97 &isa207_pmu_format_group,
129 &power9_pmu_events_group, 98 &power9_pmu_events_group,
130 NULL, 99 NULL,
131}; 100};