1
0

sie.h 6.3 KB

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