Blame SOURCES/libpfm-s390.patch

8ac2aa
commit 773759843a1c66b9b829da21d45f7bb76aa802bc
8ac2aa
Author: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
8ac2aa
Date:   Wed Feb 19 11:17:59 2014 +0100
8ac2aa
8ac2aa
    s390/cpumf: update event defintions
8ac2aa
    
8ac2aa
    Update the cpumf counter (event) definitions.  The changes are required to
8ac2aa
    easily update the defintions in future.
8ac2aa
    
8ac2aa
    Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
8ac2aa
8ac2aa
diff --git a/lib/events/s390x_cpumf_events.h b/lib/events/s390x_cpumf_events.h
8ac2aa
index 9628cee..b1ad8fc 100644
8ac2aa
--- a/lib/events/s390x_cpumf_events.h
8ac2aa
+++ b/lib/events/s390x_cpumf_events.h
8ac2aa
@@ -6,14 +6,14 @@
8ac2aa
 #define STRINGIFY(x)		__stringify(x)
8ac2aa
 
8ac2aa
 /* CPUMF counter sets */
8ac2aa
-#define CPUMF_CTRSET_BASIC	      0
8ac2aa
-#define CPUMF_CTRSET_PROBLEM_STATE    1
8ac2aa
-#define CPUMF_CTRSET_CRYPTO	      2
8ac2aa
-#define CPUMF_CTRSET_EXTENDED	      3
8ac2aa
+#define CPUMF_CTRSET_NONE               0
8ac2aa
+#define CPUMF_CTRSET_BASIC              2
8ac2aa
+#define CPUMF_CTRSET_PROBLEM_STATE      4
8ac2aa
+#define CPUMF_CTRSET_CRYPTO             8
8ac2aa
+#define CPUMF_CTRSET_EXTENDED           1
8ac2aa
 
8ac2aa
 
8ac2aa
-static const pme_cpumf_ctr_t cpumf_generic_ctr[] = {
8ac2aa
-	/* Basic counter set */
8ac2aa
+static const pme_cpumf_ctr_t cpumcf_generic_counters[] = {
8ac2aa
 	{
8ac2aa
 		.ctrnum = 0,
8ac2aa
 		.ctrset = CPUMF_CTRSET_BASIC,
8ac2aa
@@ -29,7 +29,7 @@ static const pme_cpumf_ctr_t cpumf_generic_ctr[] = {
8ac2aa
 	{
8ac2aa
 		.ctrnum = 2,
8ac2aa
 		.ctrset = CPUMF_CTRSET_BASIC,
8ac2aa
-		.name = "L1I_DRCT_WRITES",
8ac2aa
+		.name = "L1I_DIR_WRITES",
8ac2aa
 		.desc = "Level-1 I-Cache Directory Write Count",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
@@ -41,7 +41,7 @@ static const pme_cpumf_ctr_t cpumf_generic_ctr[] = {
8ac2aa
 	{
8ac2aa
 		.ctrnum = 4,
8ac2aa
 		.ctrset = CPUMF_CTRSET_BASIC,
8ac2aa
-		.name = "L1D_DRCT_WRITES",
8ac2aa
+		.name = "L1D_DIR_WRITES",
8ac2aa
 		.desc = "Level-1 D-Cache Directory Write Count",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
@@ -50,7 +50,6 @@ static const pme_cpumf_ctr_t cpumf_generic_ctr[] = {
8ac2aa
 		.name = "L1D_PENALTY_CYCLES",
8ac2aa
 		.desc = "Level-1 D-Cache Penalty Cycle Count",
8ac2aa
 	},
8ac2aa
-	/* Problem-state counter set */
8ac2aa
 	{
8ac2aa
 		.ctrnum = 32,
8ac2aa
 		.ctrset = CPUMF_CTRSET_PROBLEM_STATE,
8ac2aa
@@ -66,7 +65,7 @@ static const pme_cpumf_ctr_t cpumf_generic_ctr[] = {
8ac2aa
 	{
8ac2aa
 		.ctrnum = 34,
8ac2aa
 		.ctrset = CPUMF_CTRSET_PROBLEM_STATE,
8ac2aa
-		.name = "PROBLEM_STATE_L1I_DRCT_WRITES",
8ac2aa
+		.name = "PROBLEM_STATE_L1I_DIR_WRITES",
8ac2aa
 		.desc = "Problem-State Level-1 I-Cache Directory Write Count",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
@@ -78,7 +77,7 @@ static const pme_cpumf_ctr_t cpumf_generic_ctr[] = {
8ac2aa
 	{
8ac2aa
 		.ctrnum = 36,
8ac2aa
 		.ctrset = CPUMF_CTRSET_PROBLEM_STATE,
8ac2aa
-		.name = "PROBLEM_STATE_L1D_DRCT_WRITES",
8ac2aa
+		.name = "PROBLEM_STATE_L1D_DIR_WRITES",
8ac2aa
 		.desc = "Problem-State Level-1 D-Cache Directory Write Count",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
@@ -87,38 +86,38 @@ static const pme_cpumf_ctr_t cpumf_generic_ctr[] = {
8ac2aa
 		.name = "PROBLEM_STATE_L1D_PENALTY_CYCLES",
8ac2aa
 		.desc = "Problem-State Level-1 D-Cache Penalty Cycle Count",
8ac2aa
 	},
8ac2aa
-	/* Crypto-activity counter set */
8ac2aa
 	{
8ac2aa
 		.ctrnum = 64,
8ac2aa
 		.ctrset = CPUMF_CTRSET_CRYPTO,
8ac2aa
 		.name = "PRNG_FUNCTIONS",
8ac2aa
-		.desc = "Total number of the PRNG functions issued by the CPU",
8ac2aa
+		.desc = "Total number of the PRNG functions issued by the"
8ac2aa
+			" CPU",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
 		.ctrnum = 65,
8ac2aa
 		.ctrset = CPUMF_CTRSET_CRYPTO,
8ac2aa
 		.name = "PRNG_CYCLES",
8ac2aa
-		.desc = "Total number of CPU cycles when the DEA/AES "
8ac2aa
-			"coprocessor is busy performing PRNG functions "
8ac2aa
-			"issued by the CPU",
8ac2aa
+		.desc = "Total number of CPU cycles when the DEA/AES"
8ac2aa
+			" coprocessor is busy performing PRNG functions"
8ac2aa
+			" issued by the CPU",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
 		.ctrnum = 66,
8ac2aa
 		.ctrset = CPUMF_CTRSET_CRYPTO,
8ac2aa
 		.name = "PRNG_BLOCKED_FUNCTIONS",
8ac2aa
-		.desc = "Total number of the PRNG functions that are issued "
8ac2aa
-			"by the CPU and are blocked because the DEA/AES "
8ac2aa
-			"coprocessor is busy performing a function issued "
8ac2aa
-			"by another CPU",
8ac2aa
+		.desc = "Total number of the PRNG functions that are issued"
8ac2aa
+			" by the CPU and are blocked because the DEA/AES"
8ac2aa
+			" coprocessor is busy performing a function issued by"
8ac2aa
+			" another CPU",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
 		.ctrnum = 67,
8ac2aa
 		.ctrset = CPUMF_CTRSET_CRYPTO,
8ac2aa
 		.name = "PRNG_BLOCKED_CYCLES",
8ac2aa
-		.desc = "Total number of CPU cycles blocked for the PRNG "
8ac2aa
-			"functions issued by the CPU because the DEA/AES "
8ac2aa
-			"coprocessor is busy performing a function issued "
8ac2aa
-			"by another CPU",
8ac2aa
+		.desc = "Total number of CPU cycles blocked for the PRNG"
8ac2aa
+			" functions issued by the CPU because the DEA/AES"
8ac2aa
+			" coprocessor is busy performing a function issued by"
8ac2aa
+			" another CPU",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
 		.ctrnum = 68,
8ac2aa
@@ -130,26 +129,27 @@ static const pme_cpumf_ctr_t cpumf_generic_ctr[] = {
8ac2aa
 		.ctrnum = 69,
8ac2aa
 		.ctrset = CPUMF_CTRSET_CRYPTO,
8ac2aa
 		.name = "SHA_CYCLES",
8ac2aa
-		.desc = "Total number of CPU cycles when the SHA coprocessor "
8ac2aa
-			"is busy performing the SHA functions issued by the "
8ac2aa
-			"CPU",
8ac2aa
+		.desc = "Total number of CPU cycles when the SHA coprocessor"
8ac2aa
+			" is busy performing the SHA functions issued by the"
8ac2aa
+			" CPU",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
 		.ctrnum = 70,
8ac2aa
 		.ctrset = CPUMF_CTRSET_CRYPTO,
8ac2aa
 		.name = "SHA_BLOCKED_FUNCTIONS",
8ac2aa
-		.desc = "Total number of the SHA functions that are issued by "
8ac2aa
-			"the CPU and are blocked because the SHA coprocessor "
8ac2aa
-			"is busy performing a function issued by another CPU",
8ac2aa
+		.desc = "Total number of the SHA functions that are issued"
8ac2aa
+			" by the CPU and are blocked because the SHA"
8ac2aa
+			" coprocessor is busy performing a function issued by"
8ac2aa
+			" another CPU",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
 		.ctrnum = 71,
8ac2aa
 		.ctrset = CPUMF_CTRSET_CRYPTO,
8ac2aa
 		.name = "SHA_BLOCKED_CYCLES",
8ac2aa
-		.desc = "Total number of CPU cycles blocked for the SHA "
8ac2aa
-			"functions issued by the CPU because the SHA "
8ac2aa
-			"coprocessor is busy performing a function issued by "
8ac2aa
-			"another CPU",
8ac2aa
+		.desc = "Total number of CPU cycles blocked for the SHA"
8ac2aa
+			" functions issued by the CPU because the SHA"
8ac2aa
+			" coprocessor is busy performing a function issued by"
8ac2aa
+			" another CPU",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
 		.ctrnum = 72,
8ac2aa
@@ -161,24 +161,27 @@ static const pme_cpumf_ctr_t cpumf_generic_ctr[] = {
8ac2aa
 		.ctrnum = 73,
8ac2aa
 		.ctrset = CPUMF_CTRSET_CRYPTO,
8ac2aa
 		.name = "DEA_CYCLES",
8ac2aa
-		.desc = "Total number of CPU cycles when the DEA/AES coprocessor"
8ac2aa
-			" is busy performing the DEA functions issued by the CPU",
8ac2aa
+		.desc = "Total number of CPU cycles when the DEA/AES"
8ac2aa
+			" coprocessor is busy performing the DEA functions"
8ac2aa
+			" issued by the CPU",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
 		.ctrnum = 74,
8ac2aa
 		.ctrset = CPUMF_CTRSET_CRYPTO,
8ac2aa
 		.name = "DEA_BLOCKED_FUNCTIONS",
8ac2aa
-		.desc = "Total number of the DEA functions that are issued by "
8ac2aa
-			"the CPU and are blocked because the DEA/AES coprocessor"
8ac2aa
-			" is busy performing a function issued by another CPU",
8ac2aa
+		.desc = "Total number of the DEA functions that are issued"
8ac2aa
+			" by the CPU and are blocked because the DEA/AES"
8ac2aa
+			" coprocessor is busy performing a function issued by"
8ac2aa
+			" another CPU",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
 		.ctrnum = 75,
8ac2aa
 		.ctrset = CPUMF_CTRSET_CRYPTO,
8ac2aa
 		.name = "DEA_BLOCKED_CYCLES",
8ac2aa
-		.desc = "Total number of CPU cycles blocked for the DEA functions"
8ac2aa
-			" issued by the CPU because the DEA/AES coprocessor is "
8ac2aa
-			"busy performing a function issued by another CPU",
8ac2aa
+		.desc = "Total number of CPU cycles blocked for the DEA"
8ac2aa
+			" functions issued by the CPU because the DEA/AES"
8ac2aa
+			" coprocessor is busy performing a function issued by"
8ac2aa
+			" another CPU",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
 		.ctrnum = 76,
8ac2aa
@@ -190,29 +193,31 @@ static const pme_cpumf_ctr_t cpumf_generic_ctr[] = {
8ac2aa
 		.ctrnum = 77,
8ac2aa
 		.ctrset = CPUMF_CTRSET_CRYPTO,
8ac2aa
 		.name = "AES_CYCLES",
8ac2aa
-		.desc = "Total number of CPU cycles when the DEA/AES coprocessor"
8ac2aa
-			" is busy performing the AES functions issued by the CPU",
8ac2aa
+		.desc = "Total number of CPU cycles when the DEA/AES"
8ac2aa
+			" coprocessor is busy performing the AES functions"
8ac2aa
+			" issued by the CPU",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
 		.ctrnum = 78,
8ac2aa
 		.ctrset = CPUMF_CTRSET_CRYPTO,
8ac2aa
 		.name = "AES_BLOCKED_FUNCTIONS",
8ac2aa
-		.desc = "Total number of AES functions that are issued by the CPU"
8ac2aa
-			" and are blocked because the DEA/AES coprocessor is"
8ac2aa
-			" busy performing a function issued by another CPU",
8ac2aa
+		.desc = "Total number of AES functions that are issued by"
8ac2aa
+			" the CPU and are blocked because the DEA/AES"
8ac2aa
+			" coprocessor is busy performing a function issued by"
8ac2aa
+			" another CPU",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
 		.ctrnum = 79,
8ac2aa
 		.ctrset = CPUMF_CTRSET_CRYPTO,
8ac2aa
 		.name = "AES_BLOCKED_CYCLES",
8ac2aa
-		.desc = "Total number of CPU cycles blocked for the AES functions"
8ac2aa
-			" issued by the CPU because the DEA/AES coprocessor is"
8ac2aa
-			" busy performing a function issued by another CPU",
8ac2aa
+		.desc = "Total number of CPU cycles blocked for the AES"
8ac2aa
+			" functions issued by the CPU because the DEA/AES"
8ac2aa
+			" coprocessor is busy performing a function issued by"
8ac2aa
+			" another CPU",
8ac2aa
 	},
8ac2aa
 };
8ac2aa
 
8ac2aa
-/* Extended counter set for IBM System z10 */
8ac2aa
-static const pme_cpumf_ctr_t cpumf_ctr_set_ext_z10[] = {
8ac2aa
+static const pme_cpumf_ctr_t cpumcf_z10_counters[] = {
8ac2aa
 	{
8ac2aa
 		.ctrnum = 128,
8ac2aa
 		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
@@ -243,9 +248,9 @@ static const pme_cpumf_ctr_t cpumf_ctr_set_ext_z10[] = {
8ac2aa
 		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
 		.name = "L1D_L3_LOCAL_WRITES",
8ac2aa
 		.desc = "A directory write to the Level-1 D-Cache directory"
8ac2aa
-			" where the installtion cache line was source from the"
8ac2aa
-			" Level-3 cache that is on the same book as the Data"
8ac2aa
-			" cache (Local L2 cache)",
8ac2aa
+			" where the installtion cache line was source from"
8ac2aa
+			" the Level-3 cache that is on the same book as the"
8ac2aa
+			" Data cache (Local L2 cache)",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
 		.ctrnum = 132,
8ac2aa
@@ -297,15 +302,15 @@ static const pme_cpumf_ctr_t cpumf_ctr_set_ext_z10[] = {
8ac2aa
 		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
 		.name = "L1I_CACHELINE_INVALIDATES",
8ac2aa
 		.desc = "A cache line in the Level-1 I-Cache has been"
8ac2aa
-			" invalidated by a store on the same CPU as the Level-1"
8ac2aa
-			" I-Cache",
8ac2aa
+			" invalidated by a store on the same CPU as the"
8ac2aa
+			" Level-1 I-Cache",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
 		.ctrnum = 138,
8ac2aa
 		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
 		.name = "ITLB1_WRITES",
8ac2aa
-		.desc = "A translation entry has been written into the Level-1"
8ac2aa
-			" Instruction Translation Lookaside Buffer",
8ac2aa
+		.desc = "A translation entry has been written into the"
8ac2aa
+			" Level-1 Instruction Translation Lookaside Buffer",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
 		.ctrnum = 139,
8ac2aa
@@ -340,27 +345,27 @@ static const pme_cpumf_ctr_t cpumf_ctr_set_ext_z10[] = {
8ac2aa
 		.ctrnum = 145,
8ac2aa
 		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
 		.name = "ITLB1_MISSES",
8ac2aa
-		.desc = "Level-1 Instruction TLB miss in progress. Incremented"
8ac2aa
-			" by one for every cycle an ITLB1 miss is in progress",
8ac2aa
+		.desc = "Level-1 Instruction TLB miss in progress."
8ac2aa
+			" Incremented by one for every cycle an ITLB1 miss is"
8ac2aa
+			" in progress",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
 		.ctrnum = 146,
8ac2aa
 		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
 		.name = "DTLB1_MISSES",
8ac2aa
-		.desc = "Level-1 Data TLB miss in progress. Incremented by one"
8ac2aa
-			" for every cycle an DTLB1 miss is in progress",
8ac2aa
+		.desc = "Level-1 Data TLB miss in progress. Incremented by"
8ac2aa
+			" one for every cycle an DTLB1 miss is in progress",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
 		.ctrnum = 147,
8ac2aa
 		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
 		.name = "L2C_STORES_SENT",
8ac2aa
-		.desc = "Incremented by one for every store sent to"
8ac2aa
-			" Level-2 (L1.5) cache",
8ac2aa
+		.desc = "Incremented by one for every store sent to Level-2"
8ac2aa
+			" (L1.5) cache",
8ac2aa
 	},
8ac2aa
 };
8ac2aa
 
8ac2aa
-/* Extended counter set for IBM zEnterprise 196 */
8ac2aa
-static const pme_cpumf_ctr_t cpumf_ctr_set_ext_z196[] = {
8ac2aa
+static const pme_cpumf_ctr_t cpumcf_z196_counters[] = {
8ac2aa
 	{
8ac2aa
 		.ctrnum = 128,
8ac2aa
 		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
@@ -374,29 +379,30 @@ static const pme_cpumf_ctr_t cpumf_ctr_set_ext_z196[] = {
8ac2aa
 		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
 		.name = "L1I_L2_SOURCED_WRITES",
8ac2aa
 		.desc = "A directory write to the Level-1 I-Cache directory"
8ac2aa
-			" where the returned cache line was sourced from"
8ac2aa
-			" the Level-2 cache",
8ac2aa
+			" where the returned cache line was sourced from the"
8ac2aa
+			" Level-2 cache",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
 		.ctrnum = 130,
8ac2aa
 		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
 		.name = "DTLB1_MISSES",
8ac2aa
-		.desc = "Level-1 Data TLB miss in progress. Incremented by one"
8ac2aa
-			" for every cycle a DTLB1 miss is in progress.",
8ac2aa
+		.desc = "Level-1 Data TLB miss in progress. Incremented by"
8ac2aa
+			" one for every cycle a DTLB1 miss is in progress.",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
 		.ctrnum = 131,
8ac2aa
 		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
 		.name = "ITLB1_MISSES",
8ac2aa
-		.desc = "Level-1 Instruction TLB miss in progress. Incremented"
8ac2aa
-			" by one for every cycle a ITLB1 miss is in progress.",
8ac2aa
+		.desc = "Level-1 Instruction TLB miss in progress."
8ac2aa
+			" Incremented by one for every cycle a ITLB1 miss is"
8ac2aa
+			" in progress.",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
 		.ctrnum = 133,
8ac2aa
 		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
 		.name = "L2C_STORES_SENT",
8ac2aa
-		.desc = "Incremented by one for every store sent to"
8ac2aa
-			" Level-2 cache",
8ac2aa
+		.desc = "Incremented by one for every store sent to Level-2"
8ac2aa
+			" cache",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
 		.ctrnum = 134,
8ac2aa
@@ -452,8 +458,8 @@ static const pme_cpumf_ctr_t cpumf_ctr_set_ext_z196[] = {
8ac2aa
 		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
 		.name = "DTLB1_HPAGE_WRITES",
8ac2aa
 		.desc = "A translation entry has been written to the Level-1"
8ac2aa
-			" Data Translation Lookaside Buffer for a one-megabyte"
8ac2aa
-			" page",
8ac2aa
+			" Data Translation Lookaside Buffer for a one-"
8ac2aa
+			" megabyte page",
8ac2aa
 	},
8ac2aa
 	{
8ac2aa
 		.ctrnum = 141,
8ac2aa
@@ -520,7 +526,7 @@ static const pme_cpumf_ctr_t cpumf_ctr_set_ext_z196[] = {
8ac2aa
 	{
8ac2aa
 		.ctrnum = 150,
8ac2aa
 		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
-		.name = "L1D_ONCHIP_L3_WRITES",
8ac2aa
+		.name = "L1D_ONCHIP_L3_SOURCED_WRITES",
8ac2aa
 		.desc = "A directory write to the Level-1 D-Cache directory"
8ac2aa
 			" where the returned cache line was sourced from an"
8ac2aa
 			" On Chip Level-3 cache",
8ac2aa
@@ -528,7 +534,7 @@ static const pme_cpumf_ctr_t cpumf_ctr_set_ext_z196[] = {
8ac2aa
 	{
8ac2aa
 		.ctrnum = 152,
8ac2aa
 		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
-		.name = "L1D_OFFCHIP_L3_WRITES",
8ac2aa
+		.name = "L1D_OFFCHIP_L3_SOURCED_WRITES",
8ac2aa
 		.desc = "A directory write to the Level-1 D-Cache directory"
8ac2aa
 			" where the returned cache line was sourced from an"
8ac2aa
 			" Off Chip/On Book Level-3 cache",
8ac2aa
@@ -536,7 +542,7 @@ static const pme_cpumf_ctr_t cpumf_ctr_set_ext_z196[] = {
8ac2aa
 	{
8ac2aa
 		.ctrnum = 153,
8ac2aa
 		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
-		.name = "L1I_ONCHIP_L3_WRITES",
8ac2aa
+		.name = "L1I_ONCHIP_L3_SOURCED_WRITES",
8ac2aa
 		.desc = "A directory write to the Level-1 I-Cache directory"
8ac2aa
 			" where the returned cache line was sourced from an"
8ac2aa
 			" On Chip Level-3 cache",
8ac2aa
@@ -544,19 +550,11 @@ static const pme_cpumf_ctr_t cpumf_ctr_set_ext_z196[] = {
8ac2aa
 	{
8ac2aa
 		.ctrnum = 155,
8ac2aa
 		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
-		.name = "L1I_OFFCHIP_L3_WRITES",
8ac2aa
+		.name = "L1I_OFFCHIP_L3_SOURCED_WRITES",
8ac2aa
 		.desc = "A directory write to the Level-1 I-Cache directory"
8ac2aa
 			" where the returned cache line was sourced from an"
8ac2aa
 			" Off Chip/On Book Level-3 cache",
8ac2aa
 	},
8ac2aa
 };
8ac2aa
 
8ac2aa
-#if 0
8ac2aa
-	{
8ac2aa
-		.ctrnum = ,
8ac2aa
-		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
-		.name = "",
8ac2aa
-		.desc = "",
8ac2aa
-	},
8ac2aa
-#endif
8ac2aa
 #endif /* __S390X_CPUMF_EVENTS_H__ */
8ac2aa
diff --git a/lib/pfmlib_s390x_cpumf.c b/lib/pfmlib_s390x_cpumf.c
8ac2aa
index d424466..e216bd2 100644
8ac2aa
--- a/lib/pfmlib_s390x_cpumf.c
8ac2aa
+++ b/lib/pfmlib_s390x_cpumf.c
8ac2aa
@@ -107,13 +107,13 @@ static int pfm_cpumcf_init(void *this)
8ac2aa
 	switch (get_machine_type()) {
8ac2aa
 	case 2097:  /* IBM System z10 EC */
8ac2aa
 	case 2098:  /* IBM System z10 BC */
8ac2aa
-		ext_set = cpumf_ctr_set_ext_z10;
8ac2aa
-		ext_set_count = LIBPFM_ARRAY_SIZE(cpumf_ctr_set_ext_z10);
8ac2aa
+		ext_set = cpumcf_z10_counters,
8ac2aa
+		ext_set_count = LIBPFM_ARRAY_SIZE(cpumcf_z10_counters);
8ac2aa
 		break;
8ac2aa
 	case 2817:  /* IBM zEnterprise 196 */
8ac2aa
 	case 2818:  /* IBM zEnterprise 114 */
8ac2aa
-		ext_set = cpumf_ctr_set_ext_z196;
8ac2aa
-		ext_set_count = LIBPFM_ARRAY_SIZE(cpumf_ctr_set_ext_z196);
8ac2aa
+		ext_set = cpumcf_z196_counters;
8ac2aa
+		ext_set_count = LIBPFM_ARRAY_SIZE(cpumcf_z196_counters);
8ac2aa
 		break;
8ac2aa
 	default:
8ac2aa
 		/* No extended counter set for this machine type or there
8ac2aa
@@ -123,13 +123,14 @@ static int pfm_cpumcf_init(void *this)
8ac2aa
 		break;
8ac2aa
 	}
8ac2aa
 
8ac2aa
-	generic_count = LIBPFM_ARRAY_SIZE(cpumf_generic_ctr);
8ac2aa
+	generic_count = LIBPFM_ARRAY_SIZE(cpumcf_generic_counters);
8ac2aa
 
8ac2aa
 	cpumcf_pe = calloc(sizeof(*cpumcf_pe), generic_count + ext_set_count);
8ac2aa
 	if (cpumcf_pe == NULL)
8ac2aa
 		return PFM_ERR_NOMEM;
8ac2aa
 
8ac2aa
-	memcpy(cpumcf_pe, cpumf_generic_ctr, sizeof(*cpumcf_pe) * generic_count);
8ac2aa
+	memcpy(cpumcf_pe, cpumcf_generic_counters,
8ac2aa
+	       sizeof(*cpumcf_pe) * generic_count);
8ac2aa
 	if (ext_set_count)
8ac2aa
 		memcpy((void *) (cpumcf_pe + generic_count),
8ac2aa
 		       ext_set, sizeof(*cpumcf_pe) * ext_set_count);
8ac2aa
@@ -250,8 +251,8 @@ pfmlib_pmu_t s390x_cpum_cf_support = {
8ac2aa
 	.num_fixed_cntrs = CPUMF_COUNTER_MAX,	/* fixed counters only */
8ac2aa
 	.max_encoding	 = 1,
8ac2aa
 
8ac2aa
-	.pe		 = cpumf_generic_ctr,
8ac2aa
-	.pme_count	 = LIBPFM_ARRAY_SIZE(cpumf_generic_ctr),
8ac2aa
+	.pe		 = cpumcf_generic_counters,
8ac2aa
+	.pme_count	 = LIBPFM_ARRAY_SIZE(cpumcf_generic_counters),
8ac2aa
 
8ac2aa
 	.pmu_detect    = pfm_cpumcf_detect,
8ac2aa
 	.pmu_init      = pfm_cpumcf_init,
8ac2aa
8ac2aa
commit a4b9c236d635c62bbe94e9d504efac9b8db20961
8ac2aa
Author: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
8ac2aa
Date:   Wed Feb 19 11:18:00 2014 +0100
8ac2aa
8ac2aa
    s390/cpumf: add extended counter support for IBM zEC12
8ac2aa
    
8ac2aa
    Add counter definitions for IBM zEnterprise EC12 specific counters in the
8ac2aa
    extended counter set.
8ac2aa
    
8ac2aa
    Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
8ac2aa
8ac2aa
diff --git a/lib/events/s390x_cpumf_events.h b/lib/events/s390x_cpumf_events.h
8ac2aa
index b1ad8fc..5e27fe6 100644
8ac2aa
--- a/lib/events/s390x_cpumf_events.h
8ac2aa
+++ b/lib/events/s390x_cpumf_events.h
8ac2aa
@@ -557,4 +557,287 @@ static const pme_cpumf_ctr_t cpumcf_z196_counters[] = {
8ac2aa
 	},
8ac2aa
 };
8ac2aa
 
8ac2aa
+static const pme_cpumf_ctr_t cpumcf_zec12_counters[] = {
8ac2aa
+	{
8ac2aa
+		.ctrnum = 128,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "DTLB1_MISSES",
8ac2aa
+		.desc = "Level-1 Data TLB miss in progress. Incremented by"
8ac2aa
+			" one for every cycle a DTLB1 miss is in progress.",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 129,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "ITLB1_MISSES",
8ac2aa
+		.desc = "Level-1 Instruction TLB miss in progress."
8ac2aa
+			" Incremented by one for every cycle a ITLB1 miss is"
8ac2aa
+			" in progress.",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 130,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "L1D_L2I_SOURCED_WRITES",
8ac2aa
+		.desc = "A directory write to the Level-1 Data cache"
8ac2aa
+			" directory where the returned cache line was sourced"
8ac2aa
+			" from the Level-2 Instruction cache",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 131,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "L1I_L2I_SOURCED_WRITES",
8ac2aa
+		.desc = "A directory write to the Level-1 Instruction cache"
8ac2aa
+			" directory where the returned cache line was sourced"
8ac2aa
+			" from the Level-2 Instruction cache",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 132,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "L1D_L2D_SOURCED_WRITES",
8ac2aa
+		.desc = "A directory write to the Level-1 Data cache"
8ac2aa
+			" directory where the returned cache line was sourced"
8ac2aa
+			" from the Level-2 Data cache",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 133,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "DTLB1_WRITES",
8ac2aa
+		.desc = "A translation entry has been written to the Level-1"
8ac2aa
+			" Data Translation Lookaside Buffer",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 135,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "L1D_LMEM_SOURCED_WRITES",
8ac2aa
+		.desc = "A directory write to the Level-1 Data cache where"
8ac2aa
+			" the installed cache line was sourced from memory"
8ac2aa
+			" that is attached to the same book as the Data cache"
8ac2aa
+			" (Local Memory)",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 137,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "L1I_LMEM_SOURCED_WRITES",
8ac2aa
+		.desc = "A directory write to the Level-1 Instruction cache"
8ac2aa
+			" where the installed cache line was sourced from"
8ac2aa
+			" memory that is attached to the same book as the"
8ac2aa
+			" Instruction cache (Local Memory)",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 138,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "L1D_RO_EXCL_WRITES",
8ac2aa
+		.desc = "A directory write to the Level-1 D-Cache where the"
8ac2aa
+			" line was originally in a Read-Only state in the"
8ac2aa
+			" cache but has been updated to be in the Exclusive"
8ac2aa
+			" state that allows stores to the cache line",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 139,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "DTLB1_HPAGE_WRITES",
8ac2aa
+		.desc = "A translation entry has been written to the Level-1"
8ac2aa
+			" Data Translation Lookaside Buffer for a one-"
8ac2aa
+			" megabyte page",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 140,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "ITLB1_WRITES",
8ac2aa
+		.desc = "A translation entry has been written to the Level-1"
8ac2aa
+			" Instruction Translation Lookaside Buffer",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 141,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "TLB2_PTE_WRITES",
8ac2aa
+		.desc = "A translation entry has been written to the Level-2"
8ac2aa
+			" TLB Page Table Entry arrays",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 142,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "TLB2_CRSTE_HPAGE_WRITES",
8ac2aa
+		.desc = "A translation entry has been written to the Level-2"
8ac2aa
+			" TLB Common Region Segment Table Entry arrays for a"
8ac2aa
+			" one-megabyte large page translation",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 143,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "TLB2_CRSTE_WRITES",
8ac2aa
+		.desc = "A translation entry has been written to the Level-2"
8ac2aa
+			" TLB Common Region Segment Table Entry arrays",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 144,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "L1D_ONCHIP_L3_SOURCED_WRITES",
8ac2aa
+		.desc = "A directory write to the Level-1 Data cache"
8ac2aa
+			" directory where the returned cache line was sourced"
8ac2aa
+			" from an On Chip Level-3 cache without intervention",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 145,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "L1D_OFFCHIP_L3_SOURCED_WRITES",
8ac2aa
+		.desc = "A directory write to the Level-1 Data cache"
8ac2aa
+			" directory where the returned cache line was sourced"
8ac2aa
+			" from an Off Chip/On Book Level-3 cache without"
8ac2aa
+			" intervention",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 146,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "L1D_OFFBOOK_L3_SOURCED_WRITES",
8ac2aa
+		.desc = "A directory write to the Level-1 Data cache"
8ac2aa
+			" directory where the returned cache line was sourced"
8ac2aa
+			" from an Off Book Level-3 cache without intervention",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 147,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "L1D_ONBOOK_L4_SOURCED_WRITES",
8ac2aa
+		.desc = "A directory write to the Level-1 Data cache"
8ac2aa
+			" directory where the returned cache line was sourced"
8ac2aa
+			" from an On Book Level-4 cache",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 148,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "L1D_OFFBOOK_L4_SOURCED_WRITES",
8ac2aa
+		.desc = "A directory write to the Level-1 Data cache"
8ac2aa
+			" directory where the returned cache line was sourced"
8ac2aa
+			" from an Off Book Level-4 cache",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 149,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "TX_NC_TEND",
8ac2aa
+		.desc = "A TEND instruction has completed in a"
8ac2aa
+			" nonconstrained transactional-execution mode",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 150,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "L1D_ONCHIP_L3_SOURCED_WRITES_IV",
8ac2aa
+		.desc = "A directory write to the Level-1 Data cache"
8ac2aa
+			" directory where the returned cache line was sourced"
8ac2aa
+			" from a On Chip Level-3 cache with intervention",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 151,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "L1D_OFFCHIP_L3_SOURCED_WRITES_IV",
8ac2aa
+		.desc = "A directory write to the Level-1 Data cache"
8ac2aa
+			" directory where the returned cache line was sourced"
8ac2aa
+			" from an Off Chip/On Book Level-3 cache with"
8ac2aa
+			" intervention",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 152,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "L1D_OFFBOOK_L3_SOURCED_WRITES_IV",
8ac2aa
+		.desc = "A directory write to the Level-1 Data cache"
8ac2aa
+			" directory where the returned cache line was sourced"
8ac2aa
+			" from an Off Book Level-3 cache with intervention",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 153,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "L1I_ONCHIP_L3_SOURCED_WRITES",
8ac2aa
+		.desc = "A directory write to the Level-1 Instruction cache"
8ac2aa
+			" directory where the returned cache line was sourced"
8ac2aa
+			" from an On Chip Level-3 cache without intervention",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 154,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "L1I_OFFCHIP_L3_SOURCED_WRITES",
8ac2aa
+		.desc = "A directory write to the Level-1 Instruction cache"
8ac2aa
+			" directory where the returned cache line was sourced"
8ac2aa
+			" from an Off Chip/On Book Level-3 cache without"
8ac2aa
+			" intervention",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 155,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "L1I_OFFBOOK_L3_SOURCED_WRITES",
8ac2aa
+		.desc = "A directory write to the Level-1 Instruction cache"
8ac2aa
+			" directory where the returned cache line was sourced"
8ac2aa
+			" from an Off Book Level-3 cache without intervention",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 156,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "L1I_ONBOOK_L4_SOURCED_WRITES",
8ac2aa
+		.desc = "A directory write to the Level-1 Instruction cache"
8ac2aa
+			" directory where the returned cache line was sourced"
8ac2aa
+			" from an On Book Level-4 cache",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 157,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "L1I_OFFBOOK_L4_SOURCED_WRITES",
8ac2aa
+		.desc = "A directory write to the Level-1 Instruction cache"
8ac2aa
+			" directory where the returned cache line was sourced"
8ac2aa
+			" from an Off Book Level-4 cache",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 158,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "TX_C_TEND",
8ac2aa
+		.desc = "A TEND instruction has completed in a constrained"
8ac2aa
+			" transactional-execution mode",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 159,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "L1I_ONCHIP_L3_SOURCED_WRITES_IV",
8ac2aa
+		.desc = "A directory write to the Level-1 Instruction cache"
8ac2aa
+			" directory where the returned cache line was sourced"
8ac2aa
+			" from an On Chip Level-3 cache with intervention",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 160,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "L1I_OFFCHIP_L3_SOURCED_WRITES_IV",
8ac2aa
+		.desc = "A directory write to the Level-1 Instruction cache"
8ac2aa
+			" directory where the returned cache line was sourced"
8ac2aa
+			" from an Off Chip/On Book Level-3 cache with"
8ac2aa
+			" intervention",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 161,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "L1I_OFFBOOK_L3_SOURCED_WRITES_IV",
8ac2aa
+		.desc = "A directory write to the Level-1 Instruction cache"
8ac2aa
+			" directory where the returned cache line was sourced"
8ac2aa
+			" from an Off Book Level-3 cache with intervention",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 177,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "TX_NC_TABORT",
8ac2aa
+		.desc = "A transaction abort has occurred in a"
8ac2aa
+			" nonconstrained transactional-execution mode",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 178,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "TX_C_TABORT_NO_SPECIAL",
8ac2aa
+		.desc = "A transaction abort has occurred in a constrained"
8ac2aa
+			" transactional-execution mode and the CPU is not"
8ac2aa
+			" using any special logic to allow the transaction to"
8ac2aa
+			" complete",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 179,
8ac2aa
+		.ctrset = CPUMF_CTRSET_EXTENDED,
8ac2aa
+		.name = "TX_C_TABORT_SPECIAL",
8ac2aa
+		.desc = "A transaction abort has occurred in a constrained"
8ac2aa
+			" transactional-execution mode and the CPU is using"
8ac2aa
+			" special logic to allow the transaction to complete",
8ac2aa
+	},
8ac2aa
+};
8ac2aa
+
8ac2aa
 #endif /* __S390X_CPUMF_EVENTS_H__ */
8ac2aa
diff --git a/lib/pfmlib_s390x_cpumf.c b/lib/pfmlib_s390x_cpumf.c
8ac2aa
index e216bd2..e3aaaf0 100644
8ac2aa
--- a/lib/pfmlib_s390x_cpumf.c
8ac2aa
+++ b/lib/pfmlib_s390x_cpumf.c
8ac2aa
@@ -115,6 +115,11 @@ static int pfm_cpumcf_init(void *this)
8ac2aa
 		ext_set = cpumcf_z196_counters;
8ac2aa
 		ext_set_count = LIBPFM_ARRAY_SIZE(cpumcf_z196_counters);
8ac2aa
 		break;
8ac2aa
+	case 2827:  /* IBM zEnterprise EC12 */
8ac2aa
+	case 2828:  /* IBM zEnterprise BC12 */
8ac2aa
+		ext_set = cpumcf_zec12_counters;
8ac2aa
+		ext_set_count = LIBPFM_ARRAY_SIZE(cpumcf_zec12_counters);
8ac2aa
+		break;
8ac2aa
 	default:
8ac2aa
 		/* No extended counter set for this machine type or there
8ac2aa
 		 * was an error retrieving the machine type */
8ac2aa
diff --git a/lib/pfmlib_s390x_priv.h b/lib/pfmlib_s390x_priv.h
8ac2aa
index 45259f2..22c775a 100644
8ac2aa
--- a/lib/pfmlib_s390x_priv.h
8ac2aa
+++ b/lib/pfmlib_s390x_priv.h
8ac2aa
@@ -1,7 +1,7 @@
8ac2aa
 #ifndef __PFMLIB_S390X_PRIV_H__
8ac2aa
 #define __PFMLIB_S390X_PRIV_H__
8ac2aa
 
8ac2aa
-#define CPUMF_COUNTER_MAX	    160
8ac2aa
+#define CPUMF_COUNTER_MAX	    256
8ac2aa
 typedef struct {
8ac2aa
 	uint64_t ctrnum;	    /* counter number */
8ac2aa
 	unsigned int ctrset;	    /* counter set */
8ac2aa
8ac2aa
commit 85a82c1343ded403ce9d3c16fc5cd5ab16e3e85c
8ac2aa
Author: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
8ac2aa
Date:   Wed Feb 19 11:18:01 2014 +0100
8ac2aa
8ac2aa
    s390/cpumf: add support for the CPU-measurement sampling facility
8ac2aa
    
8ac2aa
    Add support for the sampling facility to allow hardware-based sampling using
8ac2aa
    CPU cycles.  The cpum_sf PMU provides two perf events supporting available
8ac2aa
    sampling functions.
8ac2aa
    
8ac2aa
    Many existing pfmlib functions of the counter facility support (cpum_cf) have
8ac2aa
    been reused.
8ac2aa
    
8ac2aa
    Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
8ac2aa
8ac2aa
diff --git a/include/perfmon/pfmlib.h b/include/perfmon/pfmlib.h
8ac2aa
index ccd3211..dfdd471 100644
8ac2aa
--- a/include/perfmon/pfmlib.h
8ac2aa
+++ b/include/perfmon/pfmlib.h
8ac2aa
@@ -235,6 +235,8 @@ typedef enum {
8ac2aa
 	PFM_PMU_ARM_CORTEX_A53,		/* ARM Cortex A53 (ARMv8) */
8ac2aa
 	PFM_PMU_ARM_XGENE,		/* Applied Micro X-Gene (ARMv8) */
8ac2aa
 
8ac2aa
+	PFM_PMU_S390X_CPUM_SF,		/* s390x: CPU-M sampling facility */
8ac2aa
+
8ac2aa
 	/* MUST ADD NEW PMU MODELS HERE */
8ac2aa
 
8ac2aa
 	PFM_PMU_MAX			/* end marker */
8ac2aa
diff --git a/lib/events/s390x_cpumf_events.h b/lib/events/s390x_cpumf_events.h
8ac2aa
index 5e27fe6..e00b088 100644
8ac2aa
--- a/lib/events/s390x_cpumf_events.h
8ac2aa
+++ b/lib/events/s390x_cpumf_events.h
8ac2aa
@@ -840,4 +840,20 @@ static const pme_cpumf_ctr_t cpumcf_zec12_counters[] = {
8ac2aa
 	},
8ac2aa
 };
8ac2aa
 
8ac2aa
+static const pme_cpumf_ctr_t cpumsf_counters[] = {
8ac2aa
+	{
8ac2aa
+		.ctrnum = 720896,
8ac2aa
+		.ctrset = CPUMF_CTRSET_NONE,
8ac2aa
+		.name = "SF_CYCLES_BASIC",
8ac2aa
+		.desc = "Sample CPU cycles using basic-sampling mode",
8ac2aa
+	},
8ac2aa
+	{
8ac2aa
+		.ctrnum = 774144,
8ac2aa
+		.ctrset = CPUMF_CTRSET_NONE,
8ac2aa
+		.name = "SF_CYCLES_BASIC_DIAG",
8ac2aa
+		.desc = "Sample CPU cycle using diagnostic-sampling mode"
8ac2aa
+			" (not for ordinary use)",
8ac2aa
+	},
8ac2aa
+};
8ac2aa
+
8ac2aa
 #endif /* __S390X_CPUMF_EVENTS_H__ */
8ac2aa
diff --git a/lib/pfmlib_common.c b/lib/pfmlib_common.c
8ac2aa
index cd68301..8e4b1a1 100644
8ac2aa
--- a/lib/pfmlib_common.c
8ac2aa
+++ b/lib/pfmlib_common.c
8ac2aa
@@ -202,6 +202,7 @@ static pfmlib_pmu_t *pfmlib_pmus[]=
8ac2aa
 
8ac2aa
 #ifdef CONFIG_PFMLIB_ARCH_S390X
8ac2aa
 	&s390x_cpum_cf_support,
8ac2aa
+	&s390x_cpum_sf_support,
8ac2aa
 #endif
8ac2aa
 #ifdef __linux__
8ac2aa
 	&perf_event_support,
8ac2aa
diff --git a/lib/pfmlib_priv.h b/lib/pfmlib_priv.h
8ac2aa
index 2b5d33e..715c4b0 100644
8ac2aa
--- a/lib/pfmlib_priv.h
8ac2aa
+++ b/lib/pfmlib_priv.h
8ac2aa
@@ -334,6 +334,7 @@ extern pfmlib_pmu_t arm_1176_support;
8ac2aa
 extern pfmlib_pmu_t arm_xgene_support;
8ac2aa
 extern pfmlib_pmu_t mips_74k_support;
8ac2aa
 extern pfmlib_pmu_t s390x_cpum_cf_support;
8ac2aa
+extern pfmlib_pmu_t s390x_cpum_sf_support;
8ac2aa
 
8ac2aa
 extern pfmlib_os_t *pfmlib_os;
8ac2aa
 extern pfmlib_os_t pfmlib_os_perf;
8ac2aa
diff --git a/lib/pfmlib_s390x_cpumf.c b/lib/pfmlib_s390x_cpumf.c
8ac2aa
index e3aaaf0..db2a215 100644
8ac2aa
--- a/lib/pfmlib_s390x_cpumf.c
8ac2aa
+++ b/lib/pfmlib_s390x_cpumf.c
8ac2aa
@@ -1,7 +1,7 @@
8ac2aa
 /*
8ac2aa
- * PMU support for the CPU-measurement counter facility
8ac2aa
+ * PMU support for the CPU-measurement facilities
8ac2aa
  *
8ac2aa
- * Copyright IBM Corp. 2012
8ac2aa
+ * Copyright IBM Corp. 2012, 2014
8ac2aa
  * Contributed by Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
8ac2aa
  *
8ac2aa
  * Permission is hereby granted, free of charge, to any person obtaining a copy
8ac2aa
@@ -34,17 +34,25 @@
8ac2aa
 #include "events/s390x_cpumf_events.h"
8ac2aa
 
8ac2aa
 
8ac2aa
-#define CPUMF_DEVICE_DIR  "/sys/bus/event_source/devices/cpum_cf"
8ac2aa
-#define SYS_INFO	  "/proc/sysinfo"
8ac2aa
+#define CPUM_CF_DEVICE_DIR  "/sys/bus/event_source/devices/cpum_cf"
8ac2aa
+#define CPUM_SF_DEVICE_DIR  "/sys/bus/event_source/devices/cpum_sf"
8ac2aa
+#define SYS_INFO	    "/proc/sysinfo"
8ac2aa
 
8ac2aa
 
8ac2aa
 /* CPU-measurement counter list (pmu events) */
8ac2aa
 static pme_cpumf_ctr_t *cpumcf_pe = NULL;
8ac2aa
 
8ac2aa
-/* Detect the CPU-measurement facility */
8ac2aa
+/* Detect the CPU-measurement counter and sampling facilities */
8ac2aa
 static int pfm_cpumcf_detect(void *this)
8ac2aa
 {
8ac2aa
-	if (access(CPUMF_DEVICE_DIR, R_OK))
8ac2aa
+	if (access(CPUM_CF_DEVICE_DIR, R_OK))
8ac2aa
+		return PFM_ERR_NOTSUPP;
8ac2aa
+	return PFM_SUCCESS;
8ac2aa
+}
8ac2aa
+
8ac2aa
+static int pfm_cpumsf_detect(void *this)
8ac2aa
+{
8ac2aa
+	if (access(CPUM_SF_DEVICE_DIR, R_OK))
8ac2aa
 		return PFM_ERR_NOTSUPP;
8ac2aa
 	return PFM_SUCCESS;
8ac2aa
 }
8ac2aa
@@ -156,7 +164,7 @@ static void pfm_cpumcf_exit(void *this)
8ac2aa
 	free(cpumcf_pe);
8ac2aa
 }
8ac2aa
 
8ac2aa
-static int pfm_cpumcf_get_encoding(void *this, pfmlib_event_desc_t *e)
8ac2aa
+static int pfm_cpumf_get_encoding(void *this, pfmlib_event_desc_t *e)
8ac2aa
 {
8ac2aa
 	const pme_cpumf_ctr_t *pe = this_pe(this);
8ac2aa
 
8ac2aa
@@ -167,12 +175,12 @@ static int pfm_cpumcf_get_encoding(void *this, pfmlib_event_desc_t *e)
8ac2aa
 	return PFM_SUCCESS;
8ac2aa
 }
8ac2aa
 
8ac2aa
-static int pfm_cpumcf_get_event_first(void *this)
8ac2aa
+static int pfm_cpumf_get_event_first(void *this)
8ac2aa
 {
8ac2aa
 	return 0;
8ac2aa
 }
8ac2aa
 
8ac2aa
-static int pfm_cpumcf_get_event_next(void *this, int idx)
8ac2aa
+static int pfm_cpumf_get_event_next(void *this, int idx)
8ac2aa
 {
8ac2aa
 	pfmlib_pmu_t *pmu = this;
8ac2aa
 
8ac2aa
@@ -181,26 +189,20 @@ static int pfm_cpumcf_get_event_next(void *this, int idx)
8ac2aa
 	return idx + 1;
8ac2aa
 }
8ac2aa
 
8ac2aa
-static int pfm_cpumcf_event_is_valid(void *this, int idx)
8ac2aa
+static int pfm_cpumf_event_is_valid(void *this, int idx)
8ac2aa
 {
8ac2aa
 	pfmlib_pmu_t *pmu = this;
8ac2aa
 
8ac2aa
 	return (idx >= 0 && idx < pmu->pme_count);
8ac2aa
 }
8ac2aa
 
8ac2aa
-static int pfm_cpumcf_validate_table(void *this, FILE *fp)
8ac2aa
+static int pfm_cpumf_validate_table(void *this, FILE *fp)
8ac2aa
 {
8ac2aa
 	pfmlib_pmu_t *pmu = this;
8ac2aa
 	const pme_cpumf_ctr_t *pe = this_pe(this);
8ac2aa
 	int i, rc;
8ac2aa
 
8ac2aa
 	rc = PFM_ERR_INVAL;
8ac2aa
-	if (pmu->pme_count > CPUMF_COUNTER_MAX) {
8ac2aa
-		fprintf(fp, "pmu: %s: pme number exceeded maximum\n",
8ac2aa
-			pmu->name);
8ac2aa
-		goto failed;
8ac2aa
-	}
8ac2aa
-
8ac2aa
 	for (i = 0; i < pmu->pme_count; i++) {
8ac2aa
 		if (!pe[i].name) {
8ac2aa
 			fprintf(fp, "pmu: %s event: %i: No name\n",
8ac2aa
@@ -219,7 +221,20 @@ failed:
8ac2aa
 	return rc;
8ac2aa
 }
8ac2aa
 
8ac2aa
-static int pfm_cpumcf_get_event_info(void *this, int idx,
8ac2aa
+static int pfm_cpumcf_validate_table(void *this, FILE *fp)
8ac2aa
+{
8ac2aa
+	pfmlib_pmu_t *pmu = this;
8ac2aa
+
8ac2aa
+	if (pmu->pme_count > CPUMF_COUNTER_MAX) {
8ac2aa
+		fprintf(fp, "pmu: %s: pme number exceeded maximum\n",
8ac2aa
+			pmu->name);
8ac2aa
+		return PFM_ERR_INVAL;
8ac2aa
+	}
8ac2aa
+
8ac2aa
+	return pfm_cpumf_validate_table(this, fp);
8ac2aa
+}
8ac2aa
+
8ac2aa
+static int pfm_cpumf_get_event_info(void *this, int idx,
8ac2aa
 				    pfm_event_info_t *info)
8ac2aa
 {
8ac2aa
 	pfmlib_pmu_t *pmu = this;
8ac2aa
@@ -238,7 +253,7 @@ static int pfm_cpumcf_get_event_info(void *this, int idx,
8ac2aa
 	return PFM_SUCCESS;
8ac2aa
 }
8ac2aa
 
8ac2aa
-static int pfm_cpumcf_get_event_attr_info(void *this, int idx, int umask_idx,
8ac2aa
+static int pfm_cpumf_get_event_attr_info(void *this, int idx, int umask_idx,
8ac2aa
 					 pfm_event_attr_info_t *info)
8ac2aa
 {
8ac2aa
 	/* Attributes are not supported */
8ac2aa
@@ -263,12 +278,38 @@ pfmlib_pmu_t s390x_cpum_cf_support = {
8ac2aa
 	.pmu_init      = pfm_cpumcf_init,
8ac2aa
 	.pmu_terminate = pfm_cpumcf_exit,
8ac2aa
 
8ac2aa
-	.get_event_encoding[PFM_OS_NONE] = pfm_cpumcf_get_encoding,
8ac2aa
+	.get_event_encoding[PFM_OS_NONE] = pfm_cpumf_get_encoding,
8ac2aa
 		PFMLIB_ENCODE_PERF(pfm_s390x_get_perf_encoding),
8ac2aa
-	.get_event_first	= pfm_cpumcf_get_event_first,
8ac2aa
-	.get_event_next		= pfm_cpumcf_get_event_next,
8ac2aa
-	.event_is_valid		= pfm_cpumcf_event_is_valid,
8ac2aa
+	.get_event_first	= pfm_cpumf_get_event_first,
8ac2aa
+	.get_event_next		= pfm_cpumf_get_event_next,
8ac2aa
+	.event_is_valid		= pfm_cpumf_event_is_valid,
8ac2aa
 	.validate_table		= pfm_cpumcf_validate_table,
8ac2aa
-	.get_event_info		= pfm_cpumcf_get_event_info,
8ac2aa
-	.get_event_attr_info	= pfm_cpumcf_get_event_attr_info,
8ac2aa
+	.get_event_info		= pfm_cpumf_get_event_info,
8ac2aa
+	.get_event_attr_info	= pfm_cpumf_get_event_attr_info,
8ac2aa
+};
8ac2aa
+
8ac2aa
+pfmlib_pmu_t s390x_cpum_sf_support = {
8ac2aa
+	.desc	   = "CPU-measurement sampling facility",
8ac2aa
+	.name	   = "cpum_sf",
8ac2aa
+	.pmu	   = PFM_PMU_S390X_CPUM_SF,
8ac2aa
+	.type	   = PFM_PMU_TYPE_CORE,
8ac2aa
+	.flags	   = PFMLIB_PMU_FL_ARCH_DFL,
8ac2aa
+
8ac2aa
+	.num_cntrs	 = 0,	/* no general-purpose counters */
8ac2aa
+	.num_fixed_cntrs = 2,	/* fixed counters only */
8ac2aa
+	.max_encoding	 = 1,
8ac2aa
+
8ac2aa
+	.pe	   = cpumsf_counters,
8ac2aa
+	.pme_count = LIBPFM_ARRAY_SIZE(cpumsf_counters),
8ac2aa
+
8ac2aa
+	.pmu_detect = pfm_cpumsf_detect,
8ac2aa
+
8ac2aa
+	.get_event_encoding[PFM_OS_NONE] = pfm_cpumf_get_encoding,
8ac2aa
+		PFMLIB_ENCODE_PERF(pfm_s390x_get_perf_encoding),
8ac2aa
+	.get_event_first	= pfm_cpumf_get_event_first,
8ac2aa
+	.get_event_next		= pfm_cpumf_get_event_next,
8ac2aa
+	.event_is_valid		= pfm_cpumf_event_is_valid,
8ac2aa
+	.validate_table		= pfm_cpumf_validate_table,
8ac2aa
+	.get_event_info		= pfm_cpumf_get_event_info,
8ac2aa
+	.get_event_attr_info	= pfm_cpumf_get_event_attr_info,
8ac2aa
 };