1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Support for s390 CPU measurement counter set diagnostic facility 4 * 5 * Copyright IBM Corp. 2019 6 Author(s): Hendrik Brueckner <brueckner@linux.ibm.com> 7 * Thomas Richter <tmricht@linux.ibm.com> 8 */ 9 #ifndef S390_CPUMCF_KERNEL_H 10 #define S390_CPUMCF_KERNEL_H 11 12 #define S390_CPUMCF_DIAG_DEF 0xfeef /* Counter diagnostic entry ID */ 13 #define PERF_EVENT_CPUM_CF_DIAG 0xBC000 /* Event: Counter sets */ 14 #define PERF_EVENT_CPUM_SF_DIAG 0xBD000 /* Event: Combined-sampling */ 15 16 struct cf_ctrset_entry { /* CPU-M CF counter set entry (8 byte) */ 17 unsigned int def:16; /* 0-15 Data Entry Format */ 18 unsigned int set:16; /* 16-23 Counter set identifier */ 19 unsigned int ctr:16; /* 24-39 Number of stored counters */ 20 unsigned int res1:16; /* 40-63 Reserved */ 21 }; 22 23 struct cf_trailer_entry { /* CPU-M CF trailer for raw traces (64 byte) */ 24 /* 0 - 7 */ 25 union { 26 struct { 27 unsigned int clock_base:1; /* TOD clock base */ 28 unsigned int speed:1; /* CPU speed */ 29 /* Measurement alerts */ 30 unsigned int mtda:1; /* Loss of MT ctr. data alert */ 31 unsigned int caca:1; /* Counter auth. change alert */ 32 unsigned int lcda:1; /* Loss of counter data alert */ 33 }; 34 unsigned long flags; /* 0-63 All indicators */ 35 }; 36 /* 8 - 15 */ 37 unsigned int cfvn:16; /* 64-79 Ctr First Version */ 38 unsigned int csvn:16; /* 80-95 Ctr Second Version */ 39 unsigned int cpu_speed:32; /* 96-127 CPU speed */ 40 /* 16 - 23 */ 41 unsigned long timestamp; /* 128-191 Timestamp (TOD) */ 42 /* 24 - 55 */ 43 union { 44 struct { 45 unsigned long progusage1; 46 unsigned long progusage2; 47 unsigned long progusage3; 48 unsigned long tod_base; 49 }; 50 unsigned long progusage[4]; 51 }; 52 /* 56 - 63 */ 53 unsigned int mach_type:16; /* Machine type */ 54 unsigned int res1:16; /* Reserved */ 55 unsigned int res2:32; /* Reserved */ 56 }; 57 58 #define CPUMF_CTR_SET_BASIC 0 /* Basic Counter Set */ 59 #define CPUMF_CTR_SET_USER 1 /* Problem-State Counter Set */ 60 #define CPUMF_CTR_SET_CRYPTO 2 /* Crypto-Activity Counter Set */ 61 #define CPUMF_CTR_SET_EXT 3 /* Extended Counter Set */ 62 #define CPUMF_CTR_SET_MT_DIAG 4 /* MT-diagnostic Counter Set */ 63 #endif 64