xref: /linux/tools/perf/util/s390-cpumcf-kernel.h (revision ec63e2a4897075e427c121d863bd89c44578094f)
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 
15 struct cf_ctrset_entry {	/* CPU-M CF counter set entry (8 byte) */
16 	unsigned int def:16;	/* 0-15  Data Entry Format */
17 	unsigned int set:16;	/* 16-23 Counter set identifier */
18 	unsigned int ctr:16;	/* 24-39 Number of stored counters */
19 	unsigned int res1:16;	/* 40-63 Reserved */
20 };
21 
22 struct cf_trailer_entry {	/* CPU-M CF trailer for raw traces (64 byte) */
23 	/* 0 - 7 */
24 	union {
25 		struct {
26 			unsigned int clock_base:1;	/* TOD clock base */
27 			unsigned int speed:1;		/* CPU speed */
28 			/* Measurement alerts */
29 			unsigned int mtda:1;	/* Loss of MT ctr. data alert */
30 			unsigned int caca:1;	/* Counter auth. change alert */
31 			unsigned int lcda:1;	/* Loss of counter data alert */
32 		};
33 		unsigned long flags;		/* 0-63    All indicators */
34 	};
35 	/* 8 - 15 */
36 	unsigned int cfvn:16;			/* 64-79   Ctr First Version */
37 	unsigned int csvn:16;			/* 80-95   Ctr Second Version */
38 	unsigned int cpu_speed:32;		/* 96-127  CPU speed */
39 	/* 16 - 23 */
40 	unsigned long timestamp;		/* 128-191 Timestamp (TOD) */
41 	/* 24 - 55 */
42 	union {
43 		struct {
44 			unsigned long progusage1;
45 			unsigned long progusage2;
46 			unsigned long progusage3;
47 			unsigned long tod_base;
48 		};
49 		unsigned long progusage[4];
50 	};
51 	/* 56 - 63 */
52 	unsigned int mach_type:16;		/* Machine type */
53 	unsigned int res1:16;			/* Reserved */
54 	unsigned int res2:32;			/* Reserved */
55 };
56 
57 #define	CPUMF_CTR_SET_BASIC	0	/* Basic Counter Set */
58 #define	CPUMF_CTR_SET_USER	1	/* Problem-State Counter Set */
59 #define	CPUMF_CTR_SET_CRYPTO	2	/* Crypto-Activity Counter Set */
60 #define	CPUMF_CTR_SET_EXT	3	/* Extended Counter Set */
61 #define	CPUMF_CTR_SET_MT_DIAG	4	/* MT-diagnostic Counter Set */
62 #endif
63