162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Support for s390 CPU measurement counter set diagnostic facility 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright IBM Corp. 2019 662306a36Sopenharmony_ci Author(s): Hendrik Brueckner <brueckner@linux.ibm.com> 762306a36Sopenharmony_ci * Thomas Richter <tmricht@linux.ibm.com> 862306a36Sopenharmony_ci */ 962306a36Sopenharmony_ci#ifndef S390_CPUMCF_KERNEL_H 1062306a36Sopenharmony_ci#define S390_CPUMCF_KERNEL_H 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#define S390_CPUMCF_DIAG_DEF 0xfeef /* Counter diagnostic entry ID */ 1362306a36Sopenharmony_ci#define PERF_EVENT_CPUM_CF_DIAG 0xBC000 /* Event: Counter sets */ 1462306a36Sopenharmony_ci#define PERF_EVENT_CPUM_SF_DIAG 0xBD000 /* Event: Combined-sampling */ 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_cistruct cf_ctrset_entry { /* CPU-M CF counter set entry (8 byte) */ 1762306a36Sopenharmony_ci unsigned int def:16; /* 0-15 Data Entry Format */ 1862306a36Sopenharmony_ci unsigned int set:16; /* 16-23 Counter set identifier */ 1962306a36Sopenharmony_ci unsigned int ctr:16; /* 24-39 Number of stored counters */ 2062306a36Sopenharmony_ci unsigned int res1:16; /* 40-63 Reserved */ 2162306a36Sopenharmony_ci}; 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_cistruct cf_trailer_entry { /* CPU-M CF trailer for raw traces (64 byte) */ 2462306a36Sopenharmony_ci /* 0 - 7 */ 2562306a36Sopenharmony_ci union { 2662306a36Sopenharmony_ci struct { 2762306a36Sopenharmony_ci unsigned int clock_base:1; /* TOD clock base */ 2862306a36Sopenharmony_ci unsigned int speed:1; /* CPU speed */ 2962306a36Sopenharmony_ci /* Measurement alerts */ 3062306a36Sopenharmony_ci unsigned int mtda:1; /* Loss of MT ctr. data alert */ 3162306a36Sopenharmony_ci unsigned int caca:1; /* Counter auth. change alert */ 3262306a36Sopenharmony_ci unsigned int lcda:1; /* Loss of counter data alert */ 3362306a36Sopenharmony_ci }; 3462306a36Sopenharmony_ci unsigned long flags; /* 0-63 All indicators */ 3562306a36Sopenharmony_ci }; 3662306a36Sopenharmony_ci /* 8 - 15 */ 3762306a36Sopenharmony_ci unsigned int cfvn:16; /* 64-79 Ctr First Version */ 3862306a36Sopenharmony_ci unsigned int csvn:16; /* 80-95 Ctr Second Version */ 3962306a36Sopenharmony_ci unsigned int cpu_speed:32; /* 96-127 CPU speed */ 4062306a36Sopenharmony_ci /* 16 - 23 */ 4162306a36Sopenharmony_ci unsigned long timestamp; /* 128-191 Timestamp (TOD) */ 4262306a36Sopenharmony_ci /* 24 - 55 */ 4362306a36Sopenharmony_ci union { 4462306a36Sopenharmony_ci struct { 4562306a36Sopenharmony_ci unsigned long progusage1; 4662306a36Sopenharmony_ci unsigned long progusage2; 4762306a36Sopenharmony_ci unsigned long progusage3; 4862306a36Sopenharmony_ci unsigned long tod_base; 4962306a36Sopenharmony_ci }; 5062306a36Sopenharmony_ci unsigned long progusage[4]; 5162306a36Sopenharmony_ci }; 5262306a36Sopenharmony_ci /* 56 - 63 */ 5362306a36Sopenharmony_ci unsigned int mach_type:16; /* Machine type */ 5462306a36Sopenharmony_ci unsigned int res1:16; /* Reserved */ 5562306a36Sopenharmony_ci unsigned int res2:32; /* Reserved */ 5662306a36Sopenharmony_ci}; 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ci#define CPUMF_CTR_SET_BASIC 0 /* Basic Counter Set */ 5962306a36Sopenharmony_ci#define CPUMF_CTR_SET_USER 1 /* Problem-State Counter Set */ 6062306a36Sopenharmony_ci#define CPUMF_CTR_SET_CRYPTO 2 /* Crypto-Activity Counter Set */ 6162306a36Sopenharmony_ci#define CPUMF_CTR_SET_EXT 3 /* Extended Counter Set */ 6262306a36Sopenharmony_ci#define CPUMF_CTR_SET_MT_DIAG 4 /* MT-diagnostic Counter Set */ 6362306a36Sopenharmony_ci#endif 64