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