5ba0e2
From ed3f51c4690685675cf2766edb90acbc0c1cdb67 Mon Sep 17 00:00:00 2001
5ba0e2
From: Will Schmidt <will_schmidt@vnet.ibm.com>
5ba0e2
Date: Sun, 3 Dec 2017 09:42:44 -0800
5ba0e2
Subject: [PATCH] Add alternate event numbers for power9.
5ba0e2
5ba0e2
I had previously missed adding the _ALT entries, which allow some
5ba0e2
events to be specified on different counters. This patch fills
5ba0e2
those in.
5ba0e2
5ba0e2
This patch also adds a few validation tests for the ALT events.
5ba0e2
5ba0e2
Signed-off-by: Will Schmidt  <will_schmidt@vnet.ibm.com>
5ba0e2
---
5ba0e2
 lib/events/power9_events.h | 93 +++++++++++++++++++++++++++++++++++++++++++++-
5ba0e2
 tests/validate_power.c     | 21 +++++++++++
5ba0e2
 2 files changed, 113 insertions(+), 1 deletion(-)
5ba0e2
5ba0e2
diff --git a/lib/events/power9_events.h b/lib/events/power9_events.h
5ba0e2
index 72c481b..d77bab3 100644
5ba0e2
--- a/lib/events/power9_events.h
5ba0e2
+++ b/lib/events/power9_events.h
5ba0e2
@@ -9,6 +9,7 @@
5ba0e2
 * Mods:
5ba0e2
 * Initial content generated by Will Schmidt.  (Jan 31, 2017).
5ba0e2
 * Refresh/update generated Jun 06, 2017 by Will Schmidt.
5ba0e2
+* missing _ALT events added, Nov 16, 2017 by Will Schmidt.
5ba0e2
 *
5ba0e2
 * Contributed by
5ba0e2
 * (C) Copyright IBM Corporation, 2017.  All Rights Reserved.
5ba0e2
@@ -969,6 +970,18 @@
5ba0e2
 #define POWER9_PME_PM_XLATE_HPT_MODE 943
5ba0e2
 #define POWER9_PME_PM_XLATE_MISS 944
5ba0e2
 #define POWER9_PME_PM_XLATE_RADIX_MODE 945
5ba0e2
+#define POWER9_PME_PM_BR_2PATH_ALT 946
5ba0e2
+#define POWER9_PME_PM_CYC_ALT 947
5ba0e2
+#define POWER9_PME_PM_CYC_ALT2 948
5ba0e2
+#define POWER9_PME_PM_CYC_ALT3 949
5ba0e2
+#define POWER9_PME_PM_INST_CMPL_ALT 950
5ba0e2
+#define POWER9_PME_PM_INST_CMPL_ALT2 951
5ba0e2
+#define POWER9_PME_PM_INST_CMPL_ALT3 952
5ba0e2
+#define POWER9_PME_PM_INST_DISP_ALT 953
5ba0e2
+#define POWER9_PME_PM_LD_MISS_L1_ALT 954
5ba0e2
+#define POWER9_PME_PM_SUSPENDED_ALT 955
5ba0e2
+#define POWER9_PME_PM_SUSPENDED_ALT2 956
5ba0e2
+#define POWER9_PME_PM_SUSPENDED_ALT3 957
5ba0e2
 
5ba0e2
 static const pme_power_entry_t power9_pe[] = {
5ba0e2
 [ POWER9_PME_PM_1FLOP_CMPL ] = {
5ba0e2
@@ -1031,6 +1044,7 @@ static const pme_power_entry_t power9_pe[] = {
5ba0e2
 	.pme_short_desc = "Cycles in which all 4 Binary Floating Point units are busy.",
5ba0e2
 	.pme_long_desc = "Cycles in which all 4 Binary Floating Point units are busy. The BFU is running at capacity",
5ba0e2
 },
5ba0e2
+/* See also alternate entries for 0000020036 / POWER9_PME_PM_BR_2PATH with code(s) 0000040036 at the bottom of this table. \n */
5ba0e2
 [ POWER9_PME_PM_BR_2PATH ] = {
5ba0e2
 	.pme_name = "PM_BR_2PATH",
5ba0e2
 	.pme_code = 0x0000020036,
5ba0e2
@@ -1559,6 +1573,7 @@ static const pme_power_entry_t power9_pe[] = {
5ba0e2
 	.pme_short_desc = "Continuous 16 cycle (2to1) window where this signals rotates thru sampling each CO machine busy.",
5ba0e2
 	.pme_long_desc = "Continuous 16 cycle (2to1) window where this signals rotates thru sampling each CO machine busy. PMU uses this wave to then do 16 cyc count to sample total number of machs running",
5ba0e2
 },
5ba0e2
+/* See also alternate entries for 000001001E / POWER9_PME_PM_CYC with code(s) 000002001E 000003001E 000004001E at the bottom of this table. \n */
5ba0e2
 [ POWER9_PME_PM_CYC ] = {
5ba0e2
 	.pme_name = "PM_CYC",
5ba0e2
 	.pme_code = 0x000001001E,
5ba0e2
@@ -2669,12 +2684,14 @@ static const pme_power_entry_t power9_pe[] = {
5ba0e2
 	.pme_short_desc = "Initial and Final Pump Scope was chip pump (prediction=correct) for an instruction fetch",
5ba0e2
 	.pme_long_desc = "Initial and Final Pump Scope was chip pump (prediction=correct) for an instruction fetch",
5ba0e2
 },
5ba0e2
+/* See also alternate entries for 0000010002 / POWER9_PME_PM_INST_CMPL with code(s) 0000020002 0000030002 0000040002 at the bottom of this table. \n */
5ba0e2
 [ POWER9_PME_PM_INST_CMPL ] = {
5ba0e2
 	.pme_name = "PM_INST_CMPL",
5ba0e2
 	.pme_code = 0x0000010002,
5ba0e2
 	.pme_short_desc = "Number of PowerPC Instructions that completed.",
5ba0e2
 	.pme_long_desc = "Number of PowerPC Instructions that completed.",
5ba0e2
 },
5ba0e2
+/* See also alternate entries for 00000200F2 / POWER9_PME_PM_INST_DISP with code(s) 00000300F2 at the bottom of this table. \n */
5ba0e2
 [ POWER9_PME_PM_INST_DISP ] = {
5ba0e2
 	.pme_name = "PM_INST_DISP",
5ba0e2
 	.pme_code = 0x00000200F2,
5ba0e2
@@ -4007,6 +4024,7 @@ static const pme_power_entry_t power9_pe[] = {
5ba0e2
 	.pme_short_desc = "Number of load instructions that finished with an L1 miss.",
5ba0e2
 	.pme_long_desc = "Number of load instructions that finished with an L1 miss. Note that even if a load spans multiple slices this event will increment only once per load op.",
5ba0e2
 },
5ba0e2
+/* See also alternate entries for 000003E054 / POWER9_PME_PM_LD_MISS_L1 with code(s) 00000400F0 at the bottom of this table. \n */
5ba0e2
 [ POWER9_PME_PM_LD_MISS_L1 ] = {
5ba0e2
 	.pme_name = "PM_LD_MISS_L1",
5ba0e2
 	.pme_code = 0x000003E054,
5ba0e2
@@ -6149,6 +6167,7 @@ static const pme_power_entry_t power9_pe[] = {
5ba0e2
 	.pme_short_desc = "Fetching is stopped due to an incoming instruction that will result in a flush",
5ba0e2
 	.pme_long_desc = "Fetching is stopped due to an incoming instruction that will result in a flush",
5ba0e2
 },
5ba0e2
+/* See also alternate entries for 0000010000 / POWER9_PME_PM_SUSPENDED with code(s) 0000020000 0000030000 0000040000 at the bottom of this table. \n */
5ba0e2
 [ POWER9_PME_PM_SUSPENDED ] = {
5ba0e2
 	.pme_name = "PM_SUSPENDED",
5ba0e2
 	.pme_code = 0x0000010000,
5ba0e2
@@ -6647,6 +6666,78 @@ static const pme_power_entry_t power9_pe[] = {
5ba0e2
 	.pme_short_desc = "LSU reports every cycle the thread is in radix translation mode (as opposed to HPT mode)",
5ba0e2
 	.pme_long_desc = "LSU reports every cycle the thread is in radix translation mode (as opposed to HPT mode)",
5ba0e2
 },
5ba0e2
-/* total 945 */
5ba0e2
+[ POWER9_PME_PM_BR_2PATH_ALT ] = {
5ba0e2
+	.pme_name = "PM_BR_2PATH_ALT",
5ba0e2
+	.pme_code = 0x0000040036,
5ba0e2
+	.pme_short_desc = "Branches that are not strongly biased",
5ba0e2
+	.pme_long_desc = "Branches that are not strongly biased",
5ba0e2
+},
5ba0e2
+[ POWER9_PME_PM_CYC_ALT ] = {
5ba0e2
+	.pme_name = "PM_CYC_ALT",
5ba0e2
+	.pme_code = 0x000002001E,
5ba0e2
+	.pme_short_desc = "Processor cycles",
5ba0e2
+	.pme_long_desc = "Processor cycles",
5ba0e2
+},
5ba0e2
+[ POWER9_PME_PM_CYC_ALT2 ] = {
5ba0e2
+	.pme_name = "PM_CYC_ALT2",
5ba0e2
+	.pme_code = 0x000003001E,
5ba0e2
+	.pme_short_desc = "Processor cycles",
5ba0e2
+	.pme_long_desc = "Processor cycles",
5ba0e2
+},
5ba0e2
+[ POWER9_PME_PM_CYC_ALT3 ] = {
5ba0e2
+	.pme_name = "PM_CYC_ALT3",
5ba0e2
+	.pme_code = 0x000004001E,
5ba0e2
+	.pme_short_desc = "Processor cycles",
5ba0e2
+	.pme_long_desc = "Processor cycles",
5ba0e2
+},
5ba0e2
+[ POWER9_PME_PM_INST_CMPL_ALT ] = {
5ba0e2
+	.pme_name = "PM_INST_CMPL_ALT",
5ba0e2
+	.pme_code = 0x0000020002,
5ba0e2
+	.pme_short_desc = "Number of PowerPC Instructions that completed.",
5ba0e2
+	.pme_long_desc = "Number of PowerPC Instructions that completed.",
5ba0e2
+},
5ba0e2
+[ POWER9_PME_PM_INST_CMPL_ALT2 ] = {
5ba0e2
+	.pme_name = "PM_INST_CMPL_ALT2",
5ba0e2
+	.pme_code = 0x0000030002,
5ba0e2
+	.pme_short_desc = "Number of PowerPC Instructions that completed.",
5ba0e2
+	.pme_long_desc = "Number of PowerPC Instructions that completed.",
5ba0e2
+},
5ba0e2
+[ POWER9_PME_PM_INST_CMPL_ALT3 ] = {
5ba0e2
+	.pme_name = "PM_INST_CMPL_ALT3",
5ba0e2
+	.pme_code = 0x0000040002,
5ba0e2
+	.pme_short_desc = "Number of PowerPC Instructions that completed.",
5ba0e2
+	.pme_long_desc = "Number of PowerPC Instructions that completed.",
5ba0e2
+},
5ba0e2
+[ POWER9_PME_PM_INST_DISP_ALT ] = {
5ba0e2
+	.pme_name = "PM_INST_DISP_ALT",
5ba0e2
+	.pme_code = 0x00000300F2,
5ba0e2
+	.pme_short_desc = "# PPC Dispatched",
5ba0e2
+	.pme_long_desc = "# PPC Dispatched",
5ba0e2
+},
5ba0e2
+[ POWER9_PME_PM_LD_MISS_L1_ALT ] = {
5ba0e2
+	.pme_name = "PM_LD_MISS_L1_ALT",
5ba0e2
+	.pme_code = 0x00000400F0,
5ba0e2
+	.pme_short_desc = "Load Missed L1, counted at execution time (can be greater than loads finished).",
5ba0e2
+	.pme_long_desc = "Load Missed L1, counted at execution time (can be greater than loads finished). LMQ merges are not included in this count. i.e. if a load instruction misses on an address that is already allocated on the LMQ, this event will not increment for that load). Note that this count is per slice, so if a load spans multiple slices this event will increment multiple times for a single load.",
5ba0e2
+},
5ba0e2
+[ POWER9_PME_PM_SUSPENDED_ALT ] = {
5ba0e2
+	.pme_name = "PM_SUSPENDED_ALT",
5ba0e2
+	.pme_code = 0x0000020000,
5ba0e2
+	.pme_short_desc = "Counter OFF",
5ba0e2
+	.pme_long_desc = "Counter OFF",
5ba0e2
+},
5ba0e2
+[ POWER9_PME_PM_SUSPENDED_ALT2 ] = {
5ba0e2
+	.pme_name = "PM_SUSPENDED_ALT2",
5ba0e2
+	.pme_code = 0x0000030000,
5ba0e2
+	.pme_short_desc = "Counter OFF",
5ba0e2
+	.pme_long_desc = "Counter OFF",
5ba0e2
+},
5ba0e2
+[ POWER9_PME_PM_SUSPENDED_ALT3 ] = {
5ba0e2
+	.pme_name = "PM_SUSPENDED_ALT3",
5ba0e2
+	.pme_code = 0x0000040000,
5ba0e2
+	.pme_short_desc = "Counter OFF",
5ba0e2
+	.pme_long_desc = "Counter OFF",
5ba0e2
+},
5ba0e2
+/* total 957 */
5ba0e2
 };
5ba0e2
 #endif
5ba0e2
diff --git a/tests/validate_power.c b/tests/validate_power.c
5ba0e2
index 617efca..2e38f32 100644
5ba0e2
--- a/tests/validate_power.c
5ba0e2
+++ b/tests/validate_power.c
5ba0e2
@@ -171,6 +171,27 @@ static const test_event_t ppc_test_events[]={
5ba0e2
 	  .codes[0] = 0x200f2,
5ba0e2
 	  .fstr = "power9::PM_INST_DISP",
5ba0e2
 	},
5ba0e2
+	{ SRC_LINE,
5ba0e2
+	  .name = "power9::PM_CYC_ALT",
5ba0e2
+	  .ret  = PFM_SUCCESS,
5ba0e2
+	  .count = 1,
5ba0e2
+	  .codes[0] = 0x2001e,
5ba0e2
+	  .fstr = "power9::PM_CYC_ALT",
5ba0e2
+	},
5ba0e2
+	{ SRC_LINE,
5ba0e2
+	  .name = "power9::PM_CYC_ALT2",
5ba0e2
+	  .ret  = PFM_SUCCESS,
5ba0e2
+	  .count = 1,
5ba0e2
+	  .codes[0] = 0x3001e,
5ba0e2
+	  .fstr = "power9::PM_CYC_ALT2",
5ba0e2
+	},
5ba0e2
+	{ SRC_LINE,
5ba0e2
+	  .name = "power9::PM_INST_CMPL_ALT",
5ba0e2
+	  .ret  = PFM_SUCCESS,
5ba0e2
+	  .count = 1,
5ba0e2
+	  .codes[0] = 0x20002,
5ba0e2
+	  .fstr = "power9::PM_INST_CMPL_ALT",
5ba0e2
+	},
5ba0e2
     { SRC_LINE,
5ba0e2
       .name = "powerpc_nest_mcs_read::MCS_00",
5ba0e2
       .ret = PFM_SUCCESS,
5ba0e2
-- 
5ba0e2
2.13.6
5ba0e2