1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Support for s390 CPU measurement counter set diagnostic facility
5 * Copyright IBM Corp. 2019
6 Author(s): Hendrik Brueckner <brueckner@linux.ibm.com>
7 * Thomas Richter <tmricht@linux.ibm.com>
9 #ifndef S390_CPUMCF_KERNEL_H
10 #define S390_CPUMCF_KERNEL_H
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 */
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 */
23 struct cf_trailer_entry
{ /* CPU-M CF trailer for raw traces (64 byte) */
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 */
34 unsigned long flags
; /* 0-63 All indicators */
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 */
41 unsigned long timestamp
; /* 128-191 Timestamp (TOD) */
45 unsigned long progusage1
;
46 unsigned long progusage2
;
47 unsigned long progusage3
;
48 unsigned long tod_base
;
50 unsigned long progusage
[4];
53 unsigned int mach_type
:16; /* Machine type */
54 unsigned int res1
:16; /* Reserved */
55 unsigned int res2
:32; /* Reserved */
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 */