diff options
author | Madhavan Srinivasan <maddy@linux.vnet.ibm.com> | 2016-12-01 19:34:59 -0500 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2016-12-02 00:26:54 -0500 |
commit | 60b00025641e2921dcfba4d54b6cf7f0c5903677 (patch) | |
tree | 6315ee30caa368f4906e0366d1845ff622c8729a | |
parent | 4b6fad7097f883335b6d9627c883cb7f276d94c9 (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.c | 34 | ||||
-rw-r--r-- | arch/powerpc/perf/power8-pmu.c | 39 | ||||
-rw-r--r-- | arch/powerpc/perf/power9-pmu.c | 39 |
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 | ||
15 | PMU_FORMAT_ATTR(event, "config:0-49"); | ||
16 | PMU_FORMAT_ATTR(pmcxsel, "config:0-7"); | ||
17 | PMU_FORMAT_ATTR(mark, "config:8"); | ||
18 | PMU_FORMAT_ATTR(combine, "config:11"); | ||
19 | PMU_FORMAT_ATTR(unit, "config:12-15"); | ||
20 | PMU_FORMAT_ATTR(pmc, "config:16-19"); | ||
21 | PMU_FORMAT_ATTR(cache_sel, "config:20-23"); | ||
22 | PMU_FORMAT_ATTR(sample_mode, "config:24-28"); | ||
23 | PMU_FORMAT_ATTR(thresh_sel, "config:29-31"); | ||
24 | PMU_FORMAT_ATTR(thresh_stop, "config:32-35"); | ||
25 | PMU_FORMAT_ATTR(thresh_start, "config:36-39"); | ||
26 | PMU_FORMAT_ATTR(thresh_cmp, "config:40-49"); | ||
27 | |||
28 | struct 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 | |||
44 | struct attribute_group isa207_pmu_format_group = { | ||
45 | .name = "format", | ||
46 | .attrs = isa207_pmu_format_attr, | ||
47 | }; | ||
48 | |||
15 | static inline bool event_is_fab_match(u64 event) | 49 | static 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*/ | ||
34 | extern struct attribute_group isa207_pmu_format_group; | ||
35 | |||
33 | /* Table of alternatives, sorted by column 0 */ | 36 | /* Table of alternatives, sorted by column 0 */ |
34 | static const unsigned int event_alternatives[][MAX_ALT] = { | 37 | static 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 | ||
178 | PMU_FORMAT_ATTR(event, "config:0-49"); | ||
179 | PMU_FORMAT_ATTR(pmcxsel, "config:0-7"); | ||
180 | PMU_FORMAT_ATTR(mark, "config:8"); | ||
181 | PMU_FORMAT_ATTR(combine, "config:11"); | ||
182 | PMU_FORMAT_ATTR(unit, "config:12-15"); | ||
183 | PMU_FORMAT_ATTR(pmc, "config:16-19"); | ||
184 | PMU_FORMAT_ATTR(cache_sel, "config:20-23"); | ||
185 | PMU_FORMAT_ATTR(sample_mode, "config:24-28"); | ||
186 | PMU_FORMAT_ATTR(thresh_sel, "config:29-31"); | ||
187 | PMU_FORMAT_ATTR(thresh_stop, "config:32-35"); | ||
188 | PMU_FORMAT_ATTR(thresh_start, "config:36-39"); | ||
189 | PMU_FORMAT_ATTR(thresh_cmp, "config:40-49"); | ||
190 | |||
191 | static 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 | |||
207 | static struct attribute_group power8_pmu_format_group = { | ||
208 | .name = "format", | ||
209 | .attrs = power8_pmu_format_attr, | ||
210 | }; | ||
211 | |||
212 | static const struct attribute_group *power8_pmu_attr_groups[] = { | 181 | static 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*/ | ||
35 | extern struct attribute_group isa207_pmu_format_group; | ||
36 | |||
34 | GENERIC_EVENT_ATTR(cpu-cycles, PM_CYC); | 37 | GENERIC_EVENT_ATTR(cpu-cycles, PM_CYC); |
35 | GENERIC_EVENT_ATTR(stalled-cycles-frontend, PM_ICT_NOSLOT_CYC); | 38 | GENERIC_EVENT_ATTR(stalled-cycles-frontend, PM_ICT_NOSLOT_CYC); |
36 | GENERIC_EVENT_ATTR(stalled-cycles-backend, PM_CMPLU_STALL); | 39 | GENERIC_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 | ||
93 | PMU_FORMAT_ATTR(event, "config:0-49"); | ||
94 | PMU_FORMAT_ATTR(pmcxsel, "config:0-7"); | ||
95 | PMU_FORMAT_ATTR(mark, "config:8"); | ||
96 | PMU_FORMAT_ATTR(combine, "config:11"); | ||
97 | PMU_FORMAT_ATTR(unit, "config:12-15"); | ||
98 | PMU_FORMAT_ATTR(pmc, "config:16-19"); | ||
99 | PMU_FORMAT_ATTR(cache_sel, "config:20-23"); | ||
100 | PMU_FORMAT_ATTR(sample_mode, "config:24-28"); | ||
101 | PMU_FORMAT_ATTR(thresh_sel, "config:29-31"); | ||
102 | PMU_FORMAT_ATTR(thresh_stop, "config:32-35"); | ||
103 | PMU_FORMAT_ATTR(thresh_start, "config:36-39"); | ||
104 | PMU_FORMAT_ATTR(thresh_cmp, "config:40-49"); | ||
105 | |||
106 | static 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 | |||
122 | static struct attribute_group power9_pmu_format_group = { | ||
123 | .name = "format", | ||
124 | .attrs = power9_pmu_format_attr, | ||
125 | }; | ||
126 | |||
127 | static const struct attribute_group *power9_pmu_attr_groups[] = { | 96 | static 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 | }; |