162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Auxtrace support for s390 CPU measurement sampling facility
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci *  Copyright IBM Corp. 2018
662306a36Sopenharmony_ci *  Author(s): Hendrik Brueckner <brueckner@linux.ibm.com>
762306a36Sopenharmony_ci *	       Thomas Richter <tmricht@linux.ibm.com>
862306a36Sopenharmony_ci */
962306a36Sopenharmony_ci#ifndef S390_CPUMSF_KERNEL_H
1062306a36Sopenharmony_ci#define S390_CPUMSF_KERNEL_H
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#define	S390_CPUMSF_PAGESZ	4096	/* Size of sample block units */
1362306a36Sopenharmony_ci#define	S390_CPUMSF_DIAG_DEF_FIRST	0x8001	/* Diagnostic entry lowest id */
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_cistruct hws_basic_entry {
1662306a36Sopenharmony_ci	unsigned int def:16;	    /* 0-15  Data Entry Format		 */
1762306a36Sopenharmony_ci	unsigned int R:4;	    /* 16-19 reserved			 */
1862306a36Sopenharmony_ci	unsigned int U:4;	    /* 20-23 Number of unique instruct.  */
1962306a36Sopenharmony_ci	unsigned int z:2;	    /* zeros				 */
2062306a36Sopenharmony_ci	unsigned int T:1;	    /* 26 PSW DAT mode			 */
2162306a36Sopenharmony_ci	unsigned int W:1;	    /* 27 PSW wait state		 */
2262306a36Sopenharmony_ci	unsigned int P:1;	    /* 28 PSW Problem state		 */
2362306a36Sopenharmony_ci	unsigned int AS:2;	    /* 29-30 PSW address-space control	 */
2462306a36Sopenharmony_ci	unsigned int I:1;	    /* 31 entry valid or invalid	 */
2562306a36Sopenharmony_ci	unsigned int CL:2;	    /* 32-33 Configuration Level	 */
2662306a36Sopenharmony_ci	unsigned int:14;
2762306a36Sopenharmony_ci	unsigned int prim_asn:16;   /* primary ASN			 */
2862306a36Sopenharmony_ci	unsigned long long ia;	    /* Instruction Address		 */
2962306a36Sopenharmony_ci	unsigned long long gpp;     /* Guest Program Parameter		 */
3062306a36Sopenharmony_ci	unsigned long long hpp;     /* Host Program Parameter		 */
3162306a36Sopenharmony_ci};
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_cistruct hws_diag_entry {
3462306a36Sopenharmony_ci	unsigned int def:16;	    /* 0-15  Data Entry Format		 */
3562306a36Sopenharmony_ci	unsigned int R:15;	    /* 16-19 and 20-30 reserved		 */
3662306a36Sopenharmony_ci	unsigned int I:1;	    /* 31 entry valid or invalid	 */
3762306a36Sopenharmony_ci	u8	     data[];	    /* Machine-dependent sample data	 */
3862306a36Sopenharmony_ci};
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_cistruct hws_combined_entry {
4162306a36Sopenharmony_ci	struct hws_basic_entry	basic;	/* Basic-sampling data entry */
4262306a36Sopenharmony_ci	struct hws_diag_entry	diag;	/* Diagnostic-sampling data entry */
4362306a36Sopenharmony_ci};
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_cistruct hws_trailer_entry {
4662306a36Sopenharmony_ci	union {
4762306a36Sopenharmony_ci		struct {
4862306a36Sopenharmony_ci			unsigned int f:1;	/* 0 - Block Full Indicator   */
4962306a36Sopenharmony_ci			unsigned int a:1;	/* 1 - Alert request control  */
5062306a36Sopenharmony_ci			unsigned int t:1;	/* 2 - Timestamp format	      */
5162306a36Sopenharmony_ci			unsigned int:29;	/* 3 - 31: Reserved	      */
5262306a36Sopenharmony_ci			unsigned int bsdes:16;	/* 32-47: size of basic SDE   */
5362306a36Sopenharmony_ci			unsigned int dsdes:16;	/* 48-63: size of diagnostic SDE */
5462306a36Sopenharmony_ci		};
5562306a36Sopenharmony_ci		unsigned long long flags;	/* 0 - 64: All indicators     */
5662306a36Sopenharmony_ci	};
5762306a36Sopenharmony_ci	unsigned long long overflow;	 /* 64 - sample Overflow count	      */
5862306a36Sopenharmony_ci	unsigned char timestamp[16];	 /* 16 - 31 timestamp		      */
5962306a36Sopenharmony_ci	unsigned long long reserved1;	 /* 32 -Reserved		      */
6062306a36Sopenharmony_ci	unsigned long long reserved2;	 /*				      */
6162306a36Sopenharmony_ci	union {				 /* 48 - reserved for programming use */
6262306a36Sopenharmony_ci		struct {
6362306a36Sopenharmony_ci			unsigned long long clock_base:1; /* in progusage2 */
6462306a36Sopenharmony_ci			unsigned long long progusage1:63;
6562306a36Sopenharmony_ci			unsigned long long progusage2;
6662306a36Sopenharmony_ci		};
6762306a36Sopenharmony_ci		unsigned long long progusage[2];
6862306a36Sopenharmony_ci	};
6962306a36Sopenharmony_ci};
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci#endif
72