cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

sie.h (9469B)


      1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
      2#ifndef _UAPI_ASM_S390_SIE_H
      3#define _UAPI_ASM_S390_SIE_H
      4
      5#define diagnose_codes						\
      6	{ 0x10, "DIAG (0x10) release pages" },			\
      7	{ 0x44, "DIAG (0x44) time slice end" },			\
      8	{ 0x9c, "DIAG (0x9c) time slice end directed" },	\
      9	{ 0x204, "DIAG (0x204) logical-cpu utilization" },	\
     10	{ 0x258, "DIAG (0x258) page-reference services" },	\
     11	{ 0x288, "DIAG (0x288) watchdog functions" },		\
     12	{ 0x308, "DIAG (0x308) ipl functions" },		\
     13	{ 0x500, "DIAG (0x500) KVM virtio functions" },		\
     14	{ 0x501, "DIAG (0x501) KVM breakpoint" }
     15
     16#define sigp_order_codes					\
     17	{ 0x01, "SIGP sense" },					\
     18	{ 0x02, "SIGP external call" },				\
     19	{ 0x03, "SIGP emergency signal" },			\
     20	{ 0x04, "SIGP start" },					\
     21	{ 0x05, "SIGP stop" },					\
     22	{ 0x06, "SIGP restart" },				\
     23	{ 0x09, "SIGP stop and store status" },			\
     24	{ 0x0b, "SIGP initial cpu reset" },			\
     25	{ 0x0c, "SIGP cpu reset" },				\
     26	{ 0x0d, "SIGP set prefix" },				\
     27	{ 0x0e, "SIGP store status at address" },		\
     28	{ 0x12, "SIGP set architecture" },			\
     29	{ 0x13, "SIGP conditional emergency signal" },		\
     30	{ 0x15, "SIGP sense running" },				\
     31	{ 0x16, "SIGP set multithreading"},			\
     32	{ 0x17, "SIGP store additional status at address"}
     33
     34#define icpt_prog_codes						\
     35	{ 0x0001, "Prog Operation" },				\
     36	{ 0x0002, "Prog Privileged Operation" },		\
     37	{ 0x0003, "Prog Execute" },				\
     38	{ 0x0004, "Prog Protection" },				\
     39	{ 0x0005, "Prog Addressing" },				\
     40	{ 0x0006, "Prog Specification" },			\
     41	{ 0x0007, "Prog Data" },				\
     42	{ 0x0008, "Prog Fixedpoint overflow" },			\
     43	{ 0x0009, "Prog Fixedpoint divide" },			\
     44	{ 0x000A, "Prog Decimal overflow" },			\
     45	{ 0x000B, "Prog Decimal divide" },			\
     46	{ 0x000C, "Prog HFP exponent overflow" },		\
     47	{ 0x000D, "Prog HFP exponent underflow" },		\
     48	{ 0x000E, "Prog HFP significance" },			\
     49	{ 0x000F, "Prog HFP divide" },				\
     50	{ 0x0010, "Prog Segment translation" },			\
     51	{ 0x0011, "Prog Page translation" },			\
     52	{ 0x0012, "Prog Translation specification" },		\
     53	{ 0x0013, "Prog Special operation" },			\
     54	{ 0x0015, "Prog Operand" },				\
     55	{ 0x0016, "Prog Trace table" },				\
     56	{ 0x0017, "Prog ASNtranslation specification" },	\
     57	{ 0x001C, "Prog Spaceswitch event" },			\
     58	{ 0x001D, "Prog HFP square root" },			\
     59	{ 0x001F, "Prog PCtranslation specification" },		\
     60	{ 0x0020, "Prog AFX translation" },			\
     61	{ 0x0021, "Prog ASX translation" },			\
     62	{ 0x0022, "Prog LX translation" },			\
     63	{ 0x0023, "Prog EX translation" },			\
     64	{ 0x0024, "Prog Primary authority" },			\
     65	{ 0x0025, "Prog Secondary authority" },			\
     66	{ 0x0026, "Prog LFXtranslation exception" },		\
     67	{ 0x0027, "Prog LSXtranslation exception" },		\
     68	{ 0x0028, "Prog ALET specification" },			\
     69	{ 0x0029, "Prog ALEN translation" },			\
     70	{ 0x002A, "Prog ALE sequence" },			\
     71	{ 0x002B, "Prog ASTE validity" },			\
     72	{ 0x002C, "Prog ASTE sequence" },			\
     73	{ 0x002D, "Prog Extended authority" },			\
     74	{ 0x002E, "Prog LSTE sequence" },			\
     75	{ 0x002F, "Prog ASTE instance" },			\
     76	{ 0x0030, "Prog Stack full" },				\
     77	{ 0x0031, "Prog Stack empty" },				\
     78	{ 0x0032, "Prog Stack specification" },			\
     79	{ 0x0033, "Prog Stack type" },				\
     80	{ 0x0034, "Prog Stack operation" },			\
     81	{ 0x0039, "Prog Region first translation" },		\
     82	{ 0x003A, "Prog Region second translation" },		\
     83	{ 0x003B, "Prog Region third translation" },		\
     84	{ 0x0040, "Prog Monitor event" },			\
     85	{ 0x0080, "Prog PER event" },				\
     86	{ 0x0119, "Prog Crypto operation" }
     87
     88#define exit_code_ipa0(ipa0, opcode, mnemonic)		\
     89	{ (ipa0 << 8 | opcode), #ipa0 " " mnemonic }
     90#define exit_code(opcode, mnemonic)			\
     91	{ opcode, mnemonic }
     92
     93#define icpt_insn_codes				\
     94	exit_code_ipa0(0x01, 0x01, "PR"),	\
     95	exit_code_ipa0(0x01, 0x04, "PTFF"),	\
     96	exit_code_ipa0(0x01, 0x07, "SCKPF"),	\
     97	exit_code_ipa0(0xAA, 0x00, "RINEXT"),	\
     98	exit_code_ipa0(0xAA, 0x01, "RION"),	\
     99	exit_code_ipa0(0xAA, 0x02, "TRIC"),	\
    100	exit_code_ipa0(0xAA, 0x03, "RIOFF"),	\
    101	exit_code_ipa0(0xAA, 0x04, "RIEMIT"),	\
    102	exit_code_ipa0(0xB2, 0x02, "STIDP"),	\
    103	exit_code_ipa0(0xB2, 0x04, "SCK"),	\
    104	exit_code_ipa0(0xB2, 0x05, "STCK"),	\
    105	exit_code_ipa0(0xB2, 0x06, "SCKC"),	\
    106	exit_code_ipa0(0xB2, 0x07, "STCKC"),	\
    107	exit_code_ipa0(0xB2, 0x08, "SPT"),	\
    108	exit_code_ipa0(0xB2, 0x09, "STPT"),	\
    109	exit_code_ipa0(0xB2, 0x0d, "PTLB"),	\
    110	exit_code_ipa0(0xB2, 0x10, "SPX"),	\
    111	exit_code_ipa0(0xB2, 0x11, "STPX"),	\
    112	exit_code_ipa0(0xB2, 0x12, "STAP"),	\
    113	exit_code_ipa0(0xB2, 0x14, "SIE"),	\
    114	exit_code_ipa0(0xB2, 0x16, "SETR"),	\
    115	exit_code_ipa0(0xB2, 0x17, "STETR"),	\
    116	exit_code_ipa0(0xB2, 0x18, "PC"),	\
    117	exit_code_ipa0(0xB2, 0x20, "SERVC"),	\
    118	exit_code_ipa0(0xB2, 0x21, "IPTE"),	\
    119	exit_code_ipa0(0xB2, 0x28, "PT"),	\
    120	exit_code_ipa0(0xB2, 0x29, "ISKE"),	\
    121	exit_code_ipa0(0xB2, 0x2a, "RRBE"),	\
    122	exit_code_ipa0(0xB2, 0x2b, "SSKE"),	\
    123	exit_code_ipa0(0xB2, 0x2c, "TB"),	\
    124	exit_code_ipa0(0xB2, 0x2e, "PGIN"),	\
    125	exit_code_ipa0(0xB2, 0x2f, "PGOUT"),	\
    126	exit_code_ipa0(0xB2, 0x30, "CSCH"),	\
    127	exit_code_ipa0(0xB2, 0x31, "HSCH"),	\
    128	exit_code_ipa0(0xB2, 0x32, "MSCH"),	\
    129	exit_code_ipa0(0xB2, 0x33, "SSCH"),	\
    130	exit_code_ipa0(0xB2, 0x34, "STSCH"),	\
    131	exit_code_ipa0(0xB2, 0x35, "TSCH"),	\
    132	exit_code_ipa0(0xB2, 0x36, "TPI"),	\
    133	exit_code_ipa0(0xB2, 0x37, "SAL"),	\
    134	exit_code_ipa0(0xB2, 0x38, "RSCH"),	\
    135	exit_code_ipa0(0xB2, 0x39, "STCRW"),	\
    136	exit_code_ipa0(0xB2, 0x3a, "STCPS"),	\
    137	exit_code_ipa0(0xB2, 0x3b, "RCHP"),	\
    138	exit_code_ipa0(0xB2, 0x3c, "SCHM"),	\
    139	exit_code_ipa0(0xB2, 0x40, "BAKR"),	\
    140	exit_code_ipa0(0xB2, 0x48, "PALB"),	\
    141	exit_code_ipa0(0xB2, 0x4c, "TAR"),	\
    142	exit_code_ipa0(0xB2, 0x50, "CSP"),	\
    143	exit_code_ipa0(0xB2, 0x54, "MVPG"),	\
    144	exit_code_ipa0(0xB2, 0x56, "STHYI"),	\
    145	exit_code_ipa0(0xB2, 0x58, "BSG"),	\
    146	exit_code_ipa0(0xB2, 0x5a, "BSA"),	\
    147	exit_code_ipa0(0xB2, 0x5f, "CHSC"),	\
    148	exit_code_ipa0(0xB2, 0x74, "SIGA"),	\
    149	exit_code_ipa0(0xB2, 0x76, "XSCH"),	\
    150	exit_code_ipa0(0xB2, 0x78, "STCKE"),	\
    151	exit_code_ipa0(0xB2, 0x7c, "STCKF"),	\
    152	exit_code_ipa0(0xB2, 0x7d, "STSI"),	\
    153	exit_code_ipa0(0xB2, 0xb0, "STFLE"),	\
    154	exit_code_ipa0(0xB2, 0xb1, "STFL"),	\
    155	exit_code_ipa0(0xB2, 0xb2, "LPSWE"),	\
    156	exit_code_ipa0(0xB2, 0xf8, "TEND"),	\
    157	exit_code_ipa0(0xB2, 0xfc, "TABORT"),	\
    158	exit_code_ipa0(0xB9, 0x1e, "KMAC"),	\
    159	exit_code_ipa0(0xB9, 0x28, "PCKMO"),	\
    160	exit_code_ipa0(0xB9, 0x2a, "KMF"),	\
    161	exit_code_ipa0(0xB9, 0x2b, "KMO"),	\
    162	exit_code_ipa0(0xB9, 0x2d, "KMCTR"),	\
    163	exit_code_ipa0(0xB9, 0x2e, "KM"),	\
    164	exit_code_ipa0(0xB9, 0x2f, "KMC"),	\
    165	exit_code_ipa0(0xB9, 0x3e, "KIMD"),	\
    166	exit_code_ipa0(0xB9, 0x3f, "KLMD"),	\
    167	exit_code_ipa0(0xB9, 0x8a, "CSPG"),	\
    168	exit_code_ipa0(0xB9, 0x8d, "EPSW"),	\
    169	exit_code_ipa0(0xB9, 0x8e, "IDTE"),	\
    170	exit_code_ipa0(0xB9, 0x8f, "CRDTE"),	\
    171	exit_code_ipa0(0xB9, 0x9c, "EQBS"),	\
    172	exit_code_ipa0(0xB9, 0xa2, "PTF"),	\
    173	exit_code_ipa0(0xB9, 0xab, "ESSA"),	\
    174	exit_code_ipa0(0xB9, 0xae, "RRBM"),	\
    175	exit_code_ipa0(0xB9, 0xaf, "PFMF"),	\
    176	exit_code_ipa0(0xE3, 0x03, "LRAG"),	\
    177	exit_code_ipa0(0xE3, 0x13, "LRAY"),	\
    178	exit_code_ipa0(0xE3, 0x25, "NTSTG"),	\
    179	exit_code_ipa0(0xE5, 0x00, "LASP"),	\
    180	exit_code_ipa0(0xE5, 0x01, "TPROT"),	\
    181	exit_code_ipa0(0xE5, 0x60, "TBEGIN"),	\
    182	exit_code_ipa0(0xE5, 0x61, "TBEGINC"),	\
    183	exit_code_ipa0(0xEB, 0x25, "STCTG"),	\
    184	exit_code_ipa0(0xEB, 0x2f, "LCTLG"),	\
    185	exit_code_ipa0(0xEB, 0x60, "LRIC"),	\
    186	exit_code_ipa0(0xEB, 0x61, "STRIC"),	\
    187	exit_code_ipa0(0xEB, 0x62, "MRIC"),	\
    188	exit_code_ipa0(0xEB, 0x8a, "SQBS"),	\
    189	exit_code_ipa0(0xC8, 0x01, "ECTG"),	\
    190	exit_code(0x0a, "SVC"),			\
    191	exit_code(0x80, "SSM"),			\
    192	exit_code(0x82, "LPSW"),		\
    193	exit_code(0x83, "DIAG"),		\
    194	exit_code(0xae, "SIGP"),		\
    195	exit_code(0xac, "STNSM"),		\
    196	exit_code(0xad, "STOSM"),		\
    197	exit_code(0xb1, "LRA"),			\
    198	exit_code(0xb6, "STCTL"),		\
    199	exit_code(0xb7, "LCTL"),		\
    200	exit_code(0xee, "PLO")
    201
    202#define sie_intercept_code					\
    203	{ 0x00, "Host interruption" },				\
    204	{ 0x04, "Instruction" },				\
    205	{ 0x08, "Program interruption" },			\
    206	{ 0x0c, "Instruction and program interruption" },	\
    207	{ 0x10, "External request" },				\
    208	{ 0x14, "External interruption" },			\
    209	{ 0x18, "I/O request" },				\
    210	{ 0x1c, "Wait state" },					\
    211	{ 0x20, "Validity" },					\
    212	{ 0x28, "Stop request" },				\
    213	{ 0x2c, "Operation exception" },			\
    214	{ 0x38, "Partial-execution" },				\
    215	{ 0x3c, "I/O interruption" },				\
    216	{ 0x40, "I/O instruction" },				\
    217	{ 0x48, "Timing subset" }
    218
    219/*
    220 * This is the simple interceptable instructions decoder.
    221 *
    222 * It will be used as userspace interface and it can be used in places
    223 * that does not allow to use general decoder functions,
    224 * such as trace events declarations.
    225 *
    226 * Some userspace tools may want to parse this code
    227 * and would be confused by switch(), if() and other statements,
    228 * but they can understand conditional operator.
    229 */
    230#define INSN_DECODE_IPA0(ipa0, insn, rshift, mask)		\
    231	(insn >> 56) == (ipa0) ?				\
    232		((ipa0 << 8) | ((insn >> rshift) & mask)) :
    233
    234#define INSN_DECODE(insn) (insn >> 56)
    235
    236/*
    237 * The macro icpt_insn_decoder() takes an intercepted instruction
    238 * and returns a key, which can be used to find a mnemonic name
    239 * of the instruction in the icpt_insn_codes table.
    240 */
    241#define icpt_insn_decoder(insn) (		\
    242	INSN_DECODE_IPA0(0x01, insn, 48, 0xff)	\
    243	INSN_DECODE_IPA0(0xaa, insn, 48, 0x0f)	\
    244	INSN_DECODE_IPA0(0xb2, insn, 48, 0xff)	\
    245	INSN_DECODE_IPA0(0xb9, insn, 48, 0xff)	\
    246	INSN_DECODE_IPA0(0xe3, insn, 48, 0xff)	\
    247	INSN_DECODE_IPA0(0xe5, insn, 48, 0xff)	\
    248	INSN_DECODE_IPA0(0xeb, insn, 16, 0xff)	\
    249	INSN_DECODE_IPA0(0xc8, insn, 48, 0x0f)	\
    250	INSN_DECODE(insn))
    251
    252#endif /* _UAPI_ASM_S390_SIE_H */