1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Definition for kernel virtual machines on s390. 4 * 5 * Adapted copy of struct definition kvm_s390_sie_block from 6 * arch/s390/include/asm/kvm_host.h for use in userspace selftest programs. 7 * 8 * Copyright IBM Corp. 2008, 2024 9 * 10 * Authors: 11 * Christoph Schlameuss <schlameuss@linux.ibm.com> 12 * Carsten Otte <cotte@de.ibm.com> 13 */ 14 15 #ifndef SELFTEST_KVM_SIE_H 16 #define SELFTEST_KVM_SIE_H 17 18 #include <linux/types.h> 19 20 struct kvm_s390_sie_block { 21 #define CPUSTAT_STOPPED 0x80000000 22 #define CPUSTAT_WAIT 0x10000000 23 #define CPUSTAT_ECALL_PEND 0x08000000 24 #define CPUSTAT_STOP_INT 0x04000000 25 #define CPUSTAT_IO_INT 0x02000000 26 #define CPUSTAT_EXT_INT 0x01000000 27 #define CPUSTAT_RUNNING 0x00800000 28 #define CPUSTAT_RETAINED 0x00400000 29 #define CPUSTAT_TIMING_SUB 0x00020000 30 #define CPUSTAT_SIE_SUB 0x00010000 31 #define CPUSTAT_RRF 0x00008000 32 #define CPUSTAT_SLSV 0x00004000 33 #define CPUSTAT_SLSR 0x00002000 34 #define CPUSTAT_ZARCH 0x00000800 35 #define CPUSTAT_MCDS 0x00000100 36 #define CPUSTAT_KSS 0x00000200 37 #define CPUSTAT_SM 0x00000080 38 #define CPUSTAT_IBS 0x00000040 39 #define CPUSTAT_GED2 0x00000010 40 #define CPUSTAT_G 0x00000008 41 #define CPUSTAT_GED 0x00000004 42 #define CPUSTAT_J 0x00000002 43 #define CPUSTAT_P 0x00000001 44 __u32 cpuflags; /* 0x0000 */ 45 __u32: 1; /* 0x0004 */ 46 __u32 prefix : 18; 47 __u32: 1; 48 __u32 ibc : 12; 49 __u8 reserved08[4]; /* 0x0008 */ 50 #define PROG_IN_SIE BIT(0) 51 __u32 prog0c; /* 0x000c */ 52 union { 53 __u8 reserved10[16]; /* 0x0010 */ 54 struct { 55 __u64 pv_handle_cpu; 56 __u64 pv_handle_config; 57 }; 58 }; 59 #define PROG_BLOCK_SIE BIT(0) 60 #define PROG_REQUEST BIT(1) 61 __u32 prog20; /* 0x0020 */ 62 __u8 reserved24[4]; /* 0x0024 */ 63 __u64 cputm; /* 0x0028 */ 64 __u64 ckc; /* 0x0030 */ 65 __u64 epoch; /* 0x0038 */ 66 __u32 svcc; /* 0x0040 */ 67 #define LCTL_CR0 0x8000 68 #define LCTL_CR6 0x0200 69 #define LCTL_CR9 0x0040 70 #define LCTL_CR10 0x0020 71 #define LCTL_CR11 0x0010 72 #define LCTL_CR14 0x0002 73 __u16 lctl; /* 0x0044 */ 74 __s16 icpua; /* 0x0046 */ 75 #define ICTL_OPEREXC 0x80000000 76 #define ICTL_PINT 0x20000000 77 #define ICTL_LPSW 0x00400000 78 #define ICTL_STCTL 0x00040000 79 #define ICTL_ISKE 0x00004000 80 #define ICTL_SSKE 0x00002000 81 #define ICTL_RRBE 0x00001000 82 #define ICTL_TPROT 0x00000200 83 __u32 ictl; /* 0x0048 */ 84 #define ECA_CEI 0x80000000 85 #define ECA_IB 0x40000000 86 #define ECA_SIGPI 0x10000000 87 #define ECA_MVPGI 0x01000000 88 #define ECA_AIV 0x00200000 89 #define ECA_VX 0x00020000 90 #define ECA_PROTEXCI 0x00002000 91 #define ECA_APIE 0x00000008 92 #define ECA_SII 0x00000001 93 __u32 eca; /* 0x004c */ 94 #define ICPT_INST 0x04 95 #define ICPT_PROGI 0x08 96 #define ICPT_INSTPROGI 0x0C 97 #define ICPT_EXTREQ 0x10 98 #define ICPT_EXTINT 0x14 99 #define ICPT_IOREQ 0x18 100 #define ICPT_WAIT 0x1c 101 #define ICPT_VALIDITY 0x20 102 #define ICPT_STOP 0x28 103 #define ICPT_OPEREXC 0x2C 104 #define ICPT_PARTEXEC 0x38 105 #define ICPT_IOINST 0x40 106 #define ICPT_KSS 0x5c 107 #define ICPT_MCHKREQ 0x60 108 #define ICPT_INT_ENABLE 0x64 109 #define ICPT_PV_INSTR 0x68 110 #define ICPT_PV_NOTIFY 0x6c 111 #define ICPT_PV_PREF 0x70 112 __u8 icptcode; /* 0x0050 */ 113 __u8 icptstatus; /* 0x0051 */ 114 __u16 ihcpu; /* 0x0052 */ 115 __u8 reserved54; /* 0x0054 */ 116 #define IICTL_CODE_NONE 0x00 117 #define IICTL_CODE_MCHK 0x01 118 #define IICTL_CODE_EXT 0x02 119 #define IICTL_CODE_IO 0x03 120 #define IICTL_CODE_RESTART 0x04 121 #define IICTL_CODE_SPECIFICATION 0x10 122 #define IICTL_CODE_OPERAND 0x11 123 __u8 iictl; /* 0x0055 */ 124 __u16 ipa; /* 0x0056 */ 125 __u32 ipb; /* 0x0058 */ 126 __u32 scaoh; /* 0x005c */ 127 #define FPF_BPBC 0x20 128 __u8 fpf; /* 0x0060 */ 129 #define ECB_GS 0x40 130 #define ECB_TE 0x10 131 #define ECB_SPECI 0x08 132 #define ECB_SRSI 0x04 133 #define ECB_HOSTPROTINT 0x02 134 #define ECB_PTF 0x01 135 __u8 ecb; /* 0x0061 */ 136 #define ECB2_CMMA 0x80 137 #define ECB2_IEP 0x20 138 #define ECB2_PFMFI 0x08 139 #define ECB2_ESCA 0x04 140 #define ECB2_ZPCI_LSI 0x02 141 __u8 ecb2; /* 0x0062 */ 142 #define ECB3_AISI 0x20 143 #define ECB3_AISII 0x10 144 #define ECB3_DEA 0x08 145 #define ECB3_AES 0x04 146 #define ECB3_RI 0x01 147 __u8 ecb3; /* 0x0063 */ 148 #define ESCA_SCAOL_MASK ~0x3fU 149 __u32 scaol; /* 0x0064 */ 150 __u8 sdf; /* 0x0068 */ 151 __u8 epdx; /* 0x0069 */ 152 __u8 cpnc; /* 0x006a */ 153 __u8 reserved6b; /* 0x006b */ 154 __u32 todpr; /* 0x006c */ 155 #define GISA_FORMAT1 0x00000001 156 __u32 gd; /* 0x0070 */ 157 __u8 reserved74[12]; /* 0x0074 */ 158 __u64 mso; /* 0x0080 */ 159 __u64 msl; /* 0x0088 */ 160 __u64 psw_mask; /* 0x0090 */ 161 __u64 psw_addr; /* 0x0098 */ 162 __u64 gg14; /* 0x00a0 */ 163 __u64 gg15; /* 0x00a8 */ 164 __u8 reservedb0[8]; /* 0x00b0 */ 165 #define HPID_KVM 0x4 166 #define HPID_VSIE 0x5 167 __u8 hpid; /* 0x00b8 */ 168 __u8 reservedb9[7]; /* 0x00b9 */ 169 union { 170 struct { 171 __u32 eiparams; /* 0x00c0 */ 172 __u16 extcpuaddr; /* 0x00c4 */ 173 __u16 eic; /* 0x00c6 */ 174 }; 175 __u64 mcic; /* 0x00c0 */ 176 } __packed; 177 __u32 reservedc8; /* 0x00c8 */ 178 union { 179 struct { 180 __u16 pgmilc; /* 0x00cc */ 181 __u16 iprcc; /* 0x00ce */ 182 }; 183 __u32 edc; /* 0x00cc */ 184 } __packed; 185 union { 186 struct { 187 __u32 dxc; /* 0x00d0 */ 188 __u16 mcn; /* 0x00d4 */ 189 __u8 perc; /* 0x00d6 */ 190 __u8 peratmid; /* 0x00d7 */ 191 }; 192 __u64 faddr; /* 0x00d0 */ 193 } __packed; 194 __u64 peraddr; /* 0x00d8 */ 195 __u8 eai; /* 0x00e0 */ 196 __u8 peraid; /* 0x00e1 */ 197 __u8 oai; /* 0x00e2 */ 198 __u8 armid; /* 0x00e3 */ 199 __u8 reservede4[4]; /* 0x00e4 */ 200 union { 201 __u64 tecmc; /* 0x00e8 */ 202 struct { 203 __u16 subchannel_id; /* 0x00e8 */ 204 __u16 subchannel_nr; /* 0x00ea */ 205 __u32 io_int_parm; /* 0x00ec */ 206 __u32 io_int_word; /* 0x00f0 */ 207 }; 208 } __packed; 209 __u8 reservedf4[8]; /* 0x00f4 */ 210 #define CRYCB_FORMAT_MASK 0x00000003 211 #define CRYCB_FORMAT0 0x00000000 212 #define CRYCB_FORMAT1 0x00000001 213 #define CRYCB_FORMAT2 0x00000003 214 __u32 crycbd; /* 0x00fc */ 215 __u64 gcr[16]; /* 0x0100 */ 216 union { 217 __u64 gbea; /* 0x0180 */ 218 __u64 sidad; 219 }; 220 __u8 reserved188[8]; /* 0x0188 */ 221 __u64 sdnxo; /* 0x0190 */ 222 __u8 reserved198[8]; /* 0x0198 */ 223 __u32 fac; /* 0x01a0 */ 224 __u8 reserved1a4[20]; /* 0x01a4 */ 225 __u64 cbrlo; /* 0x01b8 */ 226 __u8 reserved1c0[8]; /* 0x01c0 */ 227 #define ECD_HOSTREGMGMT 0x20000000 228 #define ECD_MEF 0x08000000 229 #define ECD_ETOKENF 0x02000000 230 #define ECD_ECC 0x00200000 231 __u32 ecd; /* 0x01c8 */ 232 __u8 reserved1cc[18]; /* 0x01cc */ 233 __u64 pp; /* 0x01de */ 234 __u8 reserved1e6[2]; /* 0x01e6 */ 235 __u64 itdba; /* 0x01e8 */ 236 __u64 riccbd; /* 0x01f0 */ 237 __u64 gvrd; /* 0x01f8 */ 238 } __packed __aligned(512); 239 240 #endif /* SELFTEST_KVM_SIE_H */ 241