Subject: s390-tools: Add support for CPU-Measurement Facility SVN 6
From: Thomas Richter <tmricht@linux.ibm.com>

Summary:     s390-tools: Add support for CPU-Measurement Facility SVN 6
Description: Add support for the CPU-Measurement counter facility
             second version number 6.

             Add support for the new CPU-Measurement counter
             facility second version number 6 to identify some new
             counters in the crypto counter set and the extended
             counter set.

Upstream-ID: f110a77b68d46f10cab8847cf73fe92686ae7d11
Problem-ID:  KRN1802

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
---
 cpumf/Makefile                      |    2 
 cpumf/bin/cpumf_helper.in           |    7 ++-
 cpumf/data/cpum-cf-csvn-12345.ctr   |   84 ++++++++++++++++++++++++++++++++++++
 cpumf/data/cpum-cf-csvn-6.ctr       |   29 ++++++++++++
 cpumf/data/cpum-cf-csvn-generic.ctr |   84 ------------------------------------
 cpumf/data/cpum-cf-hw-counter.map   |    6 ++
 6 files changed, 125 insertions(+), 87 deletions(-)

--- a/cpumf/Makefile
+++ b/cpumf/Makefile
@@ -6,7 +6,7 @@ include ../common.mak
 CPUMF_DATADIR = $(TOOLS_DATADIR)/cpumf
 DATA_FILES = cpum-cf-hw-counter.map \
 	     cpum-cf-cfvn-1.ctr cpum-cf-cfvn-3.ctr \
-	     cpum-cf-csvn-generic.ctr \
+	     cpum-cf-csvn-12345.ctr cpum-cf-csvn-6.ctr \
              cpum-cf-extended-z10.ctr cpum-cf-extended-z196.ctr \
 	     cpum-cf-extended-zEC12.ctr cpum-sf-modes.ctr \
 	     cpum-cf-extended-z13.ctr cpum-cf-extended-z14.ctr
--- a/cpumf/bin/cpumf_helper.in
+++ b/cpumf/bin/cpumf_helper.in
@@ -266,7 +266,12 @@ sub cpumf_load_ctrdef($;$)
 	# List of "generic" counter sets
 	my @def = ();
 	push @def, "cfvn-" . $version->{cfvn};
-	push @def, "csvn-generic";
+	if ($version->{csvn} >= 1 && $version->{csvn} <= 6) {
+		push @def, "csvn-12345";
+	}
+	if ($version->{csvn} == 6) {
+		push @def, "csvn-6";
+	}
 
 	my $h = {};
 	# Load counter set definition
--- /dev/null
+++ b/cpumf/data/cpum-cf-csvn-12345.ctr
@@ -0,0 +1,84 @@
+Counter:  64	Name:PRNG_FUNCTIONS
+Description:
+Total number of the PRNG functions issued by the CPU
+.
+Counter:  65	Name:PRNG_CYCLES
+Description:
+Total number of CPU cycles when the DEA/AES coprocessor is busy
+performing PRNG functions issued by the CPU
+.
+Counter:  66	Name:PRNG_BLOCKED_FUNCTIONS
+Description:
+Total number of the PRNG functions that are issued by the CPU and are
+blocked because the DEA/AES coprocessor is busy performing a function
+issued by another CPU
+.
+Counter:  67	Name:PRNG_BLOCKED_CYCLES
+Description:
+Total number of CPU cycles blocked for the PRNG functions issued by
+the CPU because the DEA/AES coprocessor is busy performing a function
+issued by another CPU
+.
+Counter:  68	Name:SHA_FUNCTIONS
+Description:
+Total number of SHA functions issued by the CPU
+.
+Counter:  69	Name:SHA_CYCLES
+Description:
+Total number of CPU cycles when the SHA coprocessor is busy performing
+the SHA functions issued by the CPU
+.
+Counter:  70	Name:SHA_BLOCKED_FUNCTIONS
+Description:
+Total number of the SHA functions that are issued by the CPU and are
+blocked because the SHA coprocessor is busy performing a function issued
+by another CPU
+.
+Counter:  71	Name:SHA_BLOCKED_CYCLES
+Description:
+Total number of CPU cycles blocked for the SHA functions issued by the
+CPU because the SHA coprocessor is busy performing a function issued
+by another CPU
+.
+Counter:  72	Name:DEA_FUNCTIONS
+Description:
+Total number of the DEA functions issued by the CPU
+.
+Counter:  73	Name:DEA_CYCLES
+Description:
+Total number of CPU cycles when the DEA/AES coprocessor is busy
+performing the DEA functions issued by the CPU
+.
+Counter:  74	Name:DEA_BLOCKED_FUNCTIONS
+Description:
+Total number of the DEA functions that are issued by the CPU and are
+blocked because the DEA/AES coprocessor is busy performing a function
+issued by another CPU
+.
+Counter:  75	Name:DEA_BLOCKED_CYCLES
+Description:
+Total number of CPU cycles blocked for the DEA functions issued by the
+CPU because the DEA/AES coprocessor is busy performing a function issued
+by another CPU
+.
+Counter:  76	Name:AES_FUNCTIONS
+Description:
+Total number of AES functions issued by the CPU
+.
+Counter:  77	Name:AES_CYCLES
+Description:
+Total number of CPU cycles when the DEA/AES coprocessor is busy
+performing the AES functions issued by the CPU
+.
+Counter:  78	Name:AES_BLOCKED_FUNCTIONS
+Description:
+Total number of AES functions that are issued by the CPU and are blocked
+because the DEA/AES coprocessor is busy performing a function issued
+by another CPU
+.
+Counter:  79	Name:AES_BLOCKED_CYCLES
+Description:
+Total number of CPU cycles blocked for the AES functions issued by the
+CPU because the DEA/AES coprocessor is busy performing a function issued
+by another CPU
+.
--- /dev/null
+++ b/cpumf/data/cpum-cf-csvn-6.ctr
@@ -0,0 +1,29 @@
+Counter:  80	Name:ECC_FUNCTION_COUNT
+Description:
+This counter counts the
+total number of the elliptic-curve cryptography (ECC)
+functions issued by the CPU.
+.
+Counter:  81	Name:ECC_CYCLES_COUNT
+Description:
+This counter counts the total
+number of CPU cycles when the ECC coprocessor is
+busy performing the elliptic-curve cryptography
+(ECC) functions issued by the CPU.
+.
+Counter:  82	Name:ECC_BLOCKED_FUNCTION_COUNT
+Description:
+This counter
+counts the total number of the elliptic-curve
+cryptography (ECC) functions that are issued by the CPU
+and are blocked because the ECC coprocessor is
+busy performing a function issued by another CPU.
+.
+Counter:  83	Name:ECC_BLOCKED_CYCLES_COUNT
+Description:
+This counter counts
+the total number of CPU cycles blocked for the elliptic-curve
+cryptography (ECC) functions issued by the
+CPU because the ECC coprocessor is busy perform-
+ing a function issued by another CPU.
+.
--- a/cpumf/data/cpum-cf-csvn-generic.ctr
+++ /dev/null
@@ -1,84 +0,0 @@
-Counter:  64	Name:PRNG_FUNCTIONS
-Description:
-Total number of the PRNG functions issued by the CPU
-.
-Counter:  65	Name:PRNG_CYCLES
-Description:
-Total number of CPU cycles when the DEA/AES coprocessor is busy
-performing PRNG functions issued by the CPU
-.
-Counter:  66	Name:PRNG_BLOCKED_FUNCTIONS
-Description:
-Total number of the PRNG functions that are issued by the CPU and are
-blocked because the DEA/AES coprocessor is busy performing a function
-issued by another CPU
-.
-Counter:  67	Name:PRNG_BLOCKED_CYCLES
-Description:
-Total number of CPU cycles blocked for the PRNG functions issued by
-the CPU because the DEA/AES coprocessor is busy performing a function
-issued by another CPU
-.
-Counter:  68	Name:SHA_FUNCTIONS
-Description:
-Total number of SHA functions issued by the CPU
-.
-Counter:  69	Name:SHA_CYCLES
-Description:
-Total number of CPU cycles when the SHA coprocessor is busy performing
-the SHA functions issued by the CPU
-.
-Counter:  70	Name:SHA_BLOCKED_FUNCTIONS
-Description:
-Total number of the SHA functions that are issued by the CPU and are
-blocked because the SHA coprocessor is busy performing a function issued
-by another CPU
-.
-Counter:  71	Name:SHA_BLOCKED_CYCLES
-Description:
-Total number of CPU cycles blocked for the SHA functions issued by the
-CPU because the SHA coprocessor is busy performing a function issued
-by another CPU
-.
-Counter:  72	Name:DEA_FUNCTIONS
-Description:
-Total number of the DEA functions issued by the CPU
-.
-Counter:  73	Name:DEA_CYCLES
-Description:
-Total number of CPU cycles when the DEA/AES coprocessor is busy
-performing the DEA functions issued by the CPU
-.
-Counter:  74	Name:DEA_BLOCKED_FUNCTIONS
-Description:
-Total number of the DEA functions that are issued by the CPU and are
-blocked because the DEA/AES coprocessor is busy performing a function
-issued by another CPU
-.
-Counter:  75	Name:DEA_BLOCKED_CYCLES
-Description:
-Total number of CPU cycles blocked for the DEA functions issued by the
-CPU because the DEA/AES coprocessor is busy performing a function issued
-by another CPU
-.
-Counter:  76	Name:AES_FUNCTIONS
-Description:
-Total number of AES functions issued by the CPU
-.
-Counter:  77	Name:AES_CYCLES
-Description:
-Total number of CPU cycles when the DEA/AES coprocessor is busy
-performing the AES functions issued by the CPU
-.
-Counter:  78	Name:AES_BLOCKED_FUNCTIONS
-Description:
-Total number of AES functions that are issued by the CPU and are blocked
-because the DEA/AES coprocessor is busy performing a function issued
-by another CPU
-.
-Counter:  79	Name:AES_BLOCKED_CYCLES
-Description:
-Total number of CPU cycles blocked for the AES functions issued by the
-CPU because the DEA/AES coprocessor is busy performing a function issued
-by another CPU
-.
--- a/cpumf/data/cpum-cf-hw-counter.map
+++ b/cpumf/data/cpum-cf-hw-counter.map
@@ -14,7 +14,8 @@
 	'cfvn-3'	=> 'cpum-cf-cfvn-3.ctr',
 
 	# CSVN
-	'csvn-generic'	=> 'cpum-cf-csvn-generic.ctr',
+	'csvn-12345'	=> 'cpum-cf-csvn-12345.ctr',
+	'csvn-6'	=> 'cpum-cf-csvn-6.ctr',
 
 	# Extended counters
 	2097		=> 'cpum-cf-extended-z10.ctr',
@@ -27,4 +28,7 @@
 	2965		=> 'cpum-cf-extended-z13.ctr',
 	3906		=> 'cpum-cf-extended-z14.ctr',
 	3907		=> 'cpum-cf-extended-z14.ctr',
+	# Identical with z14
+	8561		=> 'cpum-cf-extended-z14.ctr',
+	8562		=> 'cpum-cf-extended-z14.ctr',
 };
