Commit 46a984ff authored by Thomas Richter's avatar Thomas Richter Committed by Martin Schwidefsky

s390/cpum_cf: Add support for CPU-MF SVN 6

Add support for the CPU-Measurement Facility counter
second version number 6. This number is used to detect some
more counters in the crypto counter set and the extended
counter set.
Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
Reviewed-by: default avatarHendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 2f2f3839
......@@ -2,8 +2,8 @@
/*
* Performance event support for s390x - CPU-measurement Counter Facility
*
* Copyright IBM Corp. 2012, 2017
* Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
* Copyright IBM Corp. 2012, 2019
* Author(s): Hendrik Brueckner <brueckner@linux.ibm.com>
*/
#define KMSG_COMPONENT "cpum_cf"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
......@@ -26,7 +26,7 @@ static enum cpumf_ctr_set get_counter_set(u64 event)
set = CPUMF_CTR_SET_USER;
else if (event < 128)
set = CPUMF_CTR_SET_CRYPTO;
else if (event < 256)
else if (event < 288)
set = CPUMF_CTR_SET_EXT;
else if (event >= 448 && event < 496)
set = CPUMF_CTR_SET_MT_DIAG;
......@@ -50,12 +50,19 @@ static int validate_ctr_version(const struct hw_perf_event *hwc)
err = -EOPNOTSUPP;
break;
case CPUMF_CTR_SET_CRYPTO:
if ((cpuhw->info.csvn >= 1 && cpuhw->info.csvn <= 5 &&
hwc->config > 79) ||
(cpuhw->info.csvn >= 6 && hwc->config > 83))
err = -EOPNOTSUPP;
break;
case CPUMF_CTR_SET_EXT:
if (cpuhw->info.csvn < 1)
err = -EOPNOTSUPP;
if ((cpuhw->info.csvn == 1 && hwc->config > 159) ||
(cpuhw->info.csvn == 2 && hwc->config > 175) ||
(cpuhw->info.csvn > 2 && hwc->config > 255))
(cpuhw->info.csvn >= 3 && cpuhw->info.csvn <= 5
&& hwc->config > 255) ||
(cpuhw->info.csvn >= 6 && hwc->config > 287))
err = -EOPNOTSUPP;
break;
case CPUMF_CTR_SET_MT_DIAG:
......
......@@ -31,22 +31,26 @@ CPUMF_EVENT_ATTR(cf_fvn3, PROBLEM_STATE_CPU_CYCLES, 0x0020);
CPUMF_EVENT_ATTR(cf_fvn3, PROBLEM_STATE_INSTRUCTIONS, 0x0021);
CPUMF_EVENT_ATTR(cf_fvn3, L1D_DIR_WRITES, 0x0004);
CPUMF_EVENT_ATTR(cf_fvn3, L1D_PENALTY_CYCLES, 0x0005);
CPUMF_EVENT_ATTR(cf_svn_generic, PRNG_FUNCTIONS, 0x0040);
CPUMF_EVENT_ATTR(cf_svn_generic, PRNG_CYCLES, 0x0041);
CPUMF_EVENT_ATTR(cf_svn_generic, PRNG_BLOCKED_FUNCTIONS, 0x0042);
CPUMF_EVENT_ATTR(cf_svn_generic, PRNG_BLOCKED_CYCLES, 0x0043);
CPUMF_EVENT_ATTR(cf_svn_generic, SHA_FUNCTIONS, 0x0044);
CPUMF_EVENT_ATTR(cf_svn_generic, SHA_CYCLES, 0x0045);
CPUMF_EVENT_ATTR(cf_svn_generic, SHA_BLOCKED_FUNCTIONS, 0x0046);
CPUMF_EVENT_ATTR(cf_svn_generic, SHA_BLOCKED_CYCLES, 0x0047);
CPUMF_EVENT_ATTR(cf_svn_generic, DEA_FUNCTIONS, 0x0048);
CPUMF_EVENT_ATTR(cf_svn_generic, DEA_CYCLES, 0x0049);
CPUMF_EVENT_ATTR(cf_svn_generic, DEA_BLOCKED_FUNCTIONS, 0x004a);
CPUMF_EVENT_ATTR(cf_svn_generic, DEA_BLOCKED_CYCLES, 0x004b);
CPUMF_EVENT_ATTR(cf_svn_generic, AES_FUNCTIONS, 0x004c);
CPUMF_EVENT_ATTR(cf_svn_generic, AES_CYCLES, 0x004d);
CPUMF_EVENT_ATTR(cf_svn_generic, AES_BLOCKED_FUNCTIONS, 0x004e);
CPUMF_EVENT_ATTR(cf_svn_generic, AES_BLOCKED_CYCLES, 0x004f);
CPUMF_EVENT_ATTR(cf_svn_12345, PRNG_FUNCTIONS, 0x0040);
CPUMF_EVENT_ATTR(cf_svn_12345, PRNG_CYCLES, 0x0041);
CPUMF_EVENT_ATTR(cf_svn_12345, PRNG_BLOCKED_FUNCTIONS, 0x0042);
CPUMF_EVENT_ATTR(cf_svn_12345, PRNG_BLOCKED_CYCLES, 0x0043);
CPUMF_EVENT_ATTR(cf_svn_12345, SHA_FUNCTIONS, 0x0044);
CPUMF_EVENT_ATTR(cf_svn_12345, SHA_CYCLES, 0x0045);
CPUMF_EVENT_ATTR(cf_svn_12345, SHA_BLOCKED_FUNCTIONS, 0x0046);
CPUMF_EVENT_ATTR(cf_svn_12345, SHA_BLOCKED_CYCLES, 0x0047);
CPUMF_EVENT_ATTR(cf_svn_12345, DEA_FUNCTIONS, 0x0048);
CPUMF_EVENT_ATTR(cf_svn_12345, DEA_CYCLES, 0x0049);
CPUMF_EVENT_ATTR(cf_svn_12345, DEA_BLOCKED_FUNCTIONS, 0x004a);
CPUMF_EVENT_ATTR(cf_svn_12345, DEA_BLOCKED_CYCLES, 0x004b);
CPUMF_EVENT_ATTR(cf_svn_12345, AES_FUNCTIONS, 0x004c);
CPUMF_EVENT_ATTR(cf_svn_12345, AES_CYCLES, 0x004d);
CPUMF_EVENT_ATTR(cf_svn_12345, AES_BLOCKED_FUNCTIONS, 0x004e);
CPUMF_EVENT_ATTR(cf_svn_12345, AES_BLOCKED_CYCLES, 0x004f);
CPUMF_EVENT_ATTR(cf_svn_6, ECC_FUNCTION_COUNT, 0x0050);
CPUMF_EVENT_ATTR(cf_svn_6, ECC_CYCLES_COUNT, 0x0051);
CPUMF_EVENT_ATTR(cf_svn_6, ECC_BLOCKED_FUNCTION_COUNT, 0x0052);
CPUMF_EVENT_ATTR(cf_svn_6, ECC_BLOCKED_CYCLES_COUNT, 0x0053);
CPUMF_EVENT_ATTR(cf_z10, L1I_L2_SOURCED_WRITES, 0x0080);
CPUMF_EVENT_ATTR(cf_z10, L1D_L2_SOURCED_WRITES, 0x0081);
CPUMF_EVENT_ATTR(cf_z10, L1I_L3_LOCAL_WRITES, 0x0082);
......@@ -262,23 +266,47 @@ static struct attribute *cpumcf_fvn3_pmu_event_attr[] __initdata = {
NULL,
};
static struct attribute *cpumcf_svn_generic_pmu_event_attr[] __initdata = {
CPUMF_EVENT_PTR(cf_svn_generic, PRNG_FUNCTIONS),
CPUMF_EVENT_PTR(cf_svn_generic, PRNG_CYCLES),
CPUMF_EVENT_PTR(cf_svn_generic, PRNG_BLOCKED_FUNCTIONS),
CPUMF_EVENT_PTR(cf_svn_generic, PRNG_BLOCKED_CYCLES),
CPUMF_EVENT_PTR(cf_svn_generic, SHA_FUNCTIONS),
CPUMF_EVENT_PTR(cf_svn_generic, SHA_CYCLES),
CPUMF_EVENT_PTR(cf_svn_generic, SHA_BLOCKED_FUNCTIONS),
CPUMF_EVENT_PTR(cf_svn_generic, SHA_BLOCKED_CYCLES),
CPUMF_EVENT_PTR(cf_svn_generic, DEA_FUNCTIONS),
CPUMF_EVENT_PTR(cf_svn_generic, DEA_CYCLES),
CPUMF_EVENT_PTR(cf_svn_generic, DEA_BLOCKED_FUNCTIONS),
CPUMF_EVENT_PTR(cf_svn_generic, DEA_BLOCKED_CYCLES),
CPUMF_EVENT_PTR(cf_svn_generic, AES_FUNCTIONS),
CPUMF_EVENT_PTR(cf_svn_generic, AES_CYCLES),
CPUMF_EVENT_PTR(cf_svn_generic, AES_BLOCKED_FUNCTIONS),
CPUMF_EVENT_PTR(cf_svn_generic, AES_BLOCKED_CYCLES),
static struct attribute *cpumcf_svn_12345_pmu_event_attr[] __initdata = {
CPUMF_EVENT_PTR(cf_svn_12345, PRNG_FUNCTIONS),
CPUMF_EVENT_PTR(cf_svn_12345, PRNG_CYCLES),
CPUMF_EVENT_PTR(cf_svn_12345, PRNG_BLOCKED_FUNCTIONS),
CPUMF_EVENT_PTR(cf_svn_12345, PRNG_BLOCKED_CYCLES),
CPUMF_EVENT_PTR(cf_svn_12345, SHA_FUNCTIONS),
CPUMF_EVENT_PTR(cf_svn_12345, SHA_CYCLES),
CPUMF_EVENT_PTR(cf_svn_12345, SHA_BLOCKED_FUNCTIONS),
CPUMF_EVENT_PTR(cf_svn_12345, SHA_BLOCKED_CYCLES),
CPUMF_EVENT_PTR(cf_svn_12345, DEA_FUNCTIONS),
CPUMF_EVENT_PTR(cf_svn_12345, DEA_CYCLES),
CPUMF_EVENT_PTR(cf_svn_12345, DEA_BLOCKED_FUNCTIONS),
CPUMF_EVENT_PTR(cf_svn_12345, DEA_BLOCKED_CYCLES),
CPUMF_EVENT_PTR(cf_svn_12345, AES_FUNCTIONS),
CPUMF_EVENT_PTR(cf_svn_12345, AES_CYCLES),
CPUMF_EVENT_PTR(cf_svn_12345, AES_BLOCKED_FUNCTIONS),
CPUMF_EVENT_PTR(cf_svn_12345, AES_BLOCKED_CYCLES),
NULL,
};
static struct attribute *cpumcf_svn_6_pmu_event_attr[] __initdata = {
CPUMF_EVENT_PTR(cf_svn_12345, PRNG_FUNCTIONS),
CPUMF_EVENT_PTR(cf_svn_12345, PRNG_CYCLES),
CPUMF_EVENT_PTR(cf_svn_12345, PRNG_BLOCKED_FUNCTIONS),
CPUMF_EVENT_PTR(cf_svn_12345, PRNG_BLOCKED_CYCLES),
CPUMF_EVENT_PTR(cf_svn_12345, SHA_FUNCTIONS),
CPUMF_EVENT_PTR(cf_svn_12345, SHA_CYCLES),
CPUMF_EVENT_PTR(cf_svn_12345, SHA_BLOCKED_FUNCTIONS),
CPUMF_EVENT_PTR(cf_svn_12345, SHA_BLOCKED_CYCLES),
CPUMF_EVENT_PTR(cf_svn_12345, DEA_FUNCTIONS),
CPUMF_EVENT_PTR(cf_svn_12345, DEA_CYCLES),
CPUMF_EVENT_PTR(cf_svn_12345, DEA_BLOCKED_FUNCTIONS),
CPUMF_EVENT_PTR(cf_svn_12345, DEA_BLOCKED_CYCLES),
CPUMF_EVENT_PTR(cf_svn_12345, AES_FUNCTIONS),
CPUMF_EVENT_PTR(cf_svn_12345, AES_CYCLES),
CPUMF_EVENT_PTR(cf_svn_12345, AES_BLOCKED_FUNCTIONS),
CPUMF_EVENT_PTR(cf_svn_12345, AES_BLOCKED_CYCLES),
CPUMF_EVENT_PTR(cf_svn_6, ECC_FUNCTION_COUNT),
CPUMF_EVENT_PTR(cf_svn_6, ECC_CYCLES_COUNT),
CPUMF_EVENT_PTR(cf_svn_6, ECC_BLOCKED_FUNCTION_COUNT),
CPUMF_EVENT_PTR(cf_svn_6, ECC_BLOCKED_CYCLES_COUNT),
NULL,
};
......@@ -562,7 +590,18 @@ __init const struct attribute_group **cpumf_cf_event_group(void)
default:
cfvn = none;
}
csvn = cpumcf_svn_generic_pmu_event_attr;
/* Determine version specific crypto set */
switch (ci.csvn) {
case 1 ... 5:
csvn = cpumcf_svn_12345_pmu_event_attr;
break;
case 6:
csvn = cpumcf_svn_6_pmu_event_attr;
break;
default:
csvn = none;
}
/* Determine model-specific counter set(s) */
get_cpu_id(&cpu_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment