powerpc/perf: factor out the event format field
authorMadhavan Srinivasan <maddy@linux.vnet.ibm.com>
Fri, 2 Dec 2016 00:34:59 +0000 (06:04 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 2 Dec 2016 05:26:54 +0000 (16:26 +1100)
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>
arch/powerpc/perf/isa207-common.c
arch/powerpc/perf/power8-pmu.c
arch/powerpc/perf/power9-pmu.c

index 6143c99f3ec503d01423059d364577d1a5930e3a..2a2040ea5f99e5a85072ad3f6d09b5fa70b18507 100644 (file)
  */
 #include "isa207-common.h"
 
+PMU_FORMAT_ATTR(event,         "config:0-49");
+PMU_FORMAT_ATTR(pmcxsel,       "config:0-7");
+PMU_FORMAT_ATTR(mark,          "config:8");
+PMU_FORMAT_ATTR(combine,       "config:11");
+PMU_FORMAT_ATTR(unit,          "config:12-15");
+PMU_FORMAT_ATTR(pmc,           "config:16-19");
+PMU_FORMAT_ATTR(cache_sel,     "config:20-23");
+PMU_FORMAT_ATTR(sample_mode,   "config:24-28");
+PMU_FORMAT_ATTR(thresh_sel,    "config:29-31");
+PMU_FORMAT_ATTR(thresh_stop,   "config:32-35");
+PMU_FORMAT_ATTR(thresh_start,  "config:36-39");
+PMU_FORMAT_ATTR(thresh_cmp,    "config:40-49");
+
+struct attribute *isa207_pmu_format_attr[] = {
+       &format_attr_event.attr,
+       &format_attr_pmcxsel.attr,
+       &format_attr_mark.attr,
+       &format_attr_combine.attr,
+       &format_attr_unit.attr,
+       &format_attr_pmc.attr,
+       &format_attr_cache_sel.attr,
+       &format_attr_sample_mode.attr,
+       &format_attr_thresh_sel.attr,
+       &format_attr_thresh_stop.attr,
+       &format_attr_thresh_start.attr,
+       &format_attr_thresh_cmp.attr,
+       NULL,
+};
+
+struct attribute_group isa207_pmu_format_group = {
+       .name = "format",
+       .attrs = isa207_pmu_format_attr,
+};
+
 static inline bool event_is_fab_match(u64 event)
 {
        /* Only check pmc, unit and pmcxsel, ignore the edge bit (0) */
index ab830d106ec57ff48d703c555c9c1f49eba2b004..d07186382f3a75b147bfe582563f98341f50ea7e 100644 (file)
@@ -30,6 +30,9 @@ enum {
 #define        POWER8_MMCRA_IFM2               0x0000000080000000UL
 #define        POWER8_MMCRA_IFM3               0x00000000C0000000UL
 
+/* PowerISA v2.07 format attribute structure*/
+extern struct attribute_group isa207_pmu_format_group;
+
 /* Table of alternatives, sorted by column 0 */
 static const unsigned int event_alternatives[][MAX_ALT] = {
        { PM_MRK_ST_CMPL,               PM_MRK_ST_CMPL_ALT },
@@ -175,42 +178,8 @@ static struct attribute_group power8_pmu_events_group = {
        .attrs = power8_events_attr,
 };
 
-PMU_FORMAT_ATTR(event,         "config:0-49");
-PMU_FORMAT_ATTR(pmcxsel,       "config:0-7");
-PMU_FORMAT_ATTR(mark,          "config:8");
-PMU_FORMAT_ATTR(combine,       "config:11");
-PMU_FORMAT_ATTR(unit,          "config:12-15");
-PMU_FORMAT_ATTR(pmc,           "config:16-19");
-PMU_FORMAT_ATTR(cache_sel,     "config:20-23");
-PMU_FORMAT_ATTR(sample_mode,   "config:24-28");
-PMU_FORMAT_ATTR(thresh_sel,    "config:29-31");
-PMU_FORMAT_ATTR(thresh_stop,   "config:32-35");
-PMU_FORMAT_ATTR(thresh_start,  "config:36-39");
-PMU_FORMAT_ATTR(thresh_cmp,    "config:40-49");
-
-static struct attribute *power8_pmu_format_attr[] = {
-       &format_attr_event.attr,
-       &format_attr_pmcxsel.attr,
-       &format_attr_mark.attr,
-       &format_attr_combine.attr,
-       &format_attr_unit.attr,
-       &format_attr_pmc.attr,
-       &format_attr_cache_sel.attr,
-       &format_attr_sample_mode.attr,
-       &format_attr_thresh_sel.attr,
-       &format_attr_thresh_stop.attr,
-       &format_attr_thresh_start.attr,
-       &format_attr_thresh_cmp.attr,
-       NULL,
-};
-
-static struct attribute_group power8_pmu_format_group = {
-       .name = "format",
-       .attrs = power8_pmu_format_attr,
-};
-
 static const struct attribute_group *power8_pmu_attr_groups[] = {
-       &power8_pmu_format_group,
+       &isa207_pmu_format_group,
        &power8_pmu_events_group,
        NULL,
 };
index 8e9a81967ff8516b8c04d47e65df92c7daeeba1c..443511b18bc5f2de59411e7d0c8e4b8f6a56cc7e 100644 (file)
@@ -31,6 +31,9 @@ enum {
 #define POWER9_MMCRA_IFM2              0x0000000080000000UL
 #define POWER9_MMCRA_IFM3              0x00000000C0000000UL
 
+/* PowerISA v2.07 format attribute structure*/
+extern struct attribute_group isa207_pmu_format_group;
+
 GENERIC_EVENT_ATTR(cpu-cycles,                 PM_CYC);
 GENERIC_EVENT_ATTR(stalled-cycles-frontend,    PM_ICT_NOSLOT_CYC);
 GENERIC_EVENT_ATTR(stalled-cycles-backend,     PM_CMPLU_STALL);
@@ -90,42 +93,8 @@ static struct attribute_group power9_pmu_events_group = {
        .attrs = power9_events_attr,
 };
 
-PMU_FORMAT_ATTR(event,         "config:0-49");
-PMU_FORMAT_ATTR(pmcxsel,       "config:0-7");
-PMU_FORMAT_ATTR(mark,          "config:8");
-PMU_FORMAT_ATTR(combine,       "config:11");
-PMU_FORMAT_ATTR(unit,          "config:12-15");
-PMU_FORMAT_ATTR(pmc,           "config:16-19");
-PMU_FORMAT_ATTR(cache_sel,     "config:20-23");
-PMU_FORMAT_ATTR(sample_mode,   "config:24-28");
-PMU_FORMAT_ATTR(thresh_sel,    "config:29-31");
-PMU_FORMAT_ATTR(thresh_stop,   "config:32-35");
-PMU_FORMAT_ATTR(thresh_start,  "config:36-39");
-PMU_FORMAT_ATTR(thresh_cmp,    "config:40-49");
-
-static struct attribute *power9_pmu_format_attr[] = {
-       &format_attr_event.attr,
-       &format_attr_pmcxsel.attr,
-       &format_attr_mark.attr,
-       &format_attr_combine.attr,
-       &format_attr_unit.attr,
-       &format_attr_pmc.attr,
-       &format_attr_cache_sel.attr,
-       &format_attr_sample_mode.attr,
-       &format_attr_thresh_sel.attr,
-       &format_attr_thresh_stop.attr,
-       &format_attr_thresh_start.attr,
-       &format_attr_thresh_cmp.attr,
-       NULL,
-};
-
-static struct attribute_group power9_pmu_format_group = {
-       .name = "format",
-       .attrs = power9_pmu_format_attr,
-};
-
 static const struct attribute_group *power9_pmu_attr_groups[] = {
-       &power9_pmu_format_group,
+       &isa207_pmu_format_group,
        &power9_pmu_events_group,
        NULL,
 };