1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Auxtrace support for s390 CPU measurement sampling facility
4  *
5  *  Copyright IBM Corp. 2018
6  *  Author(s): Hendrik Brueckner <brueckner@linux.ibm.com>
7  *	       Thomas Richter <tmricht@linux.ibm.com>
8  */
9 #ifndef S390_CPUMSF_KERNEL_H
10 #define S390_CPUMSF_KERNEL_H
11 
12 #define	S390_CPUMSF_PAGESZ	4096	/* Size of sample block units */
13 #define	S390_CPUMSF_DIAG_DEF_FIRST	0x8001	/* Diagnostic entry lowest id */
14 
15 struct hws_basic_entry {
16 	unsigned int def:16;	    /* 0-15  Data Entry Format		 */
17 	unsigned int R:4;	    /* 16-19 reserved			 */
18 	unsigned int U:4;	    /* 20-23 Number of unique instruct.  */
19 	unsigned int z:2;	    /* zeros				 */
20 	unsigned int T:1;	    /* 26 PSW DAT mode			 */
21 	unsigned int W:1;	    /* 27 PSW wait state		 */
22 	unsigned int P:1;	    /* 28 PSW Problem state		 */
23 	unsigned int AS:2;	    /* 29-30 PSW address-space control	 */
24 	unsigned int I:1;	    /* 31 entry valid or invalid	 */
25 	unsigned int CL:2;	    /* 32-33 Configuration Level	 */
26 	unsigned int:14;
27 	unsigned int prim_asn:16;   /* primary ASN			 */
28 	unsigned long long ia;	    /* Instruction Address		 */
29 	unsigned long long gpp;     /* Guest Program Parameter		 */
30 	unsigned long long hpp;     /* Host Program Parameter		 */
31 };
32 
33 struct hws_diag_entry {
34 	unsigned int def:16;	    /* 0-15  Data Entry Format		 */
35 	unsigned int R:15;	    /* 16-19 and 20-30 reserved		 */
36 	unsigned int I:1;	    /* 31 entry valid or invalid	 */
37 	u8	     data[];	    /* Machine-dependent sample data	 */
38 };
39 
40 struct hws_combined_entry {
41 	struct hws_basic_entry	basic;	/* Basic-sampling data entry */
42 	struct hws_diag_entry	diag;	/* Diagnostic-sampling data entry */
43 };
44 
45 struct hws_trailer_entry {
46 	union {
47 		struct {
48 			unsigned int f:1;	/* 0 - Block Full Indicator   */
49 			unsigned int a:1;	/* 1 - Alert request control  */
50 			unsigned int t:1;	/* 2 - Timestamp format	      */
51 			unsigned int:29;	/* 3 - 31: Reserved	      */
52 			unsigned int bsdes:16;	/* 32-47: size of basic SDE   */
53 			unsigned int dsdes:16;	/* 48-63: size of diagnostic SDE */
54 		};
55 		unsigned long long flags;	/* 0 - 64: All indicators     */
56 	};
57 	unsigned long long overflow;	 /* 64 - sample Overflow count	      */
58 	unsigned char timestamp[16];	 /* 16 - 31 timestamp		      */
59 	unsigned long long reserved1;	 /* 32 -Reserved		      */
60 	unsigned long long reserved2;	 /*				      */
61 	union {				 /* 48 - reserved for programming use */
62 		struct {
63 			unsigned long long clock_base:1; /* in progusage2 */
64 			unsigned long long progusage1:63;
65 			unsigned long long progusage2;
66 		};
67 		unsigned long long progusage[2];
68 	};
69 };
70 
71 #endif
72