blob: 2a89638fcab521cf04d5df1c32603f3632972713 [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Ben Cheng655a7c02013-10-16 16:09:24 -07007#ifndef __LINUX_KVM_H
8#define __LINUX_KVM_H
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +00009#include <linux/const.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070010#include <linux/types.h>
11#include <linux/compiler.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070012#include <linux/ioctl.h>
13#include <asm/kvm.h>
14#define KVM_API_VERSION 12
15#define KVM_TRC_SHIFT 16
Ben Cheng655a7c02013-10-16 16:09:24 -070016#define KVM_TRC_ENTRYEXIT (1 << KVM_TRC_SHIFT)
17#define KVM_TRC_HANDLER (1 << (KVM_TRC_SHIFT + 1))
18#define KVM_TRC_VMENTRY (KVM_TRC_ENTRYEXIT + 0x01)
19#define KVM_TRC_VMEXIT (KVM_TRC_ENTRYEXIT + 0x02)
Ben Cheng655a7c02013-10-16 16:09:24 -070020#define KVM_TRC_PAGE_FAULT (KVM_TRC_HANDLER + 0x01)
21#define KVM_TRC_HEAD_SIZE 12
22#define KVM_TRC_CYCLE_SIZE 8
23#define KVM_TRC_EXTRA_MAX 7
Ben Cheng655a7c02013-10-16 16:09:24 -070024#define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02)
25#define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03)
26#define KVM_TRC_PEND_INTR (KVM_TRC_HANDLER + 0x04)
27#define KVM_TRC_IO_READ (KVM_TRC_HANDLER + 0x05)
Ben Cheng655a7c02013-10-16 16:09:24 -070028#define KVM_TRC_IO_WRITE (KVM_TRC_HANDLER + 0x06)
29#define KVM_TRC_CR_READ (KVM_TRC_HANDLER + 0x07)
30#define KVM_TRC_CR_WRITE (KVM_TRC_HANDLER + 0x08)
31#define KVM_TRC_DR_READ (KVM_TRC_HANDLER + 0x09)
Ben Cheng655a7c02013-10-16 16:09:24 -070032#define KVM_TRC_DR_WRITE (KVM_TRC_HANDLER + 0x0A)
33#define KVM_TRC_MSR_READ (KVM_TRC_HANDLER + 0x0B)
34#define KVM_TRC_MSR_WRITE (KVM_TRC_HANDLER + 0x0C)
35#define KVM_TRC_CPUID (KVM_TRC_HANDLER + 0x0D)
Ben Cheng655a7c02013-10-16 16:09:24 -070036#define KVM_TRC_INTR (KVM_TRC_HANDLER + 0x0E)
37#define KVM_TRC_NMI (KVM_TRC_HANDLER + 0x0F)
38#define KVM_TRC_VMMCALL (KVM_TRC_HANDLER + 0x10)
39#define KVM_TRC_HLT (KVM_TRC_HANDLER + 0x11)
Ben Cheng655a7c02013-10-16 16:09:24 -070040#define KVM_TRC_CLTS (KVM_TRC_HANDLER + 0x12)
41#define KVM_TRC_LMSW (KVM_TRC_HANDLER + 0x13)
42#define KVM_TRC_APIC_ACCESS (KVM_TRC_HANDLER + 0x14)
43#define KVM_TRC_TDP_FAULT (KVM_TRC_HANDLER + 0x15)
Ben Cheng655a7c02013-10-16 16:09:24 -070044#define KVM_TRC_GTLB_WRITE (KVM_TRC_HANDLER + 0x16)
45#define KVM_TRC_STLB_WRITE (KVM_TRC_HANDLER + 0x17)
46#define KVM_TRC_STLB_INVAL (KVM_TRC_HANDLER + 0x18)
47#define KVM_TRC_PPC_INSTR (KVM_TRC_HANDLER + 0x19)
Ben Cheng655a7c02013-10-16 16:09:24 -070048struct kvm_user_trace_setup {
Tao Baod7db5942015-01-28 10:07:51 -080049 __u32 buf_size;
50 __u32 buf_nr;
Ben Cheng655a7c02013-10-16 16:09:24 -070051};
Tao Baod7db5942015-01-28 10:07:51 -080052#define __KVM_DEPRECATED_MAIN_W_0x06 _IOW(KVMIO, 0x06, struct kvm_user_trace_setup)
Ben Cheng655a7c02013-10-16 16:09:24 -070053#define __KVM_DEPRECATED_MAIN_0x07 _IO(KVMIO, 0x07)
54#define __KVM_DEPRECATED_MAIN_0x08 _IO(KVMIO, 0x08)
55#define __KVM_DEPRECATED_VM_R_0x70 _IOR(KVMIO, 0x70, struct kvm_assigned_irq)
Ben Cheng655a7c02013-10-16 16:09:24 -070056struct kvm_breakpoint {
Tao Baod7db5942015-01-28 10:07:51 -080057 __u32 enabled;
58 __u32 padding;
59 __u64 address;
Ben Cheng655a7c02013-10-16 16:09:24 -070060};
61struct kvm_debug_guest {
Tao Baod7db5942015-01-28 10:07:51 -080062 __u32 enabled;
63 __u32 pad;
Tao Baod7db5942015-01-28 10:07:51 -080064 struct kvm_breakpoint breakpoints[4];
65 __u32 singlestep;
Ben Cheng655a7c02013-10-16 16:09:24 -070066};
67#define __KVM_DEPRECATED_VCPU_W_0x87 _IOW(KVMIO, 0x87, struct kvm_debug_guest)
Ben Cheng655a7c02013-10-16 16:09:24 -070068struct kvm_userspace_memory_region {
Tao Baod7db5942015-01-28 10:07:51 -080069 __u32 slot;
Tao Baod7db5942015-01-28 10:07:51 -080070 __u32 flags;
71 __u64 guest_phys_addr;
72 __u64 memory_size;
73 __u64 userspace_addr;
Ben Cheng655a7c02013-10-16 16:09:24 -070074};
75#define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0)
76#define KVM_MEM_READONLY (1UL << 1)
77struct kvm_irq_level {
Tao Baod7db5942015-01-28 10:07:51 -080078 union {
79 __u32 irq;
80 __s32 status;
81 };
Tao Baod7db5942015-01-28 10:07:51 -080082 __u32 level;
Ben Cheng655a7c02013-10-16 16:09:24 -070083};
84struct kvm_irqchip {
Tao Baod7db5942015-01-28 10:07:51 -080085 __u32 chip_id;
Tao Baod7db5942015-01-28 10:07:51 -080086 __u32 pad;
87 union {
88 char dummy[512];
Ben Cheng655a7c02013-10-16 16:09:24 -070089#ifdef __KVM_HAVE_PIT
Tao Baod7db5942015-01-28 10:07:51 -080090 struct kvm_pic_state pic;
Ben Cheng655a7c02013-10-16 16:09:24 -070091#endif
92#ifdef __KVM_HAVE_IOAPIC
Tao Baod7db5942015-01-28 10:07:51 -080093 struct kvm_ioapic_state ioapic;
Ben Cheng655a7c02013-10-16 16:09:24 -070094#endif
Tao Baod7db5942015-01-28 10:07:51 -080095 } chip;
Ben Cheng655a7c02013-10-16 16:09:24 -070096};
97struct kvm_pit_config {
Tao Baod7db5942015-01-28 10:07:51 -080098 __u32 flags;
99 __u32 pad[15];
Ben Cheng655a7c02013-10-16 16:09:24 -0700100};
101#define KVM_PIT_SPEAKER_DUMMY 1
Christopher Ferris05d08e92016-02-04 13:16:38 -0800102struct kvm_s390_skeys {
103 __u64 start_gfn;
104 __u64 count;
105 __u64 skeydata_addr;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800106 __u32 flags;
107 __u32 reserved[9];
108};
Christopher Ferris1308ad32017-11-14 17:32:13 -0800109#define KVM_S390_CMMA_PEEK (1 << 0)
110struct kvm_s390_cmma_log {
111 __u64 start_gfn;
112 __u32 count;
113 __u32 flags;
114 union {
115 __u64 remaining;
116 __u64 mask;
117 };
118 __u64 values;
119};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700120struct kvm_hyperv_exit {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700121#define KVM_EXIT_HYPERV_SYNIC 1
122#define KVM_EXIT_HYPERV_HCALL 2
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700123#define KVM_EXIT_HYPERV_SYNDBG 3
Christopher Ferris106b3a82016-08-24 12:15:38 -0700124 __u32 type;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700125 __u32 pad1;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700126 union {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700127 struct {
128 __u32 msr;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700129 __u32 pad2;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700130 __u64 control;
131 __u64 evt_page;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700132 __u64 msg_page;
133 } synic;
134 struct {
135 __u64 input;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700136 __u64 result;
137 __u64 params[2];
138 } hcall;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700139 struct {
140 __u32 msr;
141 __u32 pad2;
142 __u64 control;
143 __u64 status;
144 __u64 send_page;
145 __u64 recv_page;
146 __u64 pending_page;
147 } syndbg;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700148 } u;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700149};
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700150struct kvm_xen_exit {
151#define KVM_EXIT_XEN_HCALL 1
152 __u32 type;
153 union {
154 struct {
155 __u32 longmode;
156 __u32 cpl;
157 __u64 input;
158 __u64 result;
159 __u64 params[6];
160 } hcall;
161 } u;
162};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700163#define KVM_S390_GET_SKEYS_NONE 1
Christopher Ferris05d08e92016-02-04 13:16:38 -0800164#define KVM_S390_SKEYS_MAX 1048576
Ben Cheng655a7c02013-10-16 16:09:24 -0700165#define KVM_EXIT_UNKNOWN 0
166#define KVM_EXIT_EXCEPTION 1
167#define KVM_EXIT_IO 2
Christopher Ferris05d08e92016-02-04 13:16:38 -0800168#define KVM_EXIT_HYPERCALL 3
Ben Cheng655a7c02013-10-16 16:09:24 -0700169#define KVM_EXIT_DEBUG 4
170#define KVM_EXIT_HLT 5
171#define KVM_EXIT_MMIO 6
Christopher Ferris05d08e92016-02-04 13:16:38 -0800172#define KVM_EXIT_IRQ_WINDOW_OPEN 7
Ben Cheng655a7c02013-10-16 16:09:24 -0700173#define KVM_EXIT_SHUTDOWN 8
174#define KVM_EXIT_FAIL_ENTRY 9
175#define KVM_EXIT_INTR 10
Christopher Ferris05d08e92016-02-04 13:16:38 -0800176#define KVM_EXIT_SET_TPR 11
Ben Cheng655a7c02013-10-16 16:09:24 -0700177#define KVM_EXIT_TPR_ACCESS 12
178#define KVM_EXIT_S390_SIEIC 13
179#define KVM_EXIT_S390_RESET 14
Christopher Ferris05d08e92016-02-04 13:16:38 -0800180#define KVM_EXIT_DCR 15
Ben Cheng655a7c02013-10-16 16:09:24 -0700181#define KVM_EXIT_NMI 16
182#define KVM_EXIT_INTERNAL_ERROR 17
183#define KVM_EXIT_OSI 18
Christopher Ferris05d08e92016-02-04 13:16:38 -0800184#define KVM_EXIT_PAPR_HCALL 19
Ben Cheng655a7c02013-10-16 16:09:24 -0700185#define KVM_EXIT_S390_UCONTROL 20
186#define KVM_EXIT_WATCHDOG 21
187#define KVM_EXIT_S390_TSCH 22
Christopher Ferris05d08e92016-02-04 13:16:38 -0800188#define KVM_EXIT_EPR 23
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700189#define KVM_EXIT_SYSTEM_EVENT 24
Christopher Ferris05d08e92016-02-04 13:16:38 -0800190#define KVM_EXIT_S390_STSI 25
191#define KVM_EXIT_IOAPIC_EOI 26
Christopher Ferris106b3a82016-08-24 12:15:38 -0700192#define KVM_EXIT_HYPERV 27
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800193#define KVM_EXIT_ARM_NISV 28
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800194#define KVM_EXIT_X86_RDMSR 29
195#define KVM_EXIT_X86_WRMSR 30
Christopher Ferris05667cd2021-02-16 16:01:34 -0800196#define KVM_EXIT_DIRTY_RING_FULL 31
197#define KVM_EXIT_AP_RESET_HOLD 32
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700198#define KVM_EXIT_X86_BUS_LOCK 33
199#define KVM_EXIT_XEN 34
Christopher Ferrisa4792612022-01-10 13:51:15 -0800200#define KVM_EXIT_RISCV_SBI 35
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700201#define KVM_EXIT_RISCV_CSR 36
202#define KVM_EXIT_NOTIFY 37
Christopher Ferris0f795212024-01-17 14:17:28 -0800203#define KVM_EXIT_LOONGARCH_IOCSR 38
Ben Cheng655a7c02013-10-16 16:09:24 -0700204#define KVM_INTERNAL_ERROR_EMULATION 1
205#define KVM_INTERNAL_ERROR_SIMUL_EX 2
206#define KVM_INTERNAL_ERROR_DELIVERY_EV 3
Christopher Ferris9584fa42019-12-09 15:36:13 -0800207#define KVM_INTERNAL_ERROR_UNEXPECTED_EXIT_REASON 4
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000208#define KVM_INTERNAL_ERROR_EMULATION_FLAG_INSTRUCTION_BYTES (1ULL << 0)
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700209struct kvm_run {
Tao Baod7db5942015-01-28 10:07:51 -0800210 __u8 request_interrupt_window;
Christopher Ferris525ce912017-07-26 13:12:53 -0700211 __u8 immediate_exit;
212 __u8 padding1[6];
Tao Baod7db5942015-01-28 10:07:51 -0800213 __u32 exit_reason;
Tao Baod7db5942015-01-28 10:07:51 -0800214 __u8 ready_for_interrupt_injection;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800215 __u8 if_flag;
216 __u16 flags;
217 __u64 cr8;
Tao Baod7db5942015-01-28 10:07:51 -0800218 __u64 apic_base;
Ben Cheng655a7c02013-10-16 16:09:24 -0700219#ifdef __KVM_S390
Tao Baod7db5942015-01-28 10:07:51 -0800220 __u64 psw_mask;
221 __u64 psw_addr;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700222#endif
Tao Baod7db5942015-01-28 10:07:51 -0800223 union {
224 struct {
225 __u64 hardware_exit_reason;
Tao Baod7db5942015-01-28 10:07:51 -0800226 } hw;
227 struct {
228 __u64 hardware_entry_failure_reason;
Christopher Ferris25c18d42020-10-14 17:42:58 -0700229 __u32 cpu;
Tao Baod7db5942015-01-28 10:07:51 -0800230 } fail_entry;
Tao Baod7db5942015-01-28 10:07:51 -0800231 struct {
232 __u32 exception;
233 __u32 error_code;
234 } ex;
Tao Baod7db5942015-01-28 10:07:51 -0800235 struct {
Ben Cheng655a7c02013-10-16 16:09:24 -0700236#define KVM_EXIT_IO_IN 0
237#define KVM_EXIT_IO_OUT 1
Tao Baod7db5942015-01-28 10:07:51 -0800238 __u8 direction;
Tao Baod7db5942015-01-28 10:07:51 -0800239 __u8 size;
240 __u16 port;
241 __u32 count;
242 __u64 data_offset;
Tao Baod7db5942015-01-28 10:07:51 -0800243 } io;
244 struct {
245 struct kvm_debug_exit_arch arch;
246 } debug;
Tao Baod7db5942015-01-28 10:07:51 -0800247 struct {
248 __u64 phys_addr;
249 __u8 data[8];
250 __u32 len;
Tao Baod7db5942015-01-28 10:07:51 -0800251 __u8 is_write;
252 } mmio;
253 struct {
Christopher Ferris0f795212024-01-17 14:17:28 -0800254 __u64 phys_addr;
255 __u8 data[8];
256 __u32 len;
257 __u8 is_write;
258 } iocsr_io;
259 struct {
Tao Baod7db5942015-01-28 10:07:51 -0800260 __u64 nr;
Tao Baod7db5942015-01-28 10:07:51 -0800261 __u64 args[6];
262 __u64 ret;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700263 union {
264 __u32 longmode;
265 __u64 flags;
266 };
Tao Baod7db5942015-01-28 10:07:51 -0800267 } hypercall;
268 struct {
269 __u64 rip;
270 __u32 is_write;
Tao Baod7db5942015-01-28 10:07:51 -0800271 __u32 pad;
272 } tpr_access;
273 struct {
274 __u8 icptcode;
Tao Baod7db5942015-01-28 10:07:51 -0800275 __u16 ipa;
276 __u32 ipb;
277 } s390_sieic;
Ben Cheng655a7c02013-10-16 16:09:24 -0700278#define KVM_S390_RESET_POR 1
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700279#define KVM_S390_RESET_CLEAR 2
Ben Cheng655a7c02013-10-16 16:09:24 -0700280#define KVM_S390_RESET_SUBSYSTEM 4
281#define KVM_S390_RESET_CPU_INIT 8
282#define KVM_S390_RESET_IPL 16
Tao Baod7db5942015-01-28 10:07:51 -0800283 __u64 s390_reset_flags;
284 struct {
285 __u64 trans_exc_code;
286 __u32 pgm_code;
Tao Baod7db5942015-01-28 10:07:51 -0800287 } s390_ucontrol;
288 struct {
289 __u32 dcrn;
290 __u32 data;
Tao Baod7db5942015-01-28 10:07:51 -0800291 __u8 is_write;
292 } dcr;
293 struct {
294 __u32 suberror;
Tao Baod7db5942015-01-28 10:07:51 -0800295 __u32 ndata;
296 __u64 data[16];
297 } internal;
298 struct {
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000299 __u32 suberror;
300 __u32 ndata;
301 __u64 flags;
Christopher Ferrisa4792612022-01-10 13:51:15 -0800302 union {
303 struct {
304 __u8 insn_size;
305 __u8 insn_bytes[15];
306 };
307 };
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000308 } emulation_failure;
309 struct {
Tao Baod7db5942015-01-28 10:07:51 -0800310 __u64 gprs[32];
311 } osi;
312 struct {
313 __u64 nr;
Tao Baod7db5942015-01-28 10:07:51 -0800314 __u64 ret;
315 __u64 args[9];
316 } papr_hcall;
317 struct {
Tao Baod7db5942015-01-28 10:07:51 -0800318 __u16 subchannel_id;
319 __u16 subchannel_nr;
320 __u32 io_int_parm;
321 __u32 io_int_word;
Tao Baod7db5942015-01-28 10:07:51 -0800322 __u32 ipb;
323 __u8 dequeued;
324 } s390_tsch;
325 struct {
Tao Baod7db5942015-01-28 10:07:51 -0800326 __u32 epr;
327 } epr;
328 struct {
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700329#define KVM_SYSTEM_EVENT_SHUTDOWN 1
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700330#define KVM_SYSTEM_EVENT_RESET 2
Christopher Ferris05d08e92016-02-04 13:16:38 -0800331#define KVM_SYSTEM_EVENT_CRASH 3
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700332#define KVM_SYSTEM_EVENT_WAKEUP 4
333#define KVM_SYSTEM_EVENT_SUSPEND 5
334#define KVM_SYSTEM_EVENT_SEV_TERM 6
Tao Baod7db5942015-01-28 10:07:51 -0800335 __u32 type;
Christopher Ferris10a76e62022-06-08 13:31:52 -0700336 __u32 ndata;
337 union {
338 __u64 flags;
339 __u64 data[16];
340 };
Tao Baod7db5942015-01-28 10:07:51 -0800341 } system_event;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800342 struct {
343 __u64 addr;
344 __u8 ar;
345 __u8 reserved;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800346 __u8 fc;
347 __u8 sel1;
348 __u16 sel2;
349 } s390_stsi;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800350 struct {
351 __u8 vector;
352 } eoi;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700353 struct kvm_hyperv_exit hyperv;
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800354 struct {
355 __u64 esr_iss;
356 __u64 fault_ipa;
357 } arm_nisv;
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800358 struct {
359 __u8 error;
360 __u8 pad[7];
361#define KVM_MSR_EXIT_REASON_INVAL (1 << 0)
362#define KVM_MSR_EXIT_REASON_UNKNOWN (1 << 1)
363#define KVM_MSR_EXIT_REASON_FILTER (1 << 2)
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800364#define KVM_MSR_EXIT_REASON_VALID_MASK (KVM_MSR_EXIT_REASON_INVAL | KVM_MSR_EXIT_REASON_UNKNOWN | KVM_MSR_EXIT_REASON_FILTER)
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800365 __u32 reason;
366 __u32 index;
367 __u64 data;
368 } msr;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700369 struct kvm_xen_exit xen;
Christopher Ferrisa4792612022-01-10 13:51:15 -0800370 struct {
371 unsigned long extension_id;
372 unsigned long function_id;
373 unsigned long args[6];
374 unsigned long ret[2];
375 } riscv_sbi;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700376 struct {
377 unsigned long csr_num;
378 unsigned long new_value;
379 unsigned long write_mask;
380 unsigned long ret_value;
381 } riscv_csr;
382 struct {
383#define KVM_NOTIFY_CONTEXT_INVALID (1 << 0)
384 __u32 flags;
385 } notify;
Tao Baod7db5942015-01-28 10:07:51 -0800386 char padding[256];
387 };
Christopher Ferris76a1d452018-06-27 14:12:29 -0700388#define SYNC_REGS_SIZE_BYTES 2048
Tao Baod7db5942015-01-28 10:07:51 -0800389 __u64 kvm_valid_regs;
390 __u64 kvm_dirty_regs;
Tao Baod7db5942015-01-28 10:07:51 -0800391 union {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800392 struct kvm_sync_regs regs;
Christopher Ferris76a1d452018-06-27 14:12:29 -0700393 char padding[SYNC_REGS_SIZE_BYTES];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800394 } s;
Ben Cheng655a7c02013-10-16 16:09:24 -0700395};
396struct kvm_coalesced_mmio_zone {
Tao Baod7db5942015-01-28 10:07:51 -0800397 __u64 addr;
398 __u32 size;
Christopher Ferris86a48372019-01-10 14:14:59 -0800399 union {
400 __u32 pad;
401 __u32 pio;
402 };
Ben Cheng655a7c02013-10-16 16:09:24 -0700403};
404struct kvm_coalesced_mmio {
Tao Baod7db5942015-01-28 10:07:51 -0800405 __u64 phys_addr;
Tao Baod7db5942015-01-28 10:07:51 -0800406 __u32 len;
Christopher Ferris86a48372019-01-10 14:14:59 -0800407 union {
408 __u32 pad;
409 __u32 pio;
410 };
Tao Baod7db5942015-01-28 10:07:51 -0800411 __u8 data[8];
Ben Cheng655a7c02013-10-16 16:09:24 -0700412};
413struct kvm_coalesced_mmio_ring {
Tao Baod7db5942015-01-28 10:07:51 -0800414 __u32 first, last;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700415 struct kvm_coalesced_mmio coalesced_mmio[];
Ben Cheng655a7c02013-10-16 16:09:24 -0700416};
Tao Baod7db5942015-01-28 10:07:51 -0800417#define KVM_COALESCED_MMIO_MAX ((PAGE_SIZE - sizeof(struct kvm_coalesced_mmio_ring)) / sizeof(struct kvm_coalesced_mmio))
Ben Cheng655a7c02013-10-16 16:09:24 -0700418struct kvm_translation {
Tao Baod7db5942015-01-28 10:07:51 -0800419 __u64 linear_address;
420 __u64 physical_address;
Tao Baod7db5942015-01-28 10:07:51 -0800421 __u8 valid;
422 __u8 writeable;
423 __u8 usermode;
424 __u8 pad[5];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800425};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800426struct kvm_s390_mem_op {
427 __u64 gaddr;
428 __u64 flags;
429 __u32 size;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800430 __u32 op;
431 __u64 buf;
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700432 union {
Christopher Ferris10a76e62022-06-08 13:31:52 -0700433 struct {
434 __u8 ar;
435 __u8 key;
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000436 __u8 pad1[6];
437 __u64 old_addr;
Christopher Ferris10a76e62022-06-08 13:31:52 -0700438 };
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700439 __u32 sida_offset;
440 __u8 reserved[32];
441 };
Ben Cheng655a7c02013-10-16 16:09:24 -0700442};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800443#define KVM_S390_MEMOP_LOGICAL_READ 0
444#define KVM_S390_MEMOP_LOGICAL_WRITE 1
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700445#define KVM_S390_MEMOP_SIDA_READ 2
446#define KVM_S390_MEMOP_SIDA_WRITE 3
Christopher Ferris10a76e62022-06-08 13:31:52 -0700447#define KVM_S390_MEMOP_ABSOLUTE_READ 4
448#define KVM_S390_MEMOP_ABSOLUTE_WRITE 5
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000449#define KVM_S390_MEMOP_ABSOLUTE_CMPXCHG 6
Christopher Ferris05d08e92016-02-04 13:16:38 -0800450#define KVM_S390_MEMOP_F_CHECK_ONLY (1ULL << 0)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800451#define KVM_S390_MEMOP_F_INJECT_EXCEPTION (1ULL << 1)
Christopher Ferris10a76e62022-06-08 13:31:52 -0700452#define KVM_S390_MEMOP_F_SKEY_PROTECTION (1ULL << 2)
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000453#define KVM_S390_MEMOP_EXTENSION_CAP_BASE (1 << 0)
454#define KVM_S390_MEMOP_EXTENSION_CAP_CMPXCHG (1 << 1)
Ben Cheng655a7c02013-10-16 16:09:24 -0700455struct kvm_interrupt {
Tao Baod7db5942015-01-28 10:07:51 -0800456 __u32 irq;
Ben Cheng655a7c02013-10-16 16:09:24 -0700457};
458struct kvm_dirty_log {
Tao Baod7db5942015-01-28 10:07:51 -0800459 __u32 slot;
460 __u32 padding1;
461 union {
Elliott Hughes0f0c18f2023-03-29 15:53:31 -0700462 void * dirty_bitmap;
Tao Baod7db5942015-01-28 10:07:51 -0800463 __u64 padding2;
464 };
Ben Cheng655a7c02013-10-16 16:09:24 -0700465};
Christopher Ferrisd842e432019-03-07 10:21:59 -0800466struct kvm_clear_dirty_log {
467 __u32 slot;
468 __u32 num_pages;
469 __u64 first_page;
470 union {
Elliott Hughes0f0c18f2023-03-29 15:53:31 -0700471 void * dirty_bitmap;
Christopher Ferrisd842e432019-03-07 10:21:59 -0800472 __u64 padding2;
473 };
474};
Ben Cheng655a7c02013-10-16 16:09:24 -0700475struct kvm_signal_mask {
Tao Baod7db5942015-01-28 10:07:51 -0800476 __u32 len;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700477 __u8 sigset[];
Ben Cheng655a7c02013-10-16 16:09:24 -0700478};
479struct kvm_tpr_access_ctl {
Tao Baod7db5942015-01-28 10:07:51 -0800480 __u32 enabled;
481 __u32 flags;
482 __u32 reserved[8];
Ben Cheng655a7c02013-10-16 16:09:24 -0700483};
484struct kvm_vapic_addr {
Tao Baod7db5942015-01-28 10:07:51 -0800485 __u64 vapic_addr;
Ben Cheng655a7c02013-10-16 16:09:24 -0700486};
487#define KVM_MP_STATE_RUNNABLE 0
488#define KVM_MP_STATE_UNINITIALIZED 1
489#define KVM_MP_STATE_INIT_RECEIVED 2
Ben Cheng655a7c02013-10-16 16:09:24 -0700490#define KVM_MP_STATE_HALTED 3
491#define KVM_MP_STATE_SIPI_RECEIVED 4
Christopher Ferris82d75042015-01-26 10:57:07 -0800492#define KVM_MP_STATE_STOPPED 5
493#define KVM_MP_STATE_CHECK_STOP 6
494#define KVM_MP_STATE_OPERATING 7
Christopher Ferris82d75042015-01-26 10:57:07 -0800495#define KVM_MP_STATE_LOAD 8
Christopher Ferris05667cd2021-02-16 16:01:34 -0800496#define KVM_MP_STATE_AP_RESET_HOLD 9
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700497#define KVM_MP_STATE_SUSPENDED 10
Ben Cheng655a7c02013-10-16 16:09:24 -0700498struct kvm_mp_state {
Tao Baod7db5942015-01-28 10:07:51 -0800499 __u32 mp_state;
Ben Cheng655a7c02013-10-16 16:09:24 -0700500};
501struct kvm_s390_psw {
Tao Baod7db5942015-01-28 10:07:51 -0800502 __u64 mask;
503 __u64 addr;
Ben Cheng655a7c02013-10-16 16:09:24 -0700504};
505#define KVM_S390_SIGP_STOP 0xfffe0000u
506#define KVM_S390_PROGRAM_INT 0xfffe0001u
507#define KVM_S390_SIGP_SET_PREFIX 0xfffe0002u
Ben Cheng655a7c02013-10-16 16:09:24 -0700508#define KVM_S390_RESTART 0xfffe0003u
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700509#define KVM_S390_INT_PFAULT_INIT 0xfffe0004u
510#define KVM_S390_INT_PFAULT_DONE 0xfffe0005u
Ben Cheng655a7c02013-10-16 16:09:24 -0700511#define KVM_S390_MCHK 0xfffe1000u
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700512#define KVM_S390_INT_CLOCK_COMP 0xffff1004u
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700513#define KVM_S390_INT_CPU_TIMER 0xffff1005u
Ben Cheng655a7c02013-10-16 16:09:24 -0700514#define KVM_S390_INT_VIRTIO 0xffff2603u
515#define KVM_S390_INT_SERVICE 0xffff2401u
Ben Cheng655a7c02013-10-16 16:09:24 -0700516#define KVM_S390_INT_EMERGENCY 0xffff1201u
517#define KVM_S390_INT_EXTERNAL_CALL 0xffff1202u
Tao Baod7db5942015-01-28 10:07:51 -0800518#define KVM_S390_INT_IO(ai,cssid,ssid,schid) (((schid)) | ((ssid) << 16) | ((cssid) << 18) | ((ai) << 26))
Ben Cheng655a7c02013-10-16 16:09:24 -0700519#define KVM_S390_INT_IO_MIN 0x00000000u
Ben Cheng655a7c02013-10-16 16:09:24 -0700520#define KVM_S390_INT_IO_MAX 0xfffdffffu
Christopher Ferris05d08e92016-02-04 13:16:38 -0800521#define KVM_S390_INT_IO_AI_MASK 0x04000000u
Ben Cheng655a7c02013-10-16 16:09:24 -0700522struct kvm_s390_interrupt {
Tao Baod7db5942015-01-28 10:07:51 -0800523 __u32 type;
524 __u32 parm;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800525 __u64 parm64;
Ben Cheng655a7c02013-10-16 16:09:24 -0700526};
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700527struct kvm_s390_io_info {
Tao Baod7db5942015-01-28 10:07:51 -0800528 __u16 subchannel_id;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800529 __u16 subchannel_nr;
Tao Baod7db5942015-01-28 10:07:51 -0800530 __u32 io_int_parm;
531 __u32 io_int_word;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700532};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800533struct kvm_s390_ext_info {
Tao Baod7db5942015-01-28 10:07:51 -0800534 __u32 ext_params;
535 __u32 pad;
536 __u64 ext_params2;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800537};
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700538struct kvm_s390_pgm_info {
Tao Baod7db5942015-01-28 10:07:51 -0800539 __u64 trans_exc_code;
540 __u64 mon_code;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800541 __u64 per_address;
Tao Baod7db5942015-01-28 10:07:51 -0800542 __u32 data_exc_code;
543 __u16 code;
544 __u16 mon_class_nr;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800545 __u8 per_code;
Tao Baod7db5942015-01-28 10:07:51 -0800546 __u8 per_atmid;
547 __u8 exc_access_id;
548 __u8 per_access_id;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800549 __u8 op_access_id;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700550#define KVM_S390_PGM_FLAGS_ILC_VALID 0x01
551#define KVM_S390_PGM_FLAGS_ILC_0 0x02
552#define KVM_S390_PGM_FLAGS_ILC_1 0x04
Christopher Ferris106b3a82016-08-24 12:15:38 -0700553#define KVM_S390_PGM_FLAGS_ILC_MASK 0x06
554#define KVM_S390_PGM_FLAGS_NO_REWIND 0x08
555 __u8 flags;
556 __u8 pad[2];
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700557};
558struct kvm_s390_prefix_info {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800559 __u32 address;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700560};
561struct kvm_s390_extcall_info {
Tao Baod7db5942015-01-28 10:07:51 -0800562 __u16 code;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800563};
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700564struct kvm_s390_emerg_info {
Tao Baod7db5942015-01-28 10:07:51 -0800565 __u16 code;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700566};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800567#define KVM_S390_STOP_FLAG_STORE_STATUS 0x01
568struct kvm_s390_stop_info {
569 __u32 flags;
570};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800571struct kvm_s390_mchk_info {
Tao Baod7db5942015-01-28 10:07:51 -0800572 __u64 cr14;
573 __u64 mcic;
574 __u64 failing_storage_address;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800575 __u32 ext_damage_code;
Tao Baod7db5942015-01-28 10:07:51 -0800576 __u32 pad;
577 __u8 fixed_logout[16];
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700578};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800579struct kvm_s390_irq {
Tao Baod7db5942015-01-28 10:07:51 -0800580 __u64 type;
581 union {
582 struct kvm_s390_io_info io;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800583 struct kvm_s390_ext_info ext;
Tao Baod7db5942015-01-28 10:07:51 -0800584 struct kvm_s390_pgm_info pgm;
585 struct kvm_s390_emerg_info emerg;
586 struct kvm_s390_extcall_info extcall;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800587 struct kvm_s390_prefix_info prefix;
588 struct kvm_s390_stop_info stop;
Tao Baod7db5942015-01-28 10:07:51 -0800589 struct kvm_s390_mchk_info mchk;
590 char reserved[64];
591 } u;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700592};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800593struct kvm_s390_irq_state {
594 __u64 buf;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800595 __u32 flags;
596 __u32 len;
597 __u32 reserved[4];
598};
Ben Cheng655a7c02013-10-16 16:09:24 -0700599#define KVM_GUESTDBG_ENABLE 0x00000001
600#define KVM_GUESTDBG_SINGLESTEP 0x00000002
Ben Cheng655a7c02013-10-16 16:09:24 -0700601struct kvm_guest_debug {
Tao Baod7db5942015-01-28 10:07:51 -0800602 __u32 control;
Tao Baod7db5942015-01-28 10:07:51 -0800603 __u32 pad;
604 struct kvm_guest_debug_arch arch;
Ben Cheng655a7c02013-10-16 16:09:24 -0700605};
606enum {
Tao Baod7db5942015-01-28 10:07:51 -0800607 kvm_ioeventfd_flag_nr_datamatch,
608 kvm_ioeventfd_flag_nr_pio,
609 kvm_ioeventfd_flag_nr_deassign,
610 kvm_ioeventfd_flag_nr_virtio_ccw_notify,
Tao Baod7db5942015-01-28 10:07:51 -0800611 kvm_ioeventfd_flag_nr_fast_mmio,
612 kvm_ioeventfd_flag_nr_max,
Ben Cheng655a7c02013-10-16 16:09:24 -0700613};
Ben Cheng655a7c02013-10-16 16:09:24 -0700614#define KVM_IOEVENTFD_FLAG_DATAMATCH (1 << kvm_ioeventfd_flag_nr_datamatch)
615#define KVM_IOEVENTFD_FLAG_PIO (1 << kvm_ioeventfd_flag_nr_pio)
616#define KVM_IOEVENTFD_FLAG_DEASSIGN (1 << kvm_ioeventfd_flag_nr_deassign)
Tao Baod7db5942015-01-28 10:07:51 -0800617#define KVM_IOEVENTFD_FLAG_VIRTIO_CCW_NOTIFY (1 << kvm_ioeventfd_flag_nr_virtio_ccw_notify)
Ben Cheng655a7c02013-10-16 16:09:24 -0700618#define KVM_IOEVENTFD_VALID_FLAG_MASK ((1 << kvm_ioeventfd_flag_nr_max) - 1)
619struct kvm_ioeventfd {
Tao Baod7db5942015-01-28 10:07:51 -0800620 __u64 datamatch;
621 __u64 addr;
622 __u32 len;
Tao Baod7db5942015-01-28 10:07:51 -0800623 __s32 fd;
624 __u32 flags;
625 __u8 pad[36];
Ben Cheng655a7c02013-10-16 16:09:24 -0700626};
Christopher Ferris76a1d452018-06-27 14:12:29 -0700627#define KVM_X86_DISABLE_EXITS_MWAIT (1 << 0)
628#define KVM_X86_DISABLE_EXITS_HLT (1 << 1)
629#define KVM_X86_DISABLE_EXITS_PAUSE (1 << 2)
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700630#define KVM_X86_DISABLE_EXITS_CSTATE (1 << 3)
631#define KVM_X86_DISABLE_VALID_EXITS (KVM_X86_DISABLE_EXITS_MWAIT | KVM_X86_DISABLE_EXITS_HLT | KVM_X86_DISABLE_EXITS_PAUSE | KVM_X86_DISABLE_EXITS_CSTATE)
Ben Cheng655a7c02013-10-16 16:09:24 -0700632struct kvm_enable_cap {
Tao Baod7db5942015-01-28 10:07:51 -0800633 __u32 cap;
634 __u32 flags;
635 __u64 args[4];
Tao Baod7db5942015-01-28 10:07:51 -0800636 __u8 pad[64];
Ben Cheng655a7c02013-10-16 16:09:24 -0700637};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800638#define KVM_PPC_PVINFO_FLAGS_EV_IDLE (1 << 0)
Ben Cheng655a7c02013-10-16 16:09:24 -0700639struct kvm_ppc_pvinfo {
Tao Baod7db5942015-01-28 10:07:51 -0800640 __u32 flags;
Tao Baod7db5942015-01-28 10:07:51 -0800641 __u32 hcall[4];
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800642 __u8 pad[108];
Ben Cheng655a7c02013-10-16 16:09:24 -0700643};
Ben Cheng655a7c02013-10-16 16:09:24 -0700644#define KVM_PPC_PAGE_SIZES_MAX_SZ 8
645struct kvm_ppc_one_page_size {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800646 __u32 page_shift;
Tao Baod7db5942015-01-28 10:07:51 -0800647 __u32 pte_enc;
Ben Cheng655a7c02013-10-16 16:09:24 -0700648};
649struct kvm_ppc_one_seg_page_size {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800650 __u32 page_shift;
Tao Baod7db5942015-01-28 10:07:51 -0800651 __u32 slb_enc;
652 struct kvm_ppc_one_page_size enc[KVM_PPC_PAGE_SIZES_MAX_SZ];
Ben Cheng655a7c02013-10-16 16:09:24 -0700653};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800654#define KVM_PPC_PAGE_SIZES_REAL 0x00000001
Ben Cheng655a7c02013-10-16 16:09:24 -0700655#define KVM_PPC_1T_SEGMENTS 0x00000002
Christopher Ferris86a48372019-01-10 14:14:59 -0800656#define KVM_PPC_NO_HASH 0x00000004
Ben Cheng655a7c02013-10-16 16:09:24 -0700657struct kvm_ppc_smmu_info {
Tao Baod7db5942015-01-28 10:07:51 -0800658 __u64 flags;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800659 __u32 slb_size;
Christopher Ferris1308ad32017-11-14 17:32:13 -0800660 __u16 data_keys;
661 __u16 instr_keys;
Tao Baod7db5942015-01-28 10:07:51 -0800662 struct kvm_ppc_one_seg_page_size sps[KVM_PPC_PAGE_SIZES_MAX_SZ];
Ben Cheng655a7c02013-10-16 16:09:24 -0700663};
Christopher Ferris525ce912017-07-26 13:12:53 -0700664struct kvm_ppc_resize_hpt {
665 __u64 flags;
666 __u32 shift;
667 __u32 pad;
668};
Ben Cheng655a7c02013-10-16 16:09:24 -0700669#define KVMIO 0xAE
Ben Cheng655a7c02013-10-16 16:09:24 -0700670#define KVM_VM_S390_UCONTROL 1
Christopher Ferris38062f92014-07-09 15:33:25 -0700671#define KVM_VM_PPC_HV 1
672#define KVM_VM_PPC_PR 2
Christopher Ferris25c18d42020-10-14 17:42:58 -0700673#define KVM_VM_MIPS_AUTO 0
Christopher Ferris525ce912017-07-26 13:12:53 -0700674#define KVM_VM_MIPS_VZ 1
Christopher Ferris25c18d42020-10-14 17:42:58 -0700675#define KVM_VM_MIPS_TE 2
Ben Cheng655a7c02013-10-16 16:09:24 -0700676#define KVM_S390_SIE_PAGE_OFFSET 1
Christopher Ferris86a48372019-01-10 14:14:59 -0800677#define KVM_VM_TYPE_ARM_IPA_SIZE_MASK 0xffULL
678#define KVM_VM_TYPE_ARM_IPA_SIZE(x) ((x) & KVM_VM_TYPE_ARM_IPA_SIZE_MASK)
Ben Cheng655a7c02013-10-16 16:09:24 -0700679#define KVM_GET_API_VERSION _IO(KVMIO, 0x00)
680#define KVM_CREATE_VM _IO(KVMIO, 0x01)
Ben Cheng655a7c02013-10-16 16:09:24 -0700681#define KVM_GET_MSR_INDEX_LIST _IOWR(KVMIO, 0x02, struct kvm_msr_list)
682#define KVM_S390_ENABLE_SIE _IO(KVMIO, 0x06)
683#define KVM_CHECK_EXTENSION _IO(KVMIO, 0x03)
684#define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04)
Ben Cheng655a7c02013-10-16 16:09:24 -0700685#define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x05, struct kvm_cpuid2)
686#define KVM_TRACE_ENABLE __KVM_DEPRECATED_MAIN_W_0x06
687#define KVM_TRACE_PAUSE __KVM_DEPRECATED_MAIN_0x07
688#define KVM_TRACE_DISABLE __KVM_DEPRECATED_MAIN_0x08
Christopher Ferris38062f92014-07-09 15:33:25 -0700689#define KVM_GET_EMULATED_CPUID _IOWR(KVMIO, 0x09, struct kvm_cpuid2)
Christopher Ferris76a1d452018-06-27 14:12:29 -0700690#define KVM_GET_MSR_FEATURE_INDEX_LIST _IOWR(KVMIO, 0x0a, struct kvm_msr_list)
Ben Cheng655a7c02013-10-16 16:09:24 -0700691#define KVM_CAP_IRQCHIP 0
692#define KVM_CAP_HLT 1
693#define KVM_CAP_MMU_SHADOW_CACHE_CONTROL 2
694#define KVM_CAP_USER_MEMORY 3
Ben Cheng655a7c02013-10-16 16:09:24 -0700695#define KVM_CAP_SET_TSS_ADDR 4
696#define KVM_CAP_VAPIC 6
697#define KVM_CAP_EXT_CPUID 7
698#define KVM_CAP_CLOCKSOURCE 8
Ben Cheng655a7c02013-10-16 16:09:24 -0700699#define KVM_CAP_NR_VCPUS 9
700#define KVM_CAP_NR_MEMSLOTS 10
701#define KVM_CAP_PIT 11
702#define KVM_CAP_NOP_IO_DELAY 12
Ben Cheng655a7c02013-10-16 16:09:24 -0700703#define KVM_CAP_PV_MMU 13
704#define KVM_CAP_MP_STATE 14
705#define KVM_CAP_COALESCED_MMIO 15
706#define KVM_CAP_SYNC_MMU 16
Ben Cheng655a7c02013-10-16 16:09:24 -0700707#define KVM_CAP_IOMMU 18
Ben Cheng655a7c02013-10-16 16:09:24 -0700708#define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21
Ben Cheng655a7c02013-10-16 16:09:24 -0700709#define KVM_CAP_USER_NMI 22
Ben Cheng655a7c02013-10-16 16:09:24 -0700710#ifdef __KVM_HAVE_GUEST_DEBUG
711#define KVM_CAP_SET_GUEST_DEBUG 23
712#endif
Ben Cheng655a7c02013-10-16 16:09:24 -0700713#ifdef __KVM_HAVE_PIT
714#define KVM_CAP_REINJECT_CONTROL 24
715#endif
716#define KVM_CAP_IRQ_ROUTING 25
Ben Cheng655a7c02013-10-16 16:09:24 -0700717#define KVM_CAP_IRQ_INJECT_STATUS 26
Ben Cheng655a7c02013-10-16 16:09:24 -0700718#define KVM_CAP_ASSIGN_DEV_IRQ 29
719#define KVM_CAP_JOIN_MEMORY_REGIONS_WORKS 30
720#ifdef __KVM_HAVE_MCE
Ben Cheng655a7c02013-10-16 16:09:24 -0700721#define KVM_CAP_MCE 31
722#endif
723#define KVM_CAP_IRQFD 32
724#ifdef __KVM_HAVE_PIT
Ben Cheng655a7c02013-10-16 16:09:24 -0700725#define KVM_CAP_PIT2 33
726#endif
727#define KVM_CAP_SET_BOOT_CPU_ID 34
728#ifdef __KVM_HAVE_PIT_STATE2
Ben Cheng655a7c02013-10-16 16:09:24 -0700729#define KVM_CAP_PIT_STATE2 35
730#endif
731#define KVM_CAP_IOEVENTFD 36
732#define KVM_CAP_SET_IDENTITY_MAP_ADDR 37
Ben Cheng655a7c02013-10-16 16:09:24 -0700733#ifdef __KVM_HAVE_XEN_HVM
734#define KVM_CAP_XEN_HVM 38
735#endif
736#define KVM_CAP_ADJUST_CLOCK 39
Ben Cheng655a7c02013-10-16 16:09:24 -0700737#define KVM_CAP_INTERNAL_ERROR_DATA 40
738#ifdef __KVM_HAVE_VCPU_EVENTS
739#define KVM_CAP_VCPU_EVENTS 41
740#endif
Ben Cheng655a7c02013-10-16 16:09:24 -0700741#define KVM_CAP_S390_PSW 42
742#define KVM_CAP_PPC_SEGSTATE 43
743#define KVM_CAP_HYPERV 44
744#define KVM_CAP_HYPERV_VAPIC 45
Ben Cheng655a7c02013-10-16 16:09:24 -0700745#define KVM_CAP_HYPERV_SPIN 46
746#define KVM_CAP_PCI_SEGMENT 47
747#define KVM_CAP_PPC_PAIRED_SINGLES 48
748#define KVM_CAP_INTR_SHADOW 49
Ben Cheng655a7c02013-10-16 16:09:24 -0700749#ifdef __KVM_HAVE_DEBUGREGS
750#define KVM_CAP_DEBUGREGS 50
751#endif
752#define KVM_CAP_X86_ROBUST_SINGLESTEP 51
Ben Cheng655a7c02013-10-16 16:09:24 -0700753#define KVM_CAP_PPC_OSI 52
754#define KVM_CAP_PPC_UNSET_IRQ 53
755#define KVM_CAP_ENABLE_CAP 54
756#ifdef __KVM_HAVE_XSAVE
Ben Cheng655a7c02013-10-16 16:09:24 -0700757#define KVM_CAP_XSAVE 55
758#endif
759#ifdef __KVM_HAVE_XCRS
760#define KVM_CAP_XCRS 56
Ben Cheng655a7c02013-10-16 16:09:24 -0700761#endif
762#define KVM_CAP_PPC_GET_PVINFO 57
763#define KVM_CAP_PPC_IRQ_LEVEL 58
764#define KVM_CAP_ASYNC_PF 59
Ben Cheng655a7c02013-10-16 16:09:24 -0700765#define KVM_CAP_TSC_CONTROL 60
766#define KVM_CAP_GET_TSC_KHZ 61
767#define KVM_CAP_PPC_BOOKE_SREGS 62
768#define KVM_CAP_SPAPR_TCE 63
Ben Cheng655a7c02013-10-16 16:09:24 -0700769#define KVM_CAP_PPC_SMT 64
770#define KVM_CAP_PPC_RMA 65
771#define KVM_CAP_MAX_VCPUS 66
772#define KVM_CAP_PPC_HIOR 67
Ben Cheng655a7c02013-10-16 16:09:24 -0700773#define KVM_CAP_PPC_PAPR 68
774#define KVM_CAP_SW_TLB 69
775#define KVM_CAP_ONE_REG 70
776#define KVM_CAP_S390_GMAP 71
Ben Cheng655a7c02013-10-16 16:09:24 -0700777#define KVM_CAP_TSC_DEADLINE_TIMER 72
778#define KVM_CAP_S390_UCONTROL 73
779#define KVM_CAP_SYNC_REGS 74
780#define KVM_CAP_PCI_2_3 75
Ben Cheng655a7c02013-10-16 16:09:24 -0700781#define KVM_CAP_KVMCLOCK_CTRL 76
782#define KVM_CAP_SIGNAL_MSI 77
783#define KVM_CAP_PPC_GET_SMMU_INFO 78
784#define KVM_CAP_S390_COW 79
Christopher Ferris82d75042015-01-26 10:57:07 -0800785#define KVM_CAP_PPC_ALLOC_HTAB 80
Ben Cheng655a7c02013-10-16 16:09:24 -0700786#define KVM_CAP_READONLY_MEM 81
Ben Cheng655a7c02013-10-16 16:09:24 -0700787#define KVM_CAP_IRQFD_RESAMPLE 82
788#define KVM_CAP_PPC_BOOKE_WATCHDOG 83
789#define KVM_CAP_PPC_HTAB_FD 84
790#define KVM_CAP_S390_CSS_SUPPORT 85
Ben Cheng655a7c02013-10-16 16:09:24 -0700791#define KVM_CAP_PPC_EPR 86
792#define KVM_CAP_ARM_PSCI 87
793#define KVM_CAP_ARM_SET_DEVICE_ADDR 88
794#define KVM_CAP_DEVICE_CTRL 89
Ben Cheng655a7c02013-10-16 16:09:24 -0700795#define KVM_CAP_IRQ_MPIC 90
796#define KVM_CAP_PPC_RTAS 91
797#define KVM_CAP_IRQ_XICS 92
Christopher Ferris38062f92014-07-09 15:33:25 -0700798#define KVM_CAP_ARM_EL1_32BIT 93
799#define KVM_CAP_SPAPR_MULTITCE 94
Christopher Ferris38062f92014-07-09 15:33:25 -0700800#define KVM_CAP_EXT_EMUL_CPUID 95
801#define KVM_CAP_HYPERV_TIME 96
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700802#define KVM_CAP_IOAPIC_POLARITY_IGNORED 97
803#define KVM_CAP_ENABLE_CAP_VM 98
804#define KVM_CAP_S390_IRQCHIP 99
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700805#define KVM_CAP_IOEVENTFD_NO_LENGTH 100
806#define KVM_CAP_VM_ATTRIBUTES 101
807#define KVM_CAP_ARM_PSCI_0_2 102
808#define KVM_CAP_PPC_FIXUP_HCALL 103
Christopher Ferris82d75042015-01-26 10:57:07 -0800809#define KVM_CAP_PPC_ENABLE_HCALL 104
810#define KVM_CAP_CHECK_EXTENSION_VM 105
Christopher Ferris05d08e92016-02-04 13:16:38 -0800811#define KVM_CAP_S390_USER_SIGP 106
812#define KVM_CAP_S390_VECTOR_REGISTERS 107
Christopher Ferris05d08e92016-02-04 13:16:38 -0800813#define KVM_CAP_S390_MEM_OP 108
814#define KVM_CAP_S390_USER_STSI 109
815#define KVM_CAP_S390_SKEYS 110
816#define KVM_CAP_MIPS_FPU 111
Christopher Ferris05d08e92016-02-04 13:16:38 -0800817#define KVM_CAP_MIPS_MSA 112
818#define KVM_CAP_S390_INJECT_IRQ 113
819#define KVM_CAP_S390_IRQ_STATE 114
820#define KVM_CAP_PPC_HWRNG 115
Christopher Ferris05d08e92016-02-04 13:16:38 -0800821#define KVM_CAP_DISABLE_QUIRKS 116
822#define KVM_CAP_X86_SMM 117
823#define KVM_CAP_MULTI_ADDRESS_SPACE 118
824#define KVM_CAP_GUEST_DEBUG_HW_BPS 119
Christopher Ferris05d08e92016-02-04 13:16:38 -0800825#define KVM_CAP_GUEST_DEBUG_HW_WPS 120
826#define KVM_CAP_SPLIT_IRQCHIP 121
827#define KVM_CAP_IOEVENTFD_ANY_LENGTH 122
Christopher Ferris106b3a82016-08-24 12:15:38 -0700828#define KVM_CAP_HYPERV_SYNIC 123
829#define KVM_CAP_S390_RI 124
830#define KVM_CAP_SPAPR_TCE_64 125
Christopher Ferris106b3a82016-08-24 12:15:38 -0700831#define KVM_CAP_ARM_PMU_V3 126
832#define KVM_CAP_VCPU_ATTRIBUTES 127
833#define KVM_CAP_MAX_VCPU_ID 128
Christopher Ferris49f525c2016-12-12 14:55:36 -0800834#define KVM_CAP_X2APIC_API 129
Christopher Ferris49f525c2016-12-12 14:55:36 -0800835#define KVM_CAP_S390_USER_INSTR0 130
836#define KVM_CAP_MSI_DEVID 131
837#define KVM_CAP_PPC_HTM 132
Christopher Ferris525ce912017-07-26 13:12:53 -0700838#define KVM_CAP_SPAPR_RESIZE_HPT 133
839#define KVM_CAP_PPC_MMU_RADIX 134
840#define KVM_CAP_PPC_MMU_HASH_V3 135
841#define KVM_CAP_IMMEDIATE_EXIT 136
842#define KVM_CAP_MIPS_VZ 137
843#define KVM_CAP_MIPS_TE 138
844#define KVM_CAP_MIPS_64BIT 139
845#define KVM_CAP_S390_GS 140
846#define KVM_CAP_S390_AIS 141
847#define KVM_CAP_SPAPR_TCE_VFIO 142
Christopher Ferris76a1d452018-06-27 14:12:29 -0700848#define KVM_CAP_X86_DISABLE_EXITS 143
Christopher Ferris525ce912017-07-26 13:12:53 -0700849#define KVM_CAP_ARM_USER_IRQ 144
Christopher Ferris1308ad32017-11-14 17:32:13 -0800850#define KVM_CAP_S390_CMMA_MIGRATION 145
851#define KVM_CAP_PPC_FWNMI 146
852#define KVM_CAP_PPC_SMT_POSSIBLE 147
853#define KVM_CAP_HYPERV_SYNIC2 148
854#define KVM_CAP_HYPERV_VP_INDEX 149
Christopher Ferris934ec942018-01-31 15:29:16 -0800855#define KVM_CAP_S390_AIS_MIGRATION 150
856#define KVM_CAP_PPC_GET_CPU_CHAR 151
857#define KVM_CAP_S390_BPB 152
Christopher Ferris76a1d452018-06-27 14:12:29 -0700858#define KVM_CAP_GET_MSR_FEATURES 153
859#define KVM_CAP_HYPERV_EVENTFD 154
Christopher Ferris9ce28842018-10-25 12:11:39 -0700860#define KVM_CAP_HYPERV_TLBFLUSH 155
861#define KVM_CAP_S390_HPAGE_1M 156
862#define KVM_CAP_NESTED_STATE 157
863#define KVM_CAP_ARM_INJECT_SERROR_ESR 158
864#define KVM_CAP_MSR_PLATFORM_INFO 159
Christopher Ferris86a48372019-01-10 14:14:59 -0800865#define KVM_CAP_PPC_NESTED_HV 160
866#define KVM_CAP_HYPERV_SEND_IPI 161
867#define KVM_CAP_COALESCED_PIO 162
868#define KVM_CAP_HYPERV_ENLIGHTENED_VMCS 163
869#define KVM_CAP_EXCEPTION_PAYLOAD 164
870#define KVM_CAP_ARM_VM_IPA_SIZE 165
Christopher Ferrisd842e432019-03-07 10:21:59 -0800871#define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT 166
872#define KVM_CAP_HYPERV_CPUID 167
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700873#define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 168
874#define KVM_CAP_PPC_IRQ_XIVE 169
875#define KVM_CAP_ARM_SVE 170
876#define KVM_CAP_ARM_PTRAUTH_ADDRESS 171
877#define KVM_CAP_ARM_PTRAUTH_GENERIC 172
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700878#define KVM_CAP_PMU_EVENT_FILTER 173
Christopher Ferris9584fa42019-12-09 15:36:13 -0800879#define KVM_CAP_ARM_IRQ_LINE_LAYOUT_2 174
880#define KVM_CAP_HYPERV_DIRECT_TLBFLUSH 175
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800881#define KVM_CAP_PPC_GUEST_DEBUG_SSTEP 176
882#define KVM_CAP_ARM_NISV_TO_USER 177
883#define KVM_CAP_ARM_INJECT_EXT_DABT 178
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700884#define KVM_CAP_S390_VCPU_RESETS 179
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700885#define KVM_CAP_S390_PROTECTED 180
886#define KVM_CAP_PPC_SECURE_GUEST 181
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700887#define KVM_CAP_HALT_POLL 182
888#define KVM_CAP_ASYNC_PF_INT 183
Christopher Ferris25c18d42020-10-14 17:42:58 -0700889#define KVM_CAP_LAST_CPU 184
890#define KVM_CAP_SMALLER_MAXPHYADDR 185
891#define KVM_CAP_S390_DIAG318 186
892#define KVM_CAP_STEAL_TIME 187
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800893#define KVM_CAP_X86_USER_SPACE_MSR 188
894#define KVM_CAP_X86_MSR_FILTER 189
895#define KVM_CAP_ENFORCE_PV_FEATURE_CPUID 190
Christopher Ferris05667cd2021-02-16 16:01:34 -0800896#define KVM_CAP_SYS_HYPERV_CPUID 191
897#define KVM_CAP_DIRTY_LOG_RING 192
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700898#define KVM_CAP_X86_BUS_LOCK_EXIT 193
899#define KVM_CAP_PPC_DAWR1 194
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000900#define KVM_CAP_SET_GUEST_DEBUG2 195
901#define KVM_CAP_SGX_ATTRIBUTE 196
902#define KVM_CAP_VM_COPY_ENC_CONTEXT_FROM 197
903#define KVM_CAP_PTP_KVM 198
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000904#define KVM_CAP_HYPERV_ENFORCE_CPUID 199
905#define KVM_CAP_SREGS2 200
906#define KVM_CAP_EXIT_HYPERCALL 201
907#define KVM_CAP_PPC_RPT_INVALIDATE 202
908#define KVM_CAP_BINARY_STATS_FD 203
909#define KVM_CAP_EXIT_ON_EMULATION_FAILURE 204
910#define KVM_CAP_ARM_MTE 205
Christopher Ferrisa4792612022-01-10 13:51:15 -0800911#define KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM 206
Christopher Ferris1ed55342022-03-22 16:06:25 -0700912#define KVM_CAP_VM_GPA_BITS 207
913#define KVM_CAP_XSAVE2 208
914#define KVM_CAP_SYS_ATTRIBUTES 209
915#define KVM_CAP_PPC_AIL_MODE_3 210
Christopher Ferris10a76e62022-06-08 13:31:52 -0700916#define KVM_CAP_S390_MEM_OP_EXTENSION 211
917#define KVM_CAP_PMU_CAPABILITY 212
918#define KVM_CAP_DISABLE_QUIRKS2 213
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700919#define KVM_CAP_VM_TSC_CONTROL 214
Christopher Ferris10a76e62022-06-08 13:31:52 -0700920#define KVM_CAP_SYSTEM_EVENT_DATA 215
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700921#define KVM_CAP_ARM_SYSTEM_SUSPEND 216
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700922#define KVM_CAP_S390_PROTECTED_DUMP 217
923#define KVM_CAP_X86_TRIPLE_FAULT_EVENT 218
924#define KVM_CAP_X86_NOTIFY_VMEXIT 219
925#define KVM_CAP_VM_DISABLE_NX_HUGE_PAGES 220
926#define KVM_CAP_S390_ZPCI_OP 221
927#define KVM_CAP_S390_CPU_TOPOLOGY 222
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000928#define KVM_CAP_DIRTY_LOG_RING_ACQ_REL 223
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800929#define KVM_CAP_S390_PROTECTED_ASYNC_DISABLE 224
930#define KVM_CAP_DIRTY_LOG_RING_WITH_BITMAP 225
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000931#define KVM_CAP_PMU_EVENT_MASKED_EVENTS 226
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700932#define KVM_CAP_COUNTER_OFFSET 227
Christopher Ferris8666d042023-09-06 14:55:31 -0700933#define KVM_CAP_ARM_EAGER_SPLIT_CHUNK_SIZE 228
934#define KVM_CAP_ARM_SUPPORTED_BLOCK_SIZES 229
Christopher Ferris0f795212024-01-17 14:17:28 -0800935#define KVM_CAP_ARM_SUPPORTED_REG_MASK_RANGES 230
Christopher Ferris05d08e92016-02-04 13:16:38 -0800936#ifdef KVM_CAP_IRQ_ROUTING
Christopher Ferris05d08e92016-02-04 13:16:38 -0800937struct kvm_irq_routing_irqchip {
Tao Baod7db5942015-01-28 10:07:51 -0800938 __u32 irqchip;
939 __u32 pin;
Ben Cheng655a7c02013-10-16 16:09:24 -0700940};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800941struct kvm_irq_routing_msi {
Tao Baod7db5942015-01-28 10:07:51 -0800942 __u32 address_lo;
943 __u32 address_hi;
944 __u32 data;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800945 union {
946 __u32 pad;
947 __u32 devid;
948 };
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700949};
950struct kvm_irq_routing_s390_adapter {
Tao Baod7db5942015-01-28 10:07:51 -0800951 __u64 ind_addr;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800952 __u64 summary_addr;
Tao Baod7db5942015-01-28 10:07:51 -0800953 __u64 ind_offset;
954 __u32 summary_offset;
955 __u32 adapter_id;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800956};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700957struct kvm_irq_routing_hv_sint {
958 __u32 vcpu;
959 __u32 sint;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700960};
Christopher Ferris1ed55342022-03-22 16:06:25 -0700961struct kvm_irq_routing_xen_evtchn {
962 __u32 port;
963 __u32 vcpu;
964 __u32 priority;
965};
966#define KVM_IRQ_ROUTING_XEN_EVTCHN_PRIO_2LEVEL ((__u32) (- 1))
Ben Cheng655a7c02013-10-16 16:09:24 -0700967#define KVM_IRQ_ROUTING_IRQCHIP 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700968#define KVM_IRQ_ROUTING_MSI 2
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700969#define KVM_IRQ_ROUTING_S390_ADAPTER 3
Christopher Ferris106b3a82016-08-24 12:15:38 -0700970#define KVM_IRQ_ROUTING_HV_SINT 4
Christopher Ferris1ed55342022-03-22 16:06:25 -0700971#define KVM_IRQ_ROUTING_XEN_EVTCHN 5
Christopher Ferris05d08e92016-02-04 13:16:38 -0800972struct kvm_irq_routing_entry {
Tao Baod7db5942015-01-28 10:07:51 -0800973 __u32 gsi;
974 __u32 type;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700975 __u32 flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800976 __u32 pad;
Tao Baod7db5942015-01-28 10:07:51 -0800977 union {
978 struct kvm_irq_routing_irqchip irqchip;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700979 struct kvm_irq_routing_msi msi;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800980 struct kvm_irq_routing_s390_adapter adapter;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700981 struct kvm_irq_routing_hv_sint hv_sint;
Christopher Ferris1ed55342022-03-22 16:06:25 -0700982 struct kvm_irq_routing_xen_evtchn xen_evtchn;
Tao Baod7db5942015-01-28 10:07:51 -0800983 __u32 pad[8];
984 } u;
Ben Cheng655a7c02013-10-16 16:09:24 -0700985};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800986struct kvm_irq_routing {
Tao Baod7db5942015-01-28 10:07:51 -0800987 __u32 nr;
988 __u32 flags;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700989 struct kvm_irq_routing_entry entries[];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800990};
Ben Cheng655a7c02013-10-16 16:09:24 -0700991#endif
992#ifdef KVM_CAP_MCE
993struct kvm_x86_mce {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800994 __u64 status;
Tao Baod7db5942015-01-28 10:07:51 -0800995 __u64 addr;
996 __u64 misc;
997 __u64 mcg_status;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800998 __u8 bank;
Tao Baod7db5942015-01-28 10:07:51 -0800999 __u8 pad1[7];
1000 __u64 pad2[3];
Ben Cheng655a7c02013-10-16 16:09:24 -07001001};
Christopher Ferris05d08e92016-02-04 13:16:38 -08001002#endif
Ben Cheng655a7c02013-10-16 16:09:24 -07001003#ifdef KVM_CAP_XEN_HVM
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001004#define KVM_XEN_HVM_CONFIG_HYPERCALL_MSR (1 << 0)
1005#define KVM_XEN_HVM_CONFIG_INTERCEPT_HCALL (1 << 1)
1006#define KVM_XEN_HVM_CONFIG_SHARED_INFO (1 << 2)
1007#define KVM_XEN_HVM_CONFIG_RUNSTATE (1 << 3)
Christopher Ferris1ed55342022-03-22 16:06:25 -07001008#define KVM_XEN_HVM_CONFIG_EVTCHN_2LEVEL (1 << 4)
Christopher Ferris80ae69d2022-08-02 16:32:21 -07001009#define KVM_XEN_HVM_CONFIG_EVTCHN_SEND (1 << 5)
Christopher Ferris8b7fdc92023-02-21 13:36:32 -08001010#define KVM_XEN_HVM_CONFIG_RUNSTATE_UPDATE_FLAG (1 << 6)
Ben Cheng655a7c02013-10-16 16:09:24 -07001011struct kvm_xen_hvm_config {
Tao Baod7db5942015-01-28 10:07:51 -08001012 __u32 flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -08001013 __u32 msr;
Tao Baod7db5942015-01-28 10:07:51 -08001014 __u64 blob_addr_32;
1015 __u64 blob_addr_64;
1016 __u8 blob_size_32;
Christopher Ferris05d08e92016-02-04 13:16:38 -08001017 __u8 blob_size_64;
Tao Baod7db5942015-01-28 10:07:51 -08001018 __u8 pad2[30];
Ben Cheng655a7c02013-10-16 16:09:24 -07001019};
1020#endif
Christopher Ferris05d08e92016-02-04 13:16:38 -08001021#define KVM_IRQFD_FLAG_DEASSIGN (1 << 0)
Ben Cheng655a7c02013-10-16 16:09:24 -07001022#define KVM_IRQFD_FLAG_RESAMPLE (1 << 1)
1023struct kvm_irqfd {
Tao Baod7db5942015-01-28 10:07:51 -08001024 __u32 fd;
Christopher Ferris05d08e92016-02-04 13:16:38 -08001025 __u32 gsi;
Tao Baod7db5942015-01-28 10:07:51 -08001026 __u32 flags;
1027 __u32 resamplefd;
1028 __u8 pad[16];
Christopher Ferris05d08e92016-02-04 13:16:38 -08001029};
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001030#define KVM_CLOCK_TSC_STABLE 2
Christopher Ferrisa4792612022-01-10 13:51:15 -08001031#define KVM_CLOCK_REALTIME (1 << 2)
1032#define KVM_CLOCK_HOST_TSC (1 << 3)
Ben Cheng655a7c02013-10-16 16:09:24 -07001033struct kvm_clock_data {
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001034 __u64 clock;
Tao Baod7db5942015-01-28 10:07:51 -08001035 __u32 flags;
Christopher Ferrisa4792612022-01-10 13:51:15 -08001036 __u32 pad0;
1037 __u64 realtime;
1038 __u64 host_tsc;
1039 __u32 pad[4];
Ben Cheng655a7c02013-10-16 16:09:24 -07001040};
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001041#define KVM_MMU_FSL_BOOKE_NOHV 0
Ben Cheng655a7c02013-10-16 16:09:24 -07001042#define KVM_MMU_FSL_BOOKE_HV 1
Christopher Ferris05d08e92016-02-04 13:16:38 -08001043struct kvm_config_tlb {
Tao Baod7db5942015-01-28 10:07:51 -08001044 __u64 params;
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001045 __u64 array;
Tao Baod7db5942015-01-28 10:07:51 -08001046 __u32 mmu_type;
Christopher Ferris05d08e92016-02-04 13:16:38 -08001047 __u32 array_len;
Ben Cheng655a7c02013-10-16 16:09:24 -07001048};
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001049struct kvm_dirty_tlb {
Tao Baod7db5942015-01-28 10:07:51 -08001050 __u64 bitmap;
Christopher Ferris05d08e92016-02-04 13:16:38 -08001051 __u32 num_dirty;
Ben Cheng655a7c02013-10-16 16:09:24 -07001052};
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001053#define KVM_REG_ARCH_MASK 0xff00000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -07001054#define KVM_REG_GENERIC 0x0000000000000000ULL
Christopher Ferris05d08e92016-02-04 13:16:38 -08001055#define KVM_REG_PPC 0x1000000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -07001056#define KVM_REG_X86 0x2000000000000000ULL
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001057#define KVM_REG_IA64 0x3000000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -07001058#define KVM_REG_ARM 0x4000000000000000ULL
Christopher Ferris05d08e92016-02-04 13:16:38 -08001059#define KVM_REG_S390 0x5000000000000000ULL
Christopher Ferris38062f92014-07-09 15:33:25 -07001060#define KVM_REG_ARM64 0x6000000000000000ULL
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001061#define KVM_REG_MIPS 0x7000000000000000ULL
Christopher Ferris9584fa42019-12-09 15:36:13 -08001062#define KVM_REG_RISCV 0x8000000000000000ULL
Christopher Ferris0f795212024-01-17 14:17:28 -08001063#define KVM_REG_LOONGARCH 0x9000000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -07001064#define KVM_REG_SIZE_SHIFT 52
Christopher Ferris05d08e92016-02-04 13:16:38 -08001065#define KVM_REG_SIZE_MASK 0x00f0000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -07001066#define KVM_REG_SIZE_U8 0x0000000000000000ULL
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001067#define KVM_REG_SIZE_U16 0x0010000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -07001068#define KVM_REG_SIZE_U32 0x0020000000000000ULL
Christopher Ferris05d08e92016-02-04 13:16:38 -08001069#define KVM_REG_SIZE_U64 0x0030000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -07001070#define KVM_REG_SIZE_U128 0x0040000000000000ULL
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001071#define KVM_REG_SIZE_U256 0x0050000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -07001072#define KVM_REG_SIZE_U512 0x0060000000000000ULL
Christopher Ferris05d08e92016-02-04 13:16:38 -08001073#define KVM_REG_SIZE_U1024 0x0070000000000000ULL
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -07001074#define KVM_REG_SIZE_U2048 0x0080000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -07001075struct kvm_reg_list {
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001076 __u64 n;
Christopher Ferris7447a1c2022-10-04 18:24:44 -07001077 __u64 reg[];
Christopher Ferris05d08e92016-02-04 13:16:38 -08001078};
Ben Cheng655a7c02013-10-16 16:09:24 -07001079struct kvm_one_reg {
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001080 __u64 id;
Tao Baod7db5942015-01-28 10:07:51 -08001081 __u64 addr;
Christopher Ferris05d08e92016-02-04 13:16:38 -08001082};
Christopher Ferris49f525c2016-12-12 14:55:36 -08001083#define KVM_MSI_VALID_DEVID (1U << 0)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001084struct kvm_msi {
Tao Baod7db5942015-01-28 10:07:51 -08001085 __u32 address_lo;
1086 __u32 address_hi;
Christopher Ferris05d08e92016-02-04 13:16:38 -08001087 __u32 data;
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001088 __u32 flags;
Christopher Ferris49f525c2016-12-12 14:55:36 -08001089 __u32 devid;
1090 __u8 pad[12];
Ben Cheng655a7c02013-10-16 16:09:24 -07001091};
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001092struct kvm_arm_device_addr {
Christopher Ferris49f525c2016-12-12 14:55:36 -08001093 __u64 id;
Tao Baod7db5942015-01-28 10:07:51 -08001094 __u64 addr;
Ben Cheng655a7c02013-10-16 16:09:24 -07001095};
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001096#define KVM_CREATE_DEVICE_TEST 1
Christopher Ferris49f525c2016-12-12 14:55:36 -08001097struct kvm_create_device {
Tao Baod7db5942015-01-28 10:07:51 -08001098 __u32 type;
1099 __u32 fd;
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001100 __u32 flags;
Christopher Ferris49f525c2016-12-12 14:55:36 -08001101};
Ben Cheng655a7c02013-10-16 16:09:24 -07001102struct kvm_device_attr {
Tao Baod7db5942015-01-28 10:07:51 -08001103 __u32 flags;
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001104 __u32 group;
Christopher Ferris49f525c2016-12-12 14:55:36 -08001105 __u64 attr;
Tao Baod7db5942015-01-28 10:07:51 -08001106 __u64 addr;
Ben Cheng655a7c02013-10-16 16:09:24 -07001107};
Christopher Ferris67d1e5e2023-10-31 13:36:37 -07001108#define KVM_DEV_VFIO_FILE 1
1109#define KVM_DEV_VFIO_FILE_ADD 1
1110#define KVM_DEV_VFIO_FILE_DEL 2
1111#define KVM_DEV_VFIO_GROUP KVM_DEV_VFIO_FILE
1112#define KVM_DEV_VFIO_GROUP_ADD KVM_DEV_VFIO_FILE_ADD
1113#define KVM_DEV_VFIO_GROUP_DEL KVM_DEV_VFIO_FILE_DEL
Christopher Ferris525ce912017-07-26 13:12:53 -07001114#define KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE 3
Christopher Ferris82d75042015-01-26 10:57:07 -08001115enum kvm_device_type {
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001116 KVM_DEV_TYPE_FSL_MPIC_20 = 1,
Christopher Ferris49f525c2016-12-12 14:55:36 -08001117#define KVM_DEV_TYPE_FSL_MPIC_20 KVM_DEV_TYPE_FSL_MPIC_20
Tao Baod7db5942015-01-28 10:07:51 -08001118 KVM_DEV_TYPE_FSL_MPIC_42,
Christopher Ferris82d75042015-01-26 10:57:07 -08001119#define KVM_DEV_TYPE_FSL_MPIC_42 KVM_DEV_TYPE_FSL_MPIC_42
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001120 KVM_DEV_TYPE_XICS,
Christopher Ferris49f525c2016-12-12 14:55:36 -08001121#define KVM_DEV_TYPE_XICS KVM_DEV_TYPE_XICS
Tao Baod7db5942015-01-28 10:07:51 -08001122 KVM_DEV_TYPE_VFIO,
Christopher Ferris82d75042015-01-26 10:57:07 -08001123#define KVM_DEV_TYPE_VFIO KVM_DEV_TYPE_VFIO
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001124 KVM_DEV_TYPE_ARM_VGIC_V2,
Christopher Ferris49f525c2016-12-12 14:55:36 -08001125#define KVM_DEV_TYPE_ARM_VGIC_V2 KVM_DEV_TYPE_ARM_VGIC_V2
Tao Baod7db5942015-01-28 10:07:51 -08001126 KVM_DEV_TYPE_FLIC,
Christopher Ferris82d75042015-01-26 10:57:07 -08001127#define KVM_DEV_TYPE_FLIC KVM_DEV_TYPE_FLIC
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001128 KVM_DEV_TYPE_ARM_VGIC_V3,
Christopher Ferris49f525c2016-12-12 14:55:36 -08001129#define KVM_DEV_TYPE_ARM_VGIC_V3 KVM_DEV_TYPE_ARM_VGIC_V3
1130 KVM_DEV_TYPE_ARM_VGIC_ITS,
1131#define KVM_DEV_TYPE_ARM_VGIC_ITS KVM_DEV_TYPE_ARM_VGIC_ITS
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -07001132 KVM_DEV_TYPE_XIVE,
1133#define KVM_DEV_TYPE_XIVE KVM_DEV_TYPE_XIVE
Christopher Ferrisd32ca142020-02-04 16:16:51 -08001134 KVM_DEV_TYPE_ARM_PV_TIME,
1135#define KVM_DEV_TYPE_ARM_PV_TIME KVM_DEV_TYPE_ARM_PV_TIME
Christopher Ferris8666d042023-09-06 14:55:31 -07001136 KVM_DEV_TYPE_RISCV_AIA,
1137#define KVM_DEV_TYPE_RISCV_AIA KVM_DEV_TYPE_RISCV_AIA
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001138 KVM_DEV_TYPE_MAX,
Christopher Ferris82d75042015-01-26 10:57:07 -08001139};
Christopher Ferris525ce912017-07-26 13:12:53 -07001140struct kvm_vfio_spapr_tce {
1141 __s32 groupfd;
1142 __s32 tablefd;
1143};
Ben Cheng655a7c02013-10-16 16:09:24 -07001144#define KVM_CREATE_VCPU _IO(KVMIO, 0x41)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001145#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log)
Ben Cheng655a7c02013-10-16 16:09:24 -07001146#define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44)
Ben Cheng655a7c02013-10-16 16:09:24 -07001147#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001148#define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46, struct kvm_userspace_memory_region)
Ben Cheng655a7c02013-10-16 16:09:24 -07001149#define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47)
1150#define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64)
Ben Cheng655a7c02013-10-16 16:09:24 -07001151struct kvm_s390_ucas_mapping {
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001152 __u64 user_addr;
Tao Baod7db5942015-01-28 10:07:51 -08001153 __u64 vcpu_addr;
1154 __u64 length;
Ben Cheng655a7c02013-10-16 16:09:24 -07001155};
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001156#define KVM_S390_UCAS_MAP _IOW(KVMIO, 0x50, struct kvm_s390_ucas_mapping)
Ben Cheng655a7c02013-10-16 16:09:24 -07001157#define KVM_S390_UCAS_UNMAP _IOW(KVMIO, 0x51, struct kvm_s390_ucas_mapping)
1158#define KVM_S390_VCPU_FAULT _IOW(KVMIO, 0x52, unsigned long)
Ben Cheng655a7c02013-10-16 16:09:24 -07001159#define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001160#define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level)
Ben Cheng655a7c02013-10-16 16:09:24 -07001161#define KVM_GET_IRQCHIP _IOWR(KVMIO, 0x62, struct kvm_irqchip)
1162#define KVM_SET_IRQCHIP _IOR(KVMIO, 0x63, struct kvm_irqchip)
Ben Cheng655a7c02013-10-16 16:09:24 -07001163#define KVM_CREATE_PIT _IO(KVMIO, 0x64)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001164#define KVM_GET_PIT _IOWR(KVMIO, 0x65, struct kvm_pit_state)
Ben Cheng655a7c02013-10-16 16:09:24 -07001165#define KVM_SET_PIT _IOR(KVMIO, 0x66, struct kvm_pit_state)
1166#define KVM_IRQ_LINE_STATUS _IOWR(KVMIO, 0x67, struct kvm_irq_level)
Tao Baod7db5942015-01-28 10:07:51 -08001167#define KVM_REGISTER_COALESCED_MMIO _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001168#define KVM_UNREGISTER_COALESCED_MMIO _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone)
Tao Baod7db5942015-01-28 10:07:51 -08001169#define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, struct kvm_assigned_pci_dev)
Ben Cheng655a7c02013-10-16 16:09:24 -07001170#define KVM_SET_GSI_ROUTING _IOW(KVMIO, 0x6a, struct kvm_irq_routing)
Ben Cheng655a7c02013-10-16 16:09:24 -07001171#define KVM_ASSIGN_IRQ __KVM_DEPRECATED_VM_R_0x70
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001172#define KVM_ASSIGN_DEV_IRQ _IOW(KVMIO, 0x70, struct kvm_assigned_irq)
Ben Cheng655a7c02013-10-16 16:09:24 -07001173#define KVM_REINJECT_CONTROL _IO(KVMIO, 0x71)
Tao Baod7db5942015-01-28 10:07:51 -08001174#define KVM_DEASSIGN_PCI_DEVICE _IOW(KVMIO, 0x72, struct kvm_assigned_pci_dev)
1175#define KVM_ASSIGN_SET_MSIX_NR _IOW(KVMIO, 0x73, struct kvm_assigned_msix_nr)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001176#define KVM_ASSIGN_SET_MSIX_ENTRY _IOW(KVMIO, 0x74, struct kvm_assigned_msix_entry)
Ben Cheng655a7c02013-10-16 16:09:24 -07001177#define KVM_DEASSIGN_DEV_IRQ _IOW(KVMIO, 0x75, struct kvm_assigned_irq)
1178#define KVM_IRQFD _IOW(KVMIO, 0x76, struct kvm_irqfd)
Ben Cheng655a7c02013-10-16 16:09:24 -07001179#define KVM_CREATE_PIT2 _IOW(KVMIO, 0x77, struct kvm_pit_config)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001180#define KVM_SET_BOOT_CPU_ID _IO(KVMIO, 0x78)
Ben Cheng655a7c02013-10-16 16:09:24 -07001181#define KVM_IOEVENTFD _IOW(KVMIO, 0x79, struct kvm_ioeventfd)
1182#define KVM_XEN_HVM_CONFIG _IOW(KVMIO, 0x7a, struct kvm_xen_hvm_config)
Ben Cheng655a7c02013-10-16 16:09:24 -07001183#define KVM_SET_CLOCK _IOW(KVMIO, 0x7b, struct kvm_clock_data)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001184#define KVM_GET_CLOCK _IOR(KVMIO, 0x7c, struct kvm_clock_data)
Ben Cheng655a7c02013-10-16 16:09:24 -07001185#define KVM_GET_PIT2 _IOR(KVMIO, 0x9f, struct kvm_pit_state2)
1186#define KVM_SET_PIT2 _IOW(KVMIO, 0xa0, struct kvm_pit_state2)
Ben Cheng655a7c02013-10-16 16:09:24 -07001187#define KVM_PPC_GET_PVINFO _IOW(KVMIO, 0xa1, struct kvm_ppc_pvinfo)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001188#define KVM_SET_TSC_KHZ _IO(KVMIO, 0xa2)
Ben Cheng655a7c02013-10-16 16:09:24 -07001189#define KVM_GET_TSC_KHZ _IO(KVMIO, 0xa3)
Tao Baod7db5942015-01-28 10:07:51 -08001190#define KVM_ASSIGN_SET_INTX_MASK _IOW(KVMIO, 0xa4, struct kvm_assigned_pci_dev)
Ben Cheng655a7c02013-10-16 16:09:24 -07001191#define KVM_SIGNAL_MSI _IOW(KVMIO, 0xa5, struct kvm_msi)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001192#define KVM_PPC_GET_SMMU_INFO _IOR(KVMIO, 0xa6, struct kvm_ppc_smmu_info)
Ben Cheng655a7c02013-10-16 16:09:24 -07001193#define KVM_PPC_ALLOCATE_HTAB _IOWR(KVMIO, 0xa7, __u32)
1194#define KVM_CREATE_SPAPR_TCE _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce)
Christopher Ferris106b3a82016-08-24 12:15:38 -07001195#define KVM_CREATE_SPAPR_TCE_64 _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce_64)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001196#define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma)
Christopher Ferris38062f92014-07-09 15:33:25 -07001197#define KVM_PPC_GET_HTAB_FD _IOW(KVMIO, 0xaa, struct kvm_get_htab_fd)
Ben Cheng655a7c02013-10-16 16:09:24 -07001198#define KVM_ARM_SET_DEVICE_ADDR _IOW(KVMIO, 0xab, struct kvm_arm_device_addr)
1199#define KVM_PPC_RTAS_DEFINE_TOKEN _IOW(KVMIO, 0xac, struct kvm_rtas_token_args)
Christopher Ferris525ce912017-07-26 13:12:53 -07001200#define KVM_PPC_RESIZE_HPT_PREPARE _IOR(KVMIO, 0xad, struct kvm_ppc_resize_hpt)
1201#define KVM_PPC_RESIZE_HPT_COMMIT _IOR(KVMIO, 0xae, struct kvm_ppc_resize_hpt)
1202#define KVM_PPC_CONFIGURE_V3_MMU _IOW(KVMIO, 0xaf, struct kvm_ppc_mmuv3_cfg)
1203#define KVM_PPC_GET_RMMU_INFO _IOW(KVMIO, 0xb0, struct kvm_ppc_rmmu_info)
Christopher Ferris934ec942018-01-31 15:29:16 -08001204#define KVM_PPC_GET_CPU_CHAR _IOR(KVMIO, 0xb1, struct kvm_ppc_cpu_char)
Christopher Ferrisb8a95e22019-10-02 18:29:20 -07001205#define KVM_SET_PMU_EVENT_FILTER _IOW(KVMIO, 0xb2, struct kvm_pmu_event_filter)
Christopher Ferrisd32ca142020-02-04 16:16:51 -08001206#define KVM_PPC_SVM_OFF _IO(KVMIO, 0xb3)
Christopher Ferris3a39c0b2021-09-02 00:03:38 +00001207#define KVM_ARM_MTE_COPY_TAGS _IOR(KVMIO, 0xb4, struct kvm_arm_copy_mte_tags)
Christopher Ferris37c3f3c2023-07-10 10:59:05 -07001208#define KVM_ARM_SET_COUNTER_OFFSET _IOW(KVMIO, 0xb5, struct kvm_arm_counter_offset)
Christopher Ferris0f795212024-01-17 14:17:28 -08001209#define KVM_ARM_GET_REG_WRITABLE_MASKS _IOR(KVMIO, 0xb6, struct reg_mask_range)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001210#define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device)
Christopher Ferris38062f92014-07-09 15:33:25 -07001211#define KVM_SET_DEVICE_ATTR _IOW(KVMIO, 0xe1, struct kvm_device_attr)
Ben Cheng655a7c02013-10-16 16:09:24 -07001212#define KVM_GET_DEVICE_ATTR _IOW(KVMIO, 0xe2, struct kvm_device_attr)
1213#define KVM_HAS_DEVICE_ATTR _IOW(KVMIO, 0xe3, struct kvm_device_attr)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001214#define KVM_RUN _IO(KVMIO, 0x80)
Christopher Ferris38062f92014-07-09 15:33:25 -07001215#define KVM_GET_REGS _IOR(KVMIO, 0x81, struct kvm_regs)
Ben Cheng655a7c02013-10-16 16:09:24 -07001216#define KVM_SET_REGS _IOW(KVMIO, 0x82, struct kvm_regs)
1217#define KVM_GET_SREGS _IOR(KVMIO, 0x83, struct kvm_sregs)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001218#define KVM_SET_SREGS _IOW(KVMIO, 0x84, struct kvm_sregs)
Christopher Ferris38062f92014-07-09 15:33:25 -07001219#define KVM_TRANSLATE _IOWR(KVMIO, 0x85, struct kvm_translation)
Ben Cheng655a7c02013-10-16 16:09:24 -07001220#define KVM_INTERRUPT _IOW(KVMIO, 0x86, struct kvm_interrupt)
1221#define KVM_DEBUG_GUEST __KVM_DEPRECATED_VCPU_W_0x87
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001222#define KVM_GET_MSRS _IOWR(KVMIO, 0x88, struct kvm_msrs)
Christopher Ferris38062f92014-07-09 15:33:25 -07001223#define KVM_SET_MSRS _IOW(KVMIO, 0x89, struct kvm_msrs)
Ben Cheng655a7c02013-10-16 16:09:24 -07001224#define KVM_SET_CPUID _IOW(KVMIO, 0x8a, struct kvm_cpuid)
1225#define KVM_SET_SIGNAL_MASK _IOW(KVMIO, 0x8b, struct kvm_signal_mask)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001226#define KVM_GET_FPU _IOR(KVMIO, 0x8c, struct kvm_fpu)
Christopher Ferris38062f92014-07-09 15:33:25 -07001227#define KVM_SET_FPU _IOW(KVMIO, 0x8d, struct kvm_fpu)
Ben Cheng655a7c02013-10-16 16:09:24 -07001228#define KVM_GET_LAPIC _IOR(KVMIO, 0x8e, struct kvm_lapic_state)
1229#define KVM_SET_LAPIC _IOW(KVMIO, 0x8f, struct kvm_lapic_state)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001230#define KVM_SET_CPUID2 _IOW(KVMIO, 0x90, struct kvm_cpuid2)
Christopher Ferris38062f92014-07-09 15:33:25 -07001231#define KVM_GET_CPUID2 _IOWR(KVMIO, 0x91, struct kvm_cpuid2)
Ben Cheng655a7c02013-10-16 16:09:24 -07001232#define KVM_TPR_ACCESS_REPORTING _IOWR(KVMIO, 0x92, struct kvm_tpr_access_ctl)
1233#define KVM_SET_VAPIC_ADDR _IOW(KVMIO, 0x93, struct kvm_vapic_addr)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001234#define KVM_S390_INTERRUPT _IOW(KVMIO, 0x94, struct kvm_s390_interrupt)
Tao Baod7db5942015-01-28 10:07:51 -08001235#define KVM_S390_STORE_STATUS_NOADDR (- 1ul)
Tao Baod7db5942015-01-28 10:07:51 -08001236#define KVM_S390_STORE_STATUS_PREFIXED (- 2ul)
Ben Cheng655a7c02013-10-16 16:09:24 -07001237#define KVM_S390_STORE_STATUS _IOW(KVMIO, 0x95, unsigned long)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001238#define KVM_S390_SET_INITIAL_PSW _IOW(KVMIO, 0x96, struct kvm_s390_psw)
Christopher Ferris38062f92014-07-09 15:33:25 -07001239#define KVM_S390_INITIAL_RESET _IO(KVMIO, 0x97)
Ben Cheng655a7c02013-10-16 16:09:24 -07001240#define KVM_GET_MP_STATE _IOR(KVMIO, 0x98, struct kvm_mp_state)
1241#define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001242#define KVM_NMI _IO(KVMIO, 0x9a)
Christopher Ferris38062f92014-07-09 15:33:25 -07001243#define KVM_SET_GUEST_DEBUG _IOW(KVMIO, 0x9b, struct kvm_guest_debug)
Ben Cheng655a7c02013-10-16 16:09:24 -07001244#define KVM_X86_SETUP_MCE _IOW(KVMIO, 0x9c, __u64)
1245#define KVM_X86_GET_MCE_CAP_SUPPORTED _IOR(KVMIO, 0x9d, __u64)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001246#define KVM_X86_SET_MCE _IOW(KVMIO, 0x9e, struct kvm_x86_mce)
Ben Cheng655a7c02013-10-16 16:09:24 -07001247#define KVM_GET_VCPU_EVENTS _IOR(KVMIO, 0x9f, struct kvm_vcpu_events)
Ben Cheng655a7c02013-10-16 16:09:24 -07001248#define KVM_SET_VCPU_EVENTS _IOW(KVMIO, 0xa0, struct kvm_vcpu_events)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001249#define KVM_GET_DEBUGREGS _IOR(KVMIO, 0xa1, struct kvm_debugregs)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001250#define KVM_SET_DEBUGREGS _IOW(KVMIO, 0xa2, struct kvm_debugregs)
Ben Cheng655a7c02013-10-16 16:09:24 -07001251#define KVM_ENABLE_CAP _IOW(KVMIO, 0xa3, struct kvm_enable_cap)
Ben Cheng655a7c02013-10-16 16:09:24 -07001252#define KVM_GET_XSAVE _IOR(KVMIO, 0xa4, struct kvm_xsave)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001253#define KVM_SET_XSAVE _IOW(KVMIO, 0xa5, struct kvm_xsave)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001254#define KVM_GET_XCRS _IOR(KVMIO, 0xa6, struct kvm_xcrs)
Ben Cheng655a7c02013-10-16 16:09:24 -07001255#define KVM_SET_XCRS _IOW(KVMIO, 0xa7, struct kvm_xcrs)
Ben Cheng655a7c02013-10-16 16:09:24 -07001256#define KVM_DIRTY_TLB _IOW(KVMIO, 0xaa, struct kvm_dirty_tlb)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001257#define KVM_GET_ONE_REG _IOW(KVMIO, 0xab, struct kvm_one_reg)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001258#define KVM_SET_ONE_REG _IOW(KVMIO, 0xac, struct kvm_one_reg)
Ben Cheng655a7c02013-10-16 16:09:24 -07001259#define KVM_KVMCLOCK_CTRL _IO(KVMIO, 0xad)
Ben Cheng655a7c02013-10-16 16:09:24 -07001260#define KVM_ARM_VCPU_INIT _IOW(KVMIO, 0xae, struct kvm_vcpu_init)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001261#define KVM_ARM_PREFERRED_TARGET _IOR(KVMIO, 0xaf, struct kvm_vcpu_init)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001262#define KVM_GET_REG_LIST _IOWR(KVMIO, 0xb0, struct kvm_reg_list)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001263#define KVM_S390_MEM_OP _IOW(KVMIO, 0xb1, struct kvm_s390_mem_op)
1264#define KVM_S390_GET_SKEYS _IOW(KVMIO, 0xb2, struct kvm_s390_skeys)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001265#define KVM_S390_SET_SKEYS _IOW(KVMIO, 0xb3, struct kvm_s390_skeys)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001266#define KVM_S390_IRQ _IOW(KVMIO, 0xb4, struct kvm_s390_irq)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001267#define KVM_S390_SET_IRQ_STATE _IOW(KVMIO, 0xb5, struct kvm_s390_irq_state)
1268#define KVM_S390_GET_IRQ_STATE _IOW(KVMIO, 0xb6, struct kvm_s390_irq_state)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001269#define KVM_SMI _IO(KVMIO, 0xb7)
Christopher Ferris1308ad32017-11-14 17:32:13 -08001270#define KVM_S390_GET_CMMA_BITS _IOWR(KVMIO, 0xb8, struct kvm_s390_cmma_log)
1271#define KVM_S390_SET_CMMA_BITS _IOW(KVMIO, 0xb9, struct kvm_s390_cmma_log)
Christopher Ferris76a1d452018-06-27 14:12:29 -07001272#define KVM_MEMORY_ENCRYPT_OP _IOWR(KVMIO, 0xba, unsigned long)
1273struct kvm_enc_region {
1274 __u64 addr;
1275 __u64 size;
1276};
1277#define KVM_MEMORY_ENCRYPT_REG_REGION _IOR(KVMIO, 0xbb, struct kvm_enc_region)
1278#define KVM_MEMORY_ENCRYPT_UNREG_REGION _IOR(KVMIO, 0xbc, struct kvm_enc_region)
1279#define KVM_HYPERV_EVENTFD _IOW(KVMIO, 0xbd, struct kvm_hyperv_eventfd)
Christopher Ferris9ce28842018-10-25 12:11:39 -07001280#define KVM_GET_NESTED_STATE _IOWR(KVMIO, 0xbe, struct kvm_nested_state)
1281#define KVM_SET_NESTED_STATE _IOW(KVMIO, 0xbf, struct kvm_nested_state)
Christopher Ferrisd842e432019-03-07 10:21:59 -08001282#define KVM_CLEAR_DIRTY_LOG _IOWR(KVMIO, 0xc0, struct kvm_clear_dirty_log)
1283#define KVM_GET_SUPPORTED_HV_CPUID _IOWR(KVMIO, 0xc1, struct kvm_cpuid2)
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -07001284#define KVM_ARM_VCPU_FINALIZE _IOW(KVMIO, 0xc2, int)
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -07001285#define KVM_S390_NORMAL_RESET _IO(KVMIO, 0xc3)
1286#define KVM_S390_CLEAR_RESET _IO(KVMIO, 0xc4)
Christopher Ferrisaf09c702020-06-01 20:29:29 -07001287struct kvm_s390_pv_sec_parm {
1288 __u64 origin;
1289 __u64 length;
1290};
1291struct kvm_s390_pv_unp {
1292 __u64 addr;
1293 __u64 size;
1294 __u64 tweak;
1295};
Christopher Ferris7447a1c2022-10-04 18:24:44 -07001296enum pv_cmd_dmp_id {
1297 KVM_PV_DUMP_INIT,
1298 KVM_PV_DUMP_CONFIG_STOR_STATE,
1299 KVM_PV_DUMP_COMPLETE,
1300 KVM_PV_DUMP_CPU,
1301};
1302struct kvm_s390_pv_dmp {
1303 __u64 subcmd;
1304 __u64 buff_addr;
1305 __u64 buff_len;
1306 __u64 gaddr;
1307 __u64 reserved[4];
1308};
1309enum pv_cmd_info_id {
1310 KVM_PV_INFO_VM,
1311 KVM_PV_INFO_DUMP,
1312};
1313struct kvm_s390_pv_info_dump {
1314 __u64 dump_cpu_buffer_len;
1315 __u64 dump_config_mem_buffer_per_1m;
1316 __u64 dump_config_finalize_len;
1317};
1318struct kvm_s390_pv_info_vm {
1319 __u64 inst_calls_list[4];
1320 __u64 max_cpus;
1321 __u64 max_guests;
1322 __u64 max_guest_addr;
1323 __u64 feature_indication;
1324};
1325struct kvm_s390_pv_info_header {
1326 __u32 id;
1327 __u32 len_max;
1328 __u32 len_written;
1329 __u32 reserved;
1330};
1331struct kvm_s390_pv_info {
1332 struct kvm_s390_pv_info_header header;
1333 union {
1334 struct kvm_s390_pv_info_dump dump;
1335 struct kvm_s390_pv_info_vm vm;
1336 };
1337};
Christopher Ferrisaf09c702020-06-01 20:29:29 -07001338enum pv_cmd_id {
1339 KVM_PV_ENABLE,
1340 KVM_PV_DISABLE,
1341 KVM_PV_SET_SEC_PARMS,
1342 KVM_PV_UNPACK,
1343 KVM_PV_VERIFY,
1344 KVM_PV_PREP_RESET,
1345 KVM_PV_UNSHARE_ALL,
Christopher Ferris7447a1c2022-10-04 18:24:44 -07001346 KVM_PV_INFO,
1347 KVM_PV_DUMP,
Christopher Ferris8b7fdc92023-02-21 13:36:32 -08001348 KVM_PV_ASYNC_CLEANUP_PREPARE,
1349 KVM_PV_ASYNC_CLEANUP_PERFORM,
Christopher Ferrisaf09c702020-06-01 20:29:29 -07001350};
1351struct kvm_pv_cmd {
1352 __u32 cmd;
1353 __u16 rc;
1354 __u16 rrc;
1355 __u64 data;
1356 __u32 flags;
1357 __u32 reserved[3];
1358};
1359#define KVM_S390_PV_COMMAND _IOWR(KVMIO, 0xc5, struct kvm_pv_cmd)
Christopher Ferris32ff3f82020-12-14 13:10:04 -08001360#define KVM_X86_SET_MSR_FILTER _IOW(KVMIO, 0xc6, struct kvm_msr_filter)
Christopher Ferris05667cd2021-02-16 16:01:34 -08001361#define KVM_RESET_DIRTY_RINGS _IO(KVMIO, 0xc7)
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001362#define KVM_XEN_HVM_GET_ATTR _IOWR(KVMIO, 0xc8, struct kvm_xen_hvm_attr)
1363#define KVM_XEN_HVM_SET_ATTR _IOW(KVMIO, 0xc9, struct kvm_xen_hvm_attr)
1364struct kvm_xen_hvm_attr {
1365 __u16 type;
1366 __u16 pad[3];
1367 union {
1368 __u8 long_mode;
1369 __u8 vector;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -08001370 __u8 runstate_update_flag;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001371 struct {
1372 __u64 gfn;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -08001373#define KVM_XEN_INVALID_GFN ((__u64) - 1)
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001374 } shared_info;
Christopher Ferris80ae69d2022-08-02 16:32:21 -07001375 struct {
1376 __u32 send_port;
1377 __u32 type;
1378 __u32 flags;
1379#define KVM_XEN_EVTCHN_DEASSIGN (1 << 0)
1380#define KVM_XEN_EVTCHN_UPDATE (1 << 1)
1381#define KVM_XEN_EVTCHN_RESET (1 << 2)
1382 union {
1383 struct {
1384 __u32 port;
1385 __u32 vcpu;
1386 __u32 priority;
1387 } port;
1388 struct {
1389 __u32 port;
1390 __s32 fd;
1391 } eventfd;
1392 __u32 padding[4];
1393 } deliver;
1394 } evtchn;
1395 __u32 xen_version;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001396 __u64 pad[8];
1397 } u;
1398};
1399#define KVM_XEN_ATTR_TYPE_LONG_MODE 0x0
1400#define KVM_XEN_ATTR_TYPE_SHARED_INFO 0x1
1401#define KVM_XEN_ATTR_TYPE_UPCALL_VECTOR 0x2
Christopher Ferris80ae69d2022-08-02 16:32:21 -07001402#define KVM_XEN_ATTR_TYPE_EVTCHN 0x3
1403#define KVM_XEN_ATTR_TYPE_XEN_VERSION 0x4
Christopher Ferris8b7fdc92023-02-21 13:36:32 -08001404#define KVM_XEN_ATTR_TYPE_RUNSTATE_UPDATE_FLAG 0x5
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001405#define KVM_XEN_VCPU_GET_ATTR _IOWR(KVMIO, 0xca, struct kvm_xen_vcpu_attr)
1406#define KVM_XEN_VCPU_SET_ATTR _IOW(KVMIO, 0xcb, struct kvm_xen_vcpu_attr)
Christopher Ferris80ae69d2022-08-02 16:32:21 -07001407#define KVM_XEN_HVM_EVTCHN_SEND _IOW(KVMIO, 0xd0, struct kvm_irq_routing_xen_evtchn)
Christopher Ferris3a39c0b2021-09-02 00:03:38 +00001408#define KVM_GET_SREGS2 _IOR(KVMIO, 0xcc, struct kvm_sregs2)
1409#define KVM_SET_SREGS2 _IOW(KVMIO, 0xcd, struct kvm_sregs2)
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001410struct kvm_xen_vcpu_attr {
1411 __u16 type;
1412 __u16 pad[3];
1413 union {
1414 __u64 gpa;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -08001415#define KVM_XEN_INVALID_GPA ((__u64) - 1)
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001416 __u64 pad[8];
1417 struct {
1418 __u64 state;
1419 __u64 state_entry_time;
1420 __u64 time_running;
1421 __u64 time_runnable;
1422 __u64 time_blocked;
1423 __u64 time_offline;
1424 } runstate;
Christopher Ferris80ae69d2022-08-02 16:32:21 -07001425 __u32 vcpu_id;
1426 struct {
1427 __u32 port;
1428 __u32 priority;
1429 __u64 expires_ns;
1430 } timer;
1431 __u8 vector;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001432 } u;
1433};
1434#define KVM_XEN_VCPU_ATTR_TYPE_VCPU_INFO 0x0
1435#define KVM_XEN_VCPU_ATTR_TYPE_VCPU_TIME_INFO 0x1
1436#define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_ADDR 0x2
1437#define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_CURRENT 0x3
1438#define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_DATA 0x4
1439#define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_ADJUST 0x5
Christopher Ferris80ae69d2022-08-02 16:32:21 -07001440#define KVM_XEN_VCPU_ATTR_TYPE_VCPU_ID 0x6
1441#define KVM_XEN_VCPU_ATTR_TYPE_TIMER 0x7
1442#define KVM_XEN_VCPU_ATTR_TYPE_UPCALL_VECTOR 0x8
Christopher Ferris76a1d452018-06-27 14:12:29 -07001443enum sev_cmd_id {
1444 KVM_SEV_INIT = 0,
1445 KVM_SEV_ES_INIT,
1446 KVM_SEV_LAUNCH_START,
1447 KVM_SEV_LAUNCH_UPDATE_DATA,
1448 KVM_SEV_LAUNCH_UPDATE_VMSA,
1449 KVM_SEV_LAUNCH_SECRET,
1450 KVM_SEV_LAUNCH_MEASURE,
1451 KVM_SEV_LAUNCH_FINISH,
1452 KVM_SEV_SEND_START,
1453 KVM_SEV_SEND_UPDATE_DATA,
1454 KVM_SEV_SEND_UPDATE_VMSA,
1455 KVM_SEV_SEND_FINISH,
1456 KVM_SEV_RECEIVE_START,
1457 KVM_SEV_RECEIVE_UPDATE_DATA,
1458 KVM_SEV_RECEIVE_UPDATE_VMSA,
1459 KVM_SEV_RECEIVE_FINISH,
1460 KVM_SEV_GUEST_STATUS,
1461 KVM_SEV_DBG_DECRYPT,
1462 KVM_SEV_DBG_ENCRYPT,
1463 KVM_SEV_CERT_EXPORT,
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001464 KVM_SEV_GET_ATTESTATION_REPORT,
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +00001465 KVM_SEV_SEND_CANCEL,
Christopher Ferris76a1d452018-06-27 14:12:29 -07001466 KVM_SEV_NR_MAX,
1467};
1468struct kvm_sev_cmd {
1469 __u32 id;
1470 __u64 data;
1471 __u32 error;
1472 __u32 sev_fd;
1473};
1474struct kvm_sev_launch_start {
1475 __u32 handle;
1476 __u32 policy;
1477 __u64 dh_uaddr;
1478 __u32 dh_len;
1479 __u64 session_uaddr;
1480 __u32 session_len;
1481};
1482struct kvm_sev_launch_update_data {
1483 __u64 uaddr;
1484 __u32 len;
1485};
1486struct kvm_sev_launch_secret {
1487 __u64 hdr_uaddr;
1488 __u32 hdr_len;
1489 __u64 guest_uaddr;
1490 __u32 guest_len;
1491 __u64 trans_uaddr;
1492 __u32 trans_len;
1493};
1494struct kvm_sev_launch_measure {
1495 __u64 uaddr;
1496 __u32 len;
1497};
1498struct kvm_sev_guest_status {
1499 __u32 handle;
1500 __u32 policy;
1501 __u32 state;
1502};
1503struct kvm_sev_dbg {
1504 __u64 src_uaddr;
1505 __u64 dst_uaddr;
1506 __u32 len;
1507};
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001508struct kvm_sev_attestation_report {
1509 __u8 mnonce[16];
1510 __u64 uaddr;
1511 __u32 len;
1512};
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +00001513struct kvm_sev_send_start {
1514 __u32 policy;
1515 __u64 pdh_cert_uaddr;
1516 __u32 pdh_cert_len;
1517 __u64 plat_certs_uaddr;
1518 __u32 plat_certs_len;
1519 __u64 amd_certs_uaddr;
1520 __u32 amd_certs_len;
1521 __u64 session_uaddr;
1522 __u32 session_len;
1523};
1524struct kvm_sev_send_update_data {
1525 __u64 hdr_uaddr;
1526 __u32 hdr_len;
1527 __u64 guest_uaddr;
1528 __u32 guest_len;
1529 __u64 trans_uaddr;
1530 __u32 trans_len;
1531};
1532struct kvm_sev_receive_start {
1533 __u32 handle;
1534 __u32 policy;
1535 __u64 pdh_uaddr;
1536 __u32 pdh_len;
1537 __u64 session_uaddr;
1538 __u32 session_len;
1539};
1540struct kvm_sev_receive_update_data {
1541 __u64 hdr_uaddr;
1542 __u32 hdr_len;
1543 __u64 guest_uaddr;
1544 __u32 guest_len;
1545 __u64 trans_uaddr;
1546 __u32 trans_len;
1547};
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001548#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
Ben Cheng655a7c02013-10-16 16:09:24 -07001549#define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1)
Ben Cheng655a7c02013-10-16 16:09:24 -07001550#define KVM_DEV_ASSIGN_MASK_INTX (1 << 2)
1551struct kvm_assigned_pci_dev {
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001552 __u32 assigned_dev_id;
Tao Baod7db5942015-01-28 10:07:51 -08001553 __u32 busnr;
1554 __u32 devfn;
Tao Baod7db5942015-01-28 10:07:51 -08001555 __u32 flags;
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001556 __u32 segnr;
Tao Baod7db5942015-01-28 10:07:51 -08001557 union {
1558 __u32 reserved[11];
Tao Baod7db5942015-01-28 10:07:51 -08001559 };
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001560};
Ben Cheng655a7c02013-10-16 16:09:24 -07001561#define KVM_DEV_IRQ_HOST_INTX (1 << 0)
Ben Cheng655a7c02013-10-16 16:09:24 -07001562#define KVM_DEV_IRQ_HOST_MSI (1 << 1)
1563#define KVM_DEV_IRQ_HOST_MSIX (1 << 2)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001564#define KVM_DEV_IRQ_GUEST_INTX (1 << 8)
Ben Cheng655a7c02013-10-16 16:09:24 -07001565#define KVM_DEV_IRQ_GUEST_MSI (1 << 9)
Ben Cheng655a7c02013-10-16 16:09:24 -07001566#define KVM_DEV_IRQ_GUEST_MSIX (1 << 10)
1567#define KVM_DEV_IRQ_HOST_MASK 0x00ff
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001568#define KVM_DEV_IRQ_GUEST_MASK 0xff00
Ben Cheng655a7c02013-10-16 16:09:24 -07001569struct kvm_assigned_irq {
Tao Baod7db5942015-01-28 10:07:51 -08001570 __u32 assigned_dev_id;
Tao Baod7db5942015-01-28 10:07:51 -08001571 __u32 host_irq;
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001572 __u32 guest_irq;
Tao Baod7db5942015-01-28 10:07:51 -08001573 __u32 flags;
1574 union {
Tao Baod7db5942015-01-28 10:07:51 -08001575 __u32 reserved[12];
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001576 };
Ben Cheng655a7c02013-10-16 16:09:24 -07001577};
Ben Cheng655a7c02013-10-16 16:09:24 -07001578struct kvm_assigned_msix_nr {
Tao Baod7db5942015-01-28 10:07:51 -08001579 __u32 assigned_dev_id;
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001580 __u16 entry_nr;
Tao Baod7db5942015-01-28 10:07:51 -08001581 __u16 padding;
Ben Cheng655a7c02013-10-16 16:09:24 -07001582};
1583#define KVM_MAX_MSIX_PER_DEV 256
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001584struct kvm_assigned_msix_entry {
Tao Baod7db5942015-01-28 10:07:51 -08001585 __u32 assigned_dev_id;
1586 __u32 gsi;
Tao Baod7db5942015-01-28 10:07:51 -08001587 __u16 entry;
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001588 __u16 padding[3];
Ben Cheng655a7c02013-10-16 16:09:24 -07001589};
Christopher Ferris49f525c2016-12-12 14:55:36 -08001590#define KVM_X2APIC_API_USE_32BIT_IDS (1ULL << 0)
1591#define KVM_X2APIC_API_DISABLE_BROADCAST_QUIRK (1ULL << 1)
Christopher Ferris525ce912017-07-26 13:12:53 -07001592#define KVM_ARM_DEV_EL1_VTIMER (1 << 0)
1593#define KVM_ARM_DEV_EL1_PTIMER (1 << 1)
1594#define KVM_ARM_DEV_PMU (1 << 2)
Christopher Ferris76a1d452018-06-27 14:12:29 -07001595struct kvm_hyperv_eventfd {
1596 __u32 conn_id;
1597 __s32 fd;
1598 __u32 flags;
1599 __u32 padding[3];
1600};
1601#define KVM_HYPERV_CONN_ID_MASK 0x00ffffff
1602#define KVM_HYPERV_EVENTFD_DEASSIGN (1 << 0)
Christopher Ferrisaf09c702020-06-01 20:29:29 -07001603#define KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE (1 << 0)
1604#define KVM_DIRTY_LOG_INITIALLY_SET (1 << 1)
Christopher Ferris05667cd2021-02-16 16:01:34 -08001605#ifndef KVM_DIRTY_LOG_PAGE_OFFSET
1606#define KVM_DIRTY_LOG_PAGE_OFFSET 0
1607#endif
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +00001608#define KVM_DIRTY_GFN_F_DIRTY _BITUL(0)
1609#define KVM_DIRTY_GFN_F_RESET _BITUL(1)
Christopher Ferris05667cd2021-02-16 16:01:34 -08001610#define KVM_DIRTY_GFN_F_MASK 0x3
1611struct kvm_dirty_gfn {
1612 __u32 flags;
1613 __u32 slot;
1614 __u64 offset;
1615};
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001616#define KVM_BUS_LOCK_DETECTION_OFF (1 << 0)
1617#define KVM_BUS_LOCK_DETECTION_EXIT (1 << 1)
Christopher Ferris10a76e62022-06-08 13:31:52 -07001618#define KVM_PMU_CAP_DISABLE (1 << 0)
Christopher Ferris3a39c0b2021-09-02 00:03:38 +00001619struct kvm_stats_header {
1620 __u32 flags;
1621 __u32 name_size;
1622 __u32 num_desc;
1623 __u32 id_offset;
1624 __u32 desc_offset;
1625 __u32 data_offset;
1626};
1627#define KVM_STATS_TYPE_SHIFT 0
1628#define KVM_STATS_TYPE_MASK (0xF << KVM_STATS_TYPE_SHIFT)
1629#define KVM_STATS_TYPE_CUMULATIVE (0x0 << KVM_STATS_TYPE_SHIFT)
1630#define KVM_STATS_TYPE_INSTANT (0x1 << KVM_STATS_TYPE_SHIFT)
1631#define KVM_STATS_TYPE_PEAK (0x2 << KVM_STATS_TYPE_SHIFT)
Christopher Ferris2abfa9e2021-11-01 16:26:06 -07001632#define KVM_STATS_TYPE_LINEAR_HIST (0x3 << KVM_STATS_TYPE_SHIFT)
1633#define KVM_STATS_TYPE_LOG_HIST (0x4 << KVM_STATS_TYPE_SHIFT)
1634#define KVM_STATS_TYPE_MAX KVM_STATS_TYPE_LOG_HIST
Christopher Ferris3a39c0b2021-09-02 00:03:38 +00001635#define KVM_STATS_UNIT_SHIFT 4
1636#define KVM_STATS_UNIT_MASK (0xF << KVM_STATS_UNIT_SHIFT)
1637#define KVM_STATS_UNIT_NONE (0x0 << KVM_STATS_UNIT_SHIFT)
1638#define KVM_STATS_UNIT_BYTES (0x1 << KVM_STATS_UNIT_SHIFT)
1639#define KVM_STATS_UNIT_SECONDS (0x2 << KVM_STATS_UNIT_SHIFT)
1640#define KVM_STATS_UNIT_CYCLES (0x3 << KVM_STATS_UNIT_SHIFT)
Christopher Ferris80ae69d2022-08-02 16:32:21 -07001641#define KVM_STATS_UNIT_BOOLEAN (0x4 << KVM_STATS_UNIT_SHIFT)
1642#define KVM_STATS_UNIT_MAX KVM_STATS_UNIT_BOOLEAN
Christopher Ferris3a39c0b2021-09-02 00:03:38 +00001643#define KVM_STATS_BASE_SHIFT 8
1644#define KVM_STATS_BASE_MASK (0xF << KVM_STATS_BASE_SHIFT)
1645#define KVM_STATS_BASE_POW10 (0x0 << KVM_STATS_BASE_SHIFT)
1646#define KVM_STATS_BASE_POW2 (0x1 << KVM_STATS_BASE_SHIFT)
1647#define KVM_STATS_BASE_MAX KVM_STATS_BASE_POW2
1648struct kvm_stats_desc {
1649 __u32 flags;
1650 __s16 exponent;
1651 __u16 size;
1652 __u32 offset;
Christopher Ferris2abfa9e2021-11-01 16:26:06 -07001653 __u32 bucket_size;
Christopher Ferris3a39c0b2021-09-02 00:03:38 +00001654 char name[];
1655};
1656#define KVM_GET_STATS_FD _IO(KVMIO, 0xce)
Christopher Ferris1ed55342022-03-22 16:06:25 -07001657#define KVM_GET_XSAVE2 _IOR(KVMIO, 0xcf, struct kvm_xsave)
Christopher Ferris7447a1c2022-10-04 18:24:44 -07001658#define KVM_S390_PV_CPU_COMMAND _IOWR(KVMIO, 0xd0, struct kvm_pv_cmd)
1659#define KVM_X86_NOTIFY_VMEXIT_ENABLED (1ULL << 0)
1660#define KVM_X86_NOTIFY_VMEXIT_USER (1ULL << 1)
1661#define KVM_S390_ZPCI_OP _IOW(KVMIO, 0xd1, struct kvm_s390_zpci_op)
1662struct kvm_s390_zpci_op {
1663 __u32 fh;
1664 __u8 op;
1665 __u8 pad[3];
1666 union {
1667 struct {
1668 __u64 ibv;
1669 __u64 sb;
1670 __u32 flags;
1671 __u32 noi;
1672 __u8 isc;
1673 __u8 sbo;
1674 __u16 pad;
1675 } reg_aen;
1676 __u64 reserved[8];
1677 } u;
1678};
1679#define KVM_S390_ZPCIOP_REG_AEN 0
1680#define KVM_S390_ZPCIOP_DEREG_AEN 1
1681#define KVM_S390_ZPCIOP_REGAEN_HOST (1 << 0)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001682#endif