blob: ea4f7695b367b88bd279aa2e28f305c6eb32b1e0 [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
Ben Cheng655a7c02013-10-16 16:09:24 -070015struct kvm_userspace_memory_region {
Tao Baod7db5942015-01-28 10:07:51 -080016 __u32 slot;
Tao Baod7db5942015-01-28 10:07:51 -080017 __u32 flags;
18 __u64 guest_phys_addr;
19 __u64 memory_size;
20 __u64 userspace_addr;
Ben Cheng655a7c02013-10-16 16:09:24 -070021};
Christopher Ferrisb830ddf2024-03-28 11:48:08 -070022struct kvm_userspace_memory_region2 {
23 __u32 slot;
24 __u32 flags;
25 __u64 guest_phys_addr;
26 __u64 memory_size;
27 __u64 userspace_addr;
28 __u64 guest_memfd_offset;
29 __u32 guest_memfd;
30 __u32 pad1;
31 __u64 pad2[14];
32};
Ben Cheng655a7c02013-10-16 16:09:24 -070033#define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0)
34#define KVM_MEM_READONLY (1UL << 1)
Christopher Ferrisb830ddf2024-03-28 11:48:08 -070035#define KVM_MEM_GUEST_MEMFD (1UL << 2)
Ben Cheng655a7c02013-10-16 16:09:24 -070036struct kvm_irq_level {
Tao Baod7db5942015-01-28 10:07:51 -080037 union {
38 __u32 irq;
39 __s32 status;
40 };
Tao Baod7db5942015-01-28 10:07:51 -080041 __u32 level;
Ben Cheng655a7c02013-10-16 16:09:24 -070042};
43struct kvm_irqchip {
Tao Baod7db5942015-01-28 10:07:51 -080044 __u32 chip_id;
Tao Baod7db5942015-01-28 10:07:51 -080045 __u32 pad;
46 union {
47 char dummy[512];
Ben Cheng655a7c02013-10-16 16:09:24 -070048#ifdef __KVM_HAVE_PIT
Tao Baod7db5942015-01-28 10:07:51 -080049 struct kvm_pic_state pic;
Ben Cheng655a7c02013-10-16 16:09:24 -070050#endif
51#ifdef __KVM_HAVE_IOAPIC
Tao Baod7db5942015-01-28 10:07:51 -080052 struct kvm_ioapic_state ioapic;
Ben Cheng655a7c02013-10-16 16:09:24 -070053#endif
Tao Baod7db5942015-01-28 10:07:51 -080054 } chip;
Ben Cheng655a7c02013-10-16 16:09:24 -070055};
56struct kvm_pit_config {
Tao Baod7db5942015-01-28 10:07:51 -080057 __u32 flags;
58 __u32 pad[15];
Ben Cheng655a7c02013-10-16 16:09:24 -070059};
60#define KVM_PIT_SPEAKER_DUMMY 1
Christopher Ferris05d08e92016-02-04 13:16:38 -080061struct kvm_s390_skeys {
62 __u64 start_gfn;
63 __u64 count;
64 __u64 skeydata_addr;
Christopher Ferris05d08e92016-02-04 13:16:38 -080065 __u32 flags;
66 __u32 reserved[9];
67};
Christopher Ferris1308ad32017-11-14 17:32:13 -080068#define KVM_S390_CMMA_PEEK (1 << 0)
69struct kvm_s390_cmma_log {
70 __u64 start_gfn;
71 __u32 count;
72 __u32 flags;
73 union {
74 __u64 remaining;
75 __u64 mask;
76 };
77 __u64 values;
78};
Christopher Ferris106b3a82016-08-24 12:15:38 -070079struct kvm_hyperv_exit {
Christopher Ferris106b3a82016-08-24 12:15:38 -070080#define KVM_EXIT_HYPERV_SYNIC 1
81#define KVM_EXIT_HYPERV_HCALL 2
Christopher Ferris8177cdf2020-08-03 11:53:55 -070082#define KVM_EXIT_HYPERV_SYNDBG 3
Christopher Ferris106b3a82016-08-24 12:15:38 -070083 __u32 type;
Christopher Ferris8177cdf2020-08-03 11:53:55 -070084 __u32 pad1;
Christopher Ferris106b3a82016-08-24 12:15:38 -070085 union {
Christopher Ferris106b3a82016-08-24 12:15:38 -070086 struct {
87 __u32 msr;
Christopher Ferris8177cdf2020-08-03 11:53:55 -070088 __u32 pad2;
Christopher Ferris106b3a82016-08-24 12:15:38 -070089 __u64 control;
90 __u64 evt_page;
Christopher Ferris106b3a82016-08-24 12:15:38 -070091 __u64 msg_page;
92 } synic;
93 struct {
94 __u64 input;
Christopher Ferris106b3a82016-08-24 12:15:38 -070095 __u64 result;
96 __u64 params[2];
97 } hcall;
Christopher Ferris8177cdf2020-08-03 11:53:55 -070098 struct {
99 __u32 msr;
100 __u32 pad2;
101 __u64 control;
102 __u64 status;
103 __u64 send_page;
104 __u64 recv_page;
105 __u64 pending_page;
106 } syndbg;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700107 } u;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700108};
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700109struct kvm_xen_exit {
110#define KVM_EXIT_XEN_HCALL 1
111 __u32 type;
112 union {
113 struct {
114 __u32 longmode;
115 __u32 cpl;
116 __u64 input;
117 __u64 result;
118 __u64 params[6];
119 } hcall;
120 } u;
121};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700122#define KVM_S390_GET_SKEYS_NONE 1
Christopher Ferris05d08e92016-02-04 13:16:38 -0800123#define KVM_S390_SKEYS_MAX 1048576
Ben Cheng655a7c02013-10-16 16:09:24 -0700124#define KVM_EXIT_UNKNOWN 0
125#define KVM_EXIT_EXCEPTION 1
126#define KVM_EXIT_IO 2
Christopher Ferris05d08e92016-02-04 13:16:38 -0800127#define KVM_EXIT_HYPERCALL 3
Ben Cheng655a7c02013-10-16 16:09:24 -0700128#define KVM_EXIT_DEBUG 4
129#define KVM_EXIT_HLT 5
130#define KVM_EXIT_MMIO 6
Christopher Ferris05d08e92016-02-04 13:16:38 -0800131#define KVM_EXIT_IRQ_WINDOW_OPEN 7
Ben Cheng655a7c02013-10-16 16:09:24 -0700132#define KVM_EXIT_SHUTDOWN 8
133#define KVM_EXIT_FAIL_ENTRY 9
134#define KVM_EXIT_INTR 10
Christopher Ferris05d08e92016-02-04 13:16:38 -0800135#define KVM_EXIT_SET_TPR 11
Ben Cheng655a7c02013-10-16 16:09:24 -0700136#define KVM_EXIT_TPR_ACCESS 12
137#define KVM_EXIT_S390_SIEIC 13
138#define KVM_EXIT_S390_RESET 14
Christopher Ferris05d08e92016-02-04 13:16:38 -0800139#define KVM_EXIT_DCR 15
Ben Cheng655a7c02013-10-16 16:09:24 -0700140#define KVM_EXIT_NMI 16
141#define KVM_EXIT_INTERNAL_ERROR 17
142#define KVM_EXIT_OSI 18
Christopher Ferris05d08e92016-02-04 13:16:38 -0800143#define KVM_EXIT_PAPR_HCALL 19
Ben Cheng655a7c02013-10-16 16:09:24 -0700144#define KVM_EXIT_S390_UCONTROL 20
145#define KVM_EXIT_WATCHDOG 21
146#define KVM_EXIT_S390_TSCH 22
Christopher Ferris05d08e92016-02-04 13:16:38 -0800147#define KVM_EXIT_EPR 23
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700148#define KVM_EXIT_SYSTEM_EVENT 24
Christopher Ferris05d08e92016-02-04 13:16:38 -0800149#define KVM_EXIT_S390_STSI 25
150#define KVM_EXIT_IOAPIC_EOI 26
Christopher Ferris106b3a82016-08-24 12:15:38 -0700151#define KVM_EXIT_HYPERV 27
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800152#define KVM_EXIT_ARM_NISV 28
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800153#define KVM_EXIT_X86_RDMSR 29
154#define KVM_EXIT_X86_WRMSR 30
Christopher Ferris05667cd2021-02-16 16:01:34 -0800155#define KVM_EXIT_DIRTY_RING_FULL 31
156#define KVM_EXIT_AP_RESET_HOLD 32
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700157#define KVM_EXIT_X86_BUS_LOCK 33
158#define KVM_EXIT_XEN 34
Christopher Ferrisa4792612022-01-10 13:51:15 -0800159#define KVM_EXIT_RISCV_SBI 35
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700160#define KVM_EXIT_RISCV_CSR 36
161#define KVM_EXIT_NOTIFY 37
Christopher Ferris0f795212024-01-17 14:17:28 -0800162#define KVM_EXIT_LOONGARCH_IOCSR 38
Christopher Ferrisb830ddf2024-03-28 11:48:08 -0700163#define KVM_EXIT_MEMORY_FAULT 39
Ben Cheng655a7c02013-10-16 16:09:24 -0700164#define KVM_INTERNAL_ERROR_EMULATION 1
165#define KVM_INTERNAL_ERROR_SIMUL_EX 2
166#define KVM_INTERNAL_ERROR_DELIVERY_EV 3
Christopher Ferris9584fa42019-12-09 15:36:13 -0800167#define KVM_INTERNAL_ERROR_UNEXPECTED_EXIT_REASON 4
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000168#define KVM_INTERNAL_ERROR_EMULATION_FLAG_INSTRUCTION_BYTES (1ULL << 0)
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700169struct kvm_run {
Tao Baod7db5942015-01-28 10:07:51 -0800170 __u8 request_interrupt_window;
Christopher Ferris525ce912017-07-26 13:12:53 -0700171 __u8 immediate_exit;
172 __u8 padding1[6];
Tao Baod7db5942015-01-28 10:07:51 -0800173 __u32 exit_reason;
Tao Baod7db5942015-01-28 10:07:51 -0800174 __u8 ready_for_interrupt_injection;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800175 __u8 if_flag;
176 __u16 flags;
177 __u64 cr8;
Tao Baod7db5942015-01-28 10:07:51 -0800178 __u64 apic_base;
Ben Cheng655a7c02013-10-16 16:09:24 -0700179#ifdef __KVM_S390
Tao Baod7db5942015-01-28 10:07:51 -0800180 __u64 psw_mask;
181 __u64 psw_addr;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700182#endif
Tao Baod7db5942015-01-28 10:07:51 -0800183 union {
184 struct {
185 __u64 hardware_exit_reason;
Tao Baod7db5942015-01-28 10:07:51 -0800186 } hw;
187 struct {
188 __u64 hardware_entry_failure_reason;
Christopher Ferris25c18d42020-10-14 17:42:58 -0700189 __u32 cpu;
Tao Baod7db5942015-01-28 10:07:51 -0800190 } fail_entry;
Tao Baod7db5942015-01-28 10:07:51 -0800191 struct {
192 __u32 exception;
193 __u32 error_code;
194 } ex;
Tao Baod7db5942015-01-28 10:07:51 -0800195 struct {
Ben Cheng655a7c02013-10-16 16:09:24 -0700196#define KVM_EXIT_IO_IN 0
197#define KVM_EXIT_IO_OUT 1
Tao Baod7db5942015-01-28 10:07:51 -0800198 __u8 direction;
Tao Baod7db5942015-01-28 10:07:51 -0800199 __u8 size;
200 __u16 port;
201 __u32 count;
202 __u64 data_offset;
Tao Baod7db5942015-01-28 10:07:51 -0800203 } io;
204 struct {
205 struct kvm_debug_exit_arch arch;
206 } debug;
Tao Baod7db5942015-01-28 10:07:51 -0800207 struct {
208 __u64 phys_addr;
209 __u8 data[8];
210 __u32 len;
Tao Baod7db5942015-01-28 10:07:51 -0800211 __u8 is_write;
212 } mmio;
213 struct {
Christopher Ferris0f795212024-01-17 14:17:28 -0800214 __u64 phys_addr;
215 __u8 data[8];
216 __u32 len;
217 __u8 is_write;
218 } iocsr_io;
219 struct {
Tao Baod7db5942015-01-28 10:07:51 -0800220 __u64 nr;
Tao Baod7db5942015-01-28 10:07:51 -0800221 __u64 args[6];
222 __u64 ret;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700223 union {
224 __u32 longmode;
225 __u64 flags;
226 };
Tao Baod7db5942015-01-28 10:07:51 -0800227 } hypercall;
228 struct {
229 __u64 rip;
230 __u32 is_write;
Tao Baod7db5942015-01-28 10:07:51 -0800231 __u32 pad;
232 } tpr_access;
233 struct {
234 __u8 icptcode;
Tao Baod7db5942015-01-28 10:07:51 -0800235 __u16 ipa;
236 __u32 ipb;
237 } s390_sieic;
Ben Cheng655a7c02013-10-16 16:09:24 -0700238#define KVM_S390_RESET_POR 1
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700239#define KVM_S390_RESET_CLEAR 2
Ben Cheng655a7c02013-10-16 16:09:24 -0700240#define KVM_S390_RESET_SUBSYSTEM 4
241#define KVM_S390_RESET_CPU_INIT 8
242#define KVM_S390_RESET_IPL 16
Tao Baod7db5942015-01-28 10:07:51 -0800243 __u64 s390_reset_flags;
244 struct {
245 __u64 trans_exc_code;
246 __u32 pgm_code;
Tao Baod7db5942015-01-28 10:07:51 -0800247 } s390_ucontrol;
248 struct {
249 __u32 dcrn;
250 __u32 data;
Tao Baod7db5942015-01-28 10:07:51 -0800251 __u8 is_write;
252 } dcr;
253 struct {
254 __u32 suberror;
Tao Baod7db5942015-01-28 10:07:51 -0800255 __u32 ndata;
256 __u64 data[16];
257 } internal;
258 struct {
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000259 __u32 suberror;
260 __u32 ndata;
261 __u64 flags;
Christopher Ferrisa4792612022-01-10 13:51:15 -0800262 union {
263 struct {
264 __u8 insn_size;
265 __u8 insn_bytes[15];
266 };
267 };
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000268 } emulation_failure;
269 struct {
Tao Baod7db5942015-01-28 10:07:51 -0800270 __u64 gprs[32];
271 } osi;
272 struct {
273 __u64 nr;
Tao Baod7db5942015-01-28 10:07:51 -0800274 __u64 ret;
275 __u64 args[9];
276 } papr_hcall;
277 struct {
Tao Baod7db5942015-01-28 10:07:51 -0800278 __u16 subchannel_id;
279 __u16 subchannel_nr;
280 __u32 io_int_parm;
281 __u32 io_int_word;
Tao Baod7db5942015-01-28 10:07:51 -0800282 __u32 ipb;
283 __u8 dequeued;
284 } s390_tsch;
285 struct {
Tao Baod7db5942015-01-28 10:07:51 -0800286 __u32 epr;
287 } epr;
288 struct {
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700289#define KVM_SYSTEM_EVENT_SHUTDOWN 1
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700290#define KVM_SYSTEM_EVENT_RESET 2
Christopher Ferris05d08e92016-02-04 13:16:38 -0800291#define KVM_SYSTEM_EVENT_CRASH 3
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700292#define KVM_SYSTEM_EVENT_WAKEUP 4
293#define KVM_SYSTEM_EVENT_SUSPEND 5
294#define KVM_SYSTEM_EVENT_SEV_TERM 6
Tao Baod7db5942015-01-28 10:07:51 -0800295 __u32 type;
Christopher Ferris10a76e62022-06-08 13:31:52 -0700296 __u32 ndata;
297 union {
298 __u64 flags;
299 __u64 data[16];
300 };
Tao Baod7db5942015-01-28 10:07:51 -0800301 } system_event;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800302 struct {
303 __u64 addr;
304 __u8 ar;
305 __u8 reserved;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800306 __u8 fc;
307 __u8 sel1;
308 __u16 sel2;
309 } s390_stsi;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800310 struct {
311 __u8 vector;
312 } eoi;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700313 struct kvm_hyperv_exit hyperv;
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800314 struct {
315 __u64 esr_iss;
316 __u64 fault_ipa;
317 } arm_nisv;
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800318 struct {
319 __u8 error;
320 __u8 pad[7];
321#define KVM_MSR_EXIT_REASON_INVAL (1 << 0)
322#define KVM_MSR_EXIT_REASON_UNKNOWN (1 << 1)
323#define KVM_MSR_EXIT_REASON_FILTER (1 << 2)
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800324#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 -0800325 __u32 reason;
326 __u32 index;
327 __u64 data;
328 } msr;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700329 struct kvm_xen_exit xen;
Christopher Ferrisa4792612022-01-10 13:51:15 -0800330 struct {
331 unsigned long extension_id;
332 unsigned long function_id;
333 unsigned long args[6];
334 unsigned long ret[2];
335 } riscv_sbi;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700336 struct {
337 unsigned long csr_num;
338 unsigned long new_value;
339 unsigned long write_mask;
340 unsigned long ret_value;
341 } riscv_csr;
342 struct {
343#define KVM_NOTIFY_CONTEXT_INVALID (1 << 0)
344 __u32 flags;
345 } notify;
Christopher Ferrisb830ddf2024-03-28 11:48:08 -0700346 struct {
347#define KVM_MEMORY_EXIT_FLAG_PRIVATE (1ULL << 3)
348 __u64 flags;
349 __u64 gpa;
350 __u64 size;
351 } memory_fault;
Tao Baod7db5942015-01-28 10:07:51 -0800352 char padding[256];
353 };
Christopher Ferris76a1d452018-06-27 14:12:29 -0700354#define SYNC_REGS_SIZE_BYTES 2048
Tao Baod7db5942015-01-28 10:07:51 -0800355 __u64 kvm_valid_regs;
356 __u64 kvm_dirty_regs;
Tao Baod7db5942015-01-28 10:07:51 -0800357 union {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800358 struct kvm_sync_regs regs;
Christopher Ferris76a1d452018-06-27 14:12:29 -0700359 char padding[SYNC_REGS_SIZE_BYTES];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800360 } s;
Ben Cheng655a7c02013-10-16 16:09:24 -0700361};
362struct kvm_coalesced_mmio_zone {
Tao Baod7db5942015-01-28 10:07:51 -0800363 __u64 addr;
364 __u32 size;
Christopher Ferris86a48372019-01-10 14:14:59 -0800365 union {
366 __u32 pad;
367 __u32 pio;
368 };
Ben Cheng655a7c02013-10-16 16:09:24 -0700369};
370struct kvm_coalesced_mmio {
Tao Baod7db5942015-01-28 10:07:51 -0800371 __u64 phys_addr;
Tao Baod7db5942015-01-28 10:07:51 -0800372 __u32 len;
Christopher Ferris86a48372019-01-10 14:14:59 -0800373 union {
374 __u32 pad;
375 __u32 pio;
376 };
Tao Baod7db5942015-01-28 10:07:51 -0800377 __u8 data[8];
Ben Cheng655a7c02013-10-16 16:09:24 -0700378};
379struct kvm_coalesced_mmio_ring {
Tao Baod7db5942015-01-28 10:07:51 -0800380 __u32 first, last;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700381 struct kvm_coalesced_mmio coalesced_mmio[];
Ben Cheng655a7c02013-10-16 16:09:24 -0700382};
Tao Baod7db5942015-01-28 10:07:51 -0800383#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 -0700384struct kvm_translation {
Tao Baod7db5942015-01-28 10:07:51 -0800385 __u64 linear_address;
386 __u64 physical_address;
Tao Baod7db5942015-01-28 10:07:51 -0800387 __u8 valid;
388 __u8 writeable;
389 __u8 usermode;
390 __u8 pad[5];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800391};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800392struct kvm_s390_mem_op {
393 __u64 gaddr;
394 __u64 flags;
395 __u32 size;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800396 __u32 op;
397 __u64 buf;
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700398 union {
Christopher Ferris10a76e62022-06-08 13:31:52 -0700399 struct {
400 __u8 ar;
401 __u8 key;
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000402 __u8 pad1[6];
403 __u64 old_addr;
Christopher Ferris10a76e62022-06-08 13:31:52 -0700404 };
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700405 __u32 sida_offset;
406 __u8 reserved[32];
407 };
Ben Cheng655a7c02013-10-16 16:09:24 -0700408};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800409#define KVM_S390_MEMOP_LOGICAL_READ 0
410#define KVM_S390_MEMOP_LOGICAL_WRITE 1
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700411#define KVM_S390_MEMOP_SIDA_READ 2
412#define KVM_S390_MEMOP_SIDA_WRITE 3
Christopher Ferris10a76e62022-06-08 13:31:52 -0700413#define KVM_S390_MEMOP_ABSOLUTE_READ 4
414#define KVM_S390_MEMOP_ABSOLUTE_WRITE 5
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000415#define KVM_S390_MEMOP_ABSOLUTE_CMPXCHG 6
Christopher Ferris05d08e92016-02-04 13:16:38 -0800416#define KVM_S390_MEMOP_F_CHECK_ONLY (1ULL << 0)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800417#define KVM_S390_MEMOP_F_INJECT_EXCEPTION (1ULL << 1)
Christopher Ferris10a76e62022-06-08 13:31:52 -0700418#define KVM_S390_MEMOP_F_SKEY_PROTECTION (1ULL << 2)
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000419#define KVM_S390_MEMOP_EXTENSION_CAP_BASE (1 << 0)
420#define KVM_S390_MEMOP_EXTENSION_CAP_CMPXCHG (1 << 1)
Ben Cheng655a7c02013-10-16 16:09:24 -0700421struct kvm_interrupt {
Tao Baod7db5942015-01-28 10:07:51 -0800422 __u32 irq;
Ben Cheng655a7c02013-10-16 16:09:24 -0700423};
424struct kvm_dirty_log {
Tao Baod7db5942015-01-28 10:07:51 -0800425 __u32 slot;
426 __u32 padding1;
427 union {
Elliott Hughes0f0c18f2023-03-29 15:53:31 -0700428 void * dirty_bitmap;
Tao Baod7db5942015-01-28 10:07:51 -0800429 __u64 padding2;
430 };
Ben Cheng655a7c02013-10-16 16:09:24 -0700431};
Christopher Ferrisd842e432019-03-07 10:21:59 -0800432struct kvm_clear_dirty_log {
433 __u32 slot;
434 __u32 num_pages;
435 __u64 first_page;
436 union {
Elliott Hughes0f0c18f2023-03-29 15:53:31 -0700437 void * dirty_bitmap;
Christopher Ferrisd842e432019-03-07 10:21:59 -0800438 __u64 padding2;
439 };
440};
Ben Cheng655a7c02013-10-16 16:09:24 -0700441struct kvm_signal_mask {
Tao Baod7db5942015-01-28 10:07:51 -0800442 __u32 len;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700443 __u8 sigset[];
Ben Cheng655a7c02013-10-16 16:09:24 -0700444};
445struct kvm_tpr_access_ctl {
Tao Baod7db5942015-01-28 10:07:51 -0800446 __u32 enabled;
447 __u32 flags;
448 __u32 reserved[8];
Ben Cheng655a7c02013-10-16 16:09:24 -0700449};
450struct kvm_vapic_addr {
Tao Baod7db5942015-01-28 10:07:51 -0800451 __u64 vapic_addr;
Ben Cheng655a7c02013-10-16 16:09:24 -0700452};
453#define KVM_MP_STATE_RUNNABLE 0
454#define KVM_MP_STATE_UNINITIALIZED 1
455#define KVM_MP_STATE_INIT_RECEIVED 2
Ben Cheng655a7c02013-10-16 16:09:24 -0700456#define KVM_MP_STATE_HALTED 3
457#define KVM_MP_STATE_SIPI_RECEIVED 4
Christopher Ferris82d75042015-01-26 10:57:07 -0800458#define KVM_MP_STATE_STOPPED 5
459#define KVM_MP_STATE_CHECK_STOP 6
460#define KVM_MP_STATE_OPERATING 7
Christopher Ferris82d75042015-01-26 10:57:07 -0800461#define KVM_MP_STATE_LOAD 8
Christopher Ferris05667cd2021-02-16 16:01:34 -0800462#define KVM_MP_STATE_AP_RESET_HOLD 9
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700463#define KVM_MP_STATE_SUSPENDED 10
Ben Cheng655a7c02013-10-16 16:09:24 -0700464struct kvm_mp_state {
Tao Baod7db5942015-01-28 10:07:51 -0800465 __u32 mp_state;
Ben Cheng655a7c02013-10-16 16:09:24 -0700466};
467struct kvm_s390_psw {
Tao Baod7db5942015-01-28 10:07:51 -0800468 __u64 mask;
469 __u64 addr;
Ben Cheng655a7c02013-10-16 16:09:24 -0700470};
471#define KVM_S390_SIGP_STOP 0xfffe0000u
472#define KVM_S390_PROGRAM_INT 0xfffe0001u
473#define KVM_S390_SIGP_SET_PREFIX 0xfffe0002u
Ben Cheng655a7c02013-10-16 16:09:24 -0700474#define KVM_S390_RESTART 0xfffe0003u
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700475#define KVM_S390_INT_PFAULT_INIT 0xfffe0004u
476#define KVM_S390_INT_PFAULT_DONE 0xfffe0005u
Ben Cheng655a7c02013-10-16 16:09:24 -0700477#define KVM_S390_MCHK 0xfffe1000u
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700478#define KVM_S390_INT_CLOCK_COMP 0xffff1004u
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700479#define KVM_S390_INT_CPU_TIMER 0xffff1005u
Ben Cheng655a7c02013-10-16 16:09:24 -0700480#define KVM_S390_INT_VIRTIO 0xffff2603u
481#define KVM_S390_INT_SERVICE 0xffff2401u
Ben Cheng655a7c02013-10-16 16:09:24 -0700482#define KVM_S390_INT_EMERGENCY 0xffff1201u
483#define KVM_S390_INT_EXTERNAL_CALL 0xffff1202u
Tao Baod7db5942015-01-28 10:07:51 -0800484#define KVM_S390_INT_IO(ai,cssid,ssid,schid) (((schid)) | ((ssid) << 16) | ((cssid) << 18) | ((ai) << 26))
Ben Cheng655a7c02013-10-16 16:09:24 -0700485#define KVM_S390_INT_IO_MIN 0x00000000u
Ben Cheng655a7c02013-10-16 16:09:24 -0700486#define KVM_S390_INT_IO_MAX 0xfffdffffu
Christopher Ferris05d08e92016-02-04 13:16:38 -0800487#define KVM_S390_INT_IO_AI_MASK 0x04000000u
Ben Cheng655a7c02013-10-16 16:09:24 -0700488struct kvm_s390_interrupt {
Tao Baod7db5942015-01-28 10:07:51 -0800489 __u32 type;
490 __u32 parm;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800491 __u64 parm64;
Ben Cheng655a7c02013-10-16 16:09:24 -0700492};
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700493struct kvm_s390_io_info {
Tao Baod7db5942015-01-28 10:07:51 -0800494 __u16 subchannel_id;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800495 __u16 subchannel_nr;
Tao Baod7db5942015-01-28 10:07:51 -0800496 __u32 io_int_parm;
497 __u32 io_int_word;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700498};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800499struct kvm_s390_ext_info {
Tao Baod7db5942015-01-28 10:07:51 -0800500 __u32 ext_params;
501 __u32 pad;
502 __u64 ext_params2;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800503};
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700504struct kvm_s390_pgm_info {
Tao Baod7db5942015-01-28 10:07:51 -0800505 __u64 trans_exc_code;
506 __u64 mon_code;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800507 __u64 per_address;
Tao Baod7db5942015-01-28 10:07:51 -0800508 __u32 data_exc_code;
509 __u16 code;
510 __u16 mon_class_nr;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800511 __u8 per_code;
Tao Baod7db5942015-01-28 10:07:51 -0800512 __u8 per_atmid;
513 __u8 exc_access_id;
514 __u8 per_access_id;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800515 __u8 op_access_id;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700516#define KVM_S390_PGM_FLAGS_ILC_VALID 0x01
517#define KVM_S390_PGM_FLAGS_ILC_0 0x02
518#define KVM_S390_PGM_FLAGS_ILC_1 0x04
Christopher Ferris106b3a82016-08-24 12:15:38 -0700519#define KVM_S390_PGM_FLAGS_ILC_MASK 0x06
520#define KVM_S390_PGM_FLAGS_NO_REWIND 0x08
521 __u8 flags;
522 __u8 pad[2];
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700523};
524struct kvm_s390_prefix_info {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800525 __u32 address;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700526};
527struct kvm_s390_extcall_info {
Tao Baod7db5942015-01-28 10:07:51 -0800528 __u16 code;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800529};
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700530struct kvm_s390_emerg_info {
Tao Baod7db5942015-01-28 10:07:51 -0800531 __u16 code;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700532};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800533#define KVM_S390_STOP_FLAG_STORE_STATUS 0x01
534struct kvm_s390_stop_info {
535 __u32 flags;
536};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800537struct kvm_s390_mchk_info {
Tao Baod7db5942015-01-28 10:07:51 -0800538 __u64 cr14;
539 __u64 mcic;
540 __u64 failing_storage_address;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800541 __u32 ext_damage_code;
Tao Baod7db5942015-01-28 10:07:51 -0800542 __u32 pad;
543 __u8 fixed_logout[16];
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700544};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800545struct kvm_s390_irq {
Tao Baod7db5942015-01-28 10:07:51 -0800546 __u64 type;
547 union {
548 struct kvm_s390_io_info io;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800549 struct kvm_s390_ext_info ext;
Tao Baod7db5942015-01-28 10:07:51 -0800550 struct kvm_s390_pgm_info pgm;
551 struct kvm_s390_emerg_info emerg;
552 struct kvm_s390_extcall_info extcall;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800553 struct kvm_s390_prefix_info prefix;
554 struct kvm_s390_stop_info stop;
Tao Baod7db5942015-01-28 10:07:51 -0800555 struct kvm_s390_mchk_info mchk;
556 char reserved[64];
557 } u;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700558};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800559struct kvm_s390_irq_state {
560 __u64 buf;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800561 __u32 flags;
562 __u32 len;
563 __u32 reserved[4];
564};
Ben Cheng655a7c02013-10-16 16:09:24 -0700565#define KVM_GUESTDBG_ENABLE 0x00000001
566#define KVM_GUESTDBG_SINGLESTEP 0x00000002
Ben Cheng655a7c02013-10-16 16:09:24 -0700567struct kvm_guest_debug {
Tao Baod7db5942015-01-28 10:07:51 -0800568 __u32 control;
Tao Baod7db5942015-01-28 10:07:51 -0800569 __u32 pad;
570 struct kvm_guest_debug_arch arch;
Ben Cheng655a7c02013-10-16 16:09:24 -0700571};
572enum {
Tao Baod7db5942015-01-28 10:07:51 -0800573 kvm_ioeventfd_flag_nr_datamatch,
574 kvm_ioeventfd_flag_nr_pio,
575 kvm_ioeventfd_flag_nr_deassign,
576 kvm_ioeventfd_flag_nr_virtio_ccw_notify,
Tao Baod7db5942015-01-28 10:07:51 -0800577 kvm_ioeventfd_flag_nr_fast_mmio,
578 kvm_ioeventfd_flag_nr_max,
Ben Cheng655a7c02013-10-16 16:09:24 -0700579};
Ben Cheng655a7c02013-10-16 16:09:24 -0700580#define KVM_IOEVENTFD_FLAG_DATAMATCH (1 << kvm_ioeventfd_flag_nr_datamatch)
581#define KVM_IOEVENTFD_FLAG_PIO (1 << kvm_ioeventfd_flag_nr_pio)
582#define KVM_IOEVENTFD_FLAG_DEASSIGN (1 << kvm_ioeventfd_flag_nr_deassign)
Tao Baod7db5942015-01-28 10:07:51 -0800583#define KVM_IOEVENTFD_FLAG_VIRTIO_CCW_NOTIFY (1 << kvm_ioeventfd_flag_nr_virtio_ccw_notify)
Ben Cheng655a7c02013-10-16 16:09:24 -0700584#define KVM_IOEVENTFD_VALID_FLAG_MASK ((1 << kvm_ioeventfd_flag_nr_max) - 1)
585struct kvm_ioeventfd {
Tao Baod7db5942015-01-28 10:07:51 -0800586 __u64 datamatch;
587 __u64 addr;
588 __u32 len;
Tao Baod7db5942015-01-28 10:07:51 -0800589 __s32 fd;
590 __u32 flags;
591 __u8 pad[36];
Ben Cheng655a7c02013-10-16 16:09:24 -0700592};
Christopher Ferris76a1d452018-06-27 14:12:29 -0700593#define KVM_X86_DISABLE_EXITS_MWAIT (1 << 0)
594#define KVM_X86_DISABLE_EXITS_HLT (1 << 1)
595#define KVM_X86_DISABLE_EXITS_PAUSE (1 << 2)
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700596#define KVM_X86_DISABLE_EXITS_CSTATE (1 << 3)
597#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 -0700598struct kvm_enable_cap {
Tao Baod7db5942015-01-28 10:07:51 -0800599 __u32 cap;
600 __u32 flags;
601 __u64 args[4];
Tao Baod7db5942015-01-28 10:07:51 -0800602 __u8 pad[64];
Ben Cheng655a7c02013-10-16 16:09:24 -0700603};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800604#define KVM_PPC_PVINFO_FLAGS_EV_IDLE (1 << 0)
Ben Cheng655a7c02013-10-16 16:09:24 -0700605struct kvm_ppc_pvinfo {
Tao Baod7db5942015-01-28 10:07:51 -0800606 __u32 flags;
Tao Baod7db5942015-01-28 10:07:51 -0800607 __u32 hcall[4];
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800608 __u8 pad[108];
Ben Cheng655a7c02013-10-16 16:09:24 -0700609};
Ben Cheng655a7c02013-10-16 16:09:24 -0700610#define KVM_PPC_PAGE_SIZES_MAX_SZ 8
611struct kvm_ppc_one_page_size {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800612 __u32 page_shift;
Tao Baod7db5942015-01-28 10:07:51 -0800613 __u32 pte_enc;
Ben Cheng655a7c02013-10-16 16:09:24 -0700614};
615struct kvm_ppc_one_seg_page_size {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800616 __u32 page_shift;
Tao Baod7db5942015-01-28 10:07:51 -0800617 __u32 slb_enc;
618 struct kvm_ppc_one_page_size enc[KVM_PPC_PAGE_SIZES_MAX_SZ];
Ben Cheng655a7c02013-10-16 16:09:24 -0700619};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800620#define KVM_PPC_PAGE_SIZES_REAL 0x00000001
Ben Cheng655a7c02013-10-16 16:09:24 -0700621#define KVM_PPC_1T_SEGMENTS 0x00000002
Christopher Ferris86a48372019-01-10 14:14:59 -0800622#define KVM_PPC_NO_HASH 0x00000004
Ben Cheng655a7c02013-10-16 16:09:24 -0700623struct kvm_ppc_smmu_info {
Tao Baod7db5942015-01-28 10:07:51 -0800624 __u64 flags;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800625 __u32 slb_size;
Christopher Ferris1308ad32017-11-14 17:32:13 -0800626 __u16 data_keys;
627 __u16 instr_keys;
Tao Baod7db5942015-01-28 10:07:51 -0800628 struct kvm_ppc_one_seg_page_size sps[KVM_PPC_PAGE_SIZES_MAX_SZ];
Ben Cheng655a7c02013-10-16 16:09:24 -0700629};
Christopher Ferris525ce912017-07-26 13:12:53 -0700630struct kvm_ppc_resize_hpt {
631 __u64 flags;
632 __u32 shift;
633 __u32 pad;
634};
Ben Cheng655a7c02013-10-16 16:09:24 -0700635#define KVMIO 0xAE
Ben Cheng655a7c02013-10-16 16:09:24 -0700636#define KVM_VM_S390_UCONTROL 1
Christopher Ferris38062f92014-07-09 15:33:25 -0700637#define KVM_VM_PPC_HV 1
638#define KVM_VM_PPC_PR 2
Christopher Ferris25c18d42020-10-14 17:42:58 -0700639#define KVM_VM_MIPS_AUTO 0
Christopher Ferris525ce912017-07-26 13:12:53 -0700640#define KVM_VM_MIPS_VZ 1
Christopher Ferris25c18d42020-10-14 17:42:58 -0700641#define KVM_VM_MIPS_TE 2
Ben Cheng655a7c02013-10-16 16:09:24 -0700642#define KVM_S390_SIE_PAGE_OFFSET 1
Christopher Ferris86a48372019-01-10 14:14:59 -0800643#define KVM_VM_TYPE_ARM_IPA_SIZE_MASK 0xffULL
644#define KVM_VM_TYPE_ARM_IPA_SIZE(x) ((x) & KVM_VM_TYPE_ARM_IPA_SIZE_MASK)
Ben Cheng655a7c02013-10-16 16:09:24 -0700645#define KVM_GET_API_VERSION _IO(KVMIO, 0x00)
646#define KVM_CREATE_VM _IO(KVMIO, 0x01)
Ben Cheng655a7c02013-10-16 16:09:24 -0700647#define KVM_GET_MSR_INDEX_LIST _IOWR(KVMIO, 0x02, struct kvm_msr_list)
648#define KVM_S390_ENABLE_SIE _IO(KVMIO, 0x06)
649#define KVM_CHECK_EXTENSION _IO(KVMIO, 0x03)
650#define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04)
Ben Cheng655a7c02013-10-16 16:09:24 -0700651#define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x05, struct kvm_cpuid2)
Christopher Ferris38062f92014-07-09 15:33:25 -0700652#define KVM_GET_EMULATED_CPUID _IOWR(KVMIO, 0x09, struct kvm_cpuid2)
Christopher Ferris76a1d452018-06-27 14:12:29 -0700653#define KVM_GET_MSR_FEATURE_INDEX_LIST _IOWR(KVMIO, 0x0a, struct kvm_msr_list)
Ben Cheng655a7c02013-10-16 16:09:24 -0700654#define KVM_CAP_IRQCHIP 0
655#define KVM_CAP_HLT 1
656#define KVM_CAP_MMU_SHADOW_CACHE_CONTROL 2
657#define KVM_CAP_USER_MEMORY 3
Ben Cheng655a7c02013-10-16 16:09:24 -0700658#define KVM_CAP_SET_TSS_ADDR 4
659#define KVM_CAP_VAPIC 6
660#define KVM_CAP_EXT_CPUID 7
661#define KVM_CAP_CLOCKSOURCE 8
Ben Cheng655a7c02013-10-16 16:09:24 -0700662#define KVM_CAP_NR_VCPUS 9
663#define KVM_CAP_NR_MEMSLOTS 10
664#define KVM_CAP_PIT 11
665#define KVM_CAP_NOP_IO_DELAY 12
Ben Cheng655a7c02013-10-16 16:09:24 -0700666#define KVM_CAP_PV_MMU 13
667#define KVM_CAP_MP_STATE 14
668#define KVM_CAP_COALESCED_MMIO 15
669#define KVM_CAP_SYNC_MMU 16
Ben Cheng655a7c02013-10-16 16:09:24 -0700670#define KVM_CAP_IOMMU 18
Ben Cheng655a7c02013-10-16 16:09:24 -0700671#define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21
Ben Cheng655a7c02013-10-16 16:09:24 -0700672#define KVM_CAP_USER_NMI 22
Ben Cheng655a7c02013-10-16 16:09:24 -0700673#ifdef __KVM_HAVE_GUEST_DEBUG
674#define KVM_CAP_SET_GUEST_DEBUG 23
675#endif
Ben Cheng655a7c02013-10-16 16:09:24 -0700676#ifdef __KVM_HAVE_PIT
677#define KVM_CAP_REINJECT_CONTROL 24
678#endif
679#define KVM_CAP_IRQ_ROUTING 25
Ben Cheng655a7c02013-10-16 16:09:24 -0700680#define KVM_CAP_IRQ_INJECT_STATUS 26
Ben Cheng655a7c02013-10-16 16:09:24 -0700681#define KVM_CAP_ASSIGN_DEV_IRQ 29
682#define KVM_CAP_JOIN_MEMORY_REGIONS_WORKS 30
683#ifdef __KVM_HAVE_MCE
Ben Cheng655a7c02013-10-16 16:09:24 -0700684#define KVM_CAP_MCE 31
685#endif
686#define KVM_CAP_IRQFD 32
687#ifdef __KVM_HAVE_PIT
Ben Cheng655a7c02013-10-16 16:09:24 -0700688#define KVM_CAP_PIT2 33
689#endif
690#define KVM_CAP_SET_BOOT_CPU_ID 34
691#ifdef __KVM_HAVE_PIT_STATE2
Ben Cheng655a7c02013-10-16 16:09:24 -0700692#define KVM_CAP_PIT_STATE2 35
693#endif
694#define KVM_CAP_IOEVENTFD 36
695#define KVM_CAP_SET_IDENTITY_MAP_ADDR 37
Ben Cheng655a7c02013-10-16 16:09:24 -0700696#ifdef __KVM_HAVE_XEN_HVM
697#define KVM_CAP_XEN_HVM 38
698#endif
699#define KVM_CAP_ADJUST_CLOCK 39
Ben Cheng655a7c02013-10-16 16:09:24 -0700700#define KVM_CAP_INTERNAL_ERROR_DATA 40
701#ifdef __KVM_HAVE_VCPU_EVENTS
702#define KVM_CAP_VCPU_EVENTS 41
703#endif
Ben Cheng655a7c02013-10-16 16:09:24 -0700704#define KVM_CAP_S390_PSW 42
705#define KVM_CAP_PPC_SEGSTATE 43
706#define KVM_CAP_HYPERV 44
707#define KVM_CAP_HYPERV_VAPIC 45
Ben Cheng655a7c02013-10-16 16:09:24 -0700708#define KVM_CAP_HYPERV_SPIN 46
709#define KVM_CAP_PCI_SEGMENT 47
710#define KVM_CAP_PPC_PAIRED_SINGLES 48
711#define KVM_CAP_INTR_SHADOW 49
Ben Cheng655a7c02013-10-16 16:09:24 -0700712#ifdef __KVM_HAVE_DEBUGREGS
713#define KVM_CAP_DEBUGREGS 50
714#endif
715#define KVM_CAP_X86_ROBUST_SINGLESTEP 51
Ben Cheng655a7c02013-10-16 16:09:24 -0700716#define KVM_CAP_PPC_OSI 52
717#define KVM_CAP_PPC_UNSET_IRQ 53
718#define KVM_CAP_ENABLE_CAP 54
719#ifdef __KVM_HAVE_XSAVE
Ben Cheng655a7c02013-10-16 16:09:24 -0700720#define KVM_CAP_XSAVE 55
721#endif
722#ifdef __KVM_HAVE_XCRS
723#define KVM_CAP_XCRS 56
Ben Cheng655a7c02013-10-16 16:09:24 -0700724#endif
725#define KVM_CAP_PPC_GET_PVINFO 57
726#define KVM_CAP_PPC_IRQ_LEVEL 58
727#define KVM_CAP_ASYNC_PF 59
Ben Cheng655a7c02013-10-16 16:09:24 -0700728#define KVM_CAP_TSC_CONTROL 60
729#define KVM_CAP_GET_TSC_KHZ 61
730#define KVM_CAP_PPC_BOOKE_SREGS 62
731#define KVM_CAP_SPAPR_TCE 63
Ben Cheng655a7c02013-10-16 16:09:24 -0700732#define KVM_CAP_PPC_SMT 64
733#define KVM_CAP_PPC_RMA 65
734#define KVM_CAP_MAX_VCPUS 66
735#define KVM_CAP_PPC_HIOR 67
Ben Cheng655a7c02013-10-16 16:09:24 -0700736#define KVM_CAP_PPC_PAPR 68
737#define KVM_CAP_SW_TLB 69
738#define KVM_CAP_ONE_REG 70
739#define KVM_CAP_S390_GMAP 71
Ben Cheng655a7c02013-10-16 16:09:24 -0700740#define KVM_CAP_TSC_DEADLINE_TIMER 72
741#define KVM_CAP_S390_UCONTROL 73
742#define KVM_CAP_SYNC_REGS 74
743#define KVM_CAP_PCI_2_3 75
Ben Cheng655a7c02013-10-16 16:09:24 -0700744#define KVM_CAP_KVMCLOCK_CTRL 76
745#define KVM_CAP_SIGNAL_MSI 77
746#define KVM_CAP_PPC_GET_SMMU_INFO 78
747#define KVM_CAP_S390_COW 79
Christopher Ferris82d75042015-01-26 10:57:07 -0800748#define KVM_CAP_PPC_ALLOC_HTAB 80
Ben Cheng655a7c02013-10-16 16:09:24 -0700749#define KVM_CAP_READONLY_MEM 81
Ben Cheng655a7c02013-10-16 16:09:24 -0700750#define KVM_CAP_IRQFD_RESAMPLE 82
751#define KVM_CAP_PPC_BOOKE_WATCHDOG 83
752#define KVM_CAP_PPC_HTAB_FD 84
753#define KVM_CAP_S390_CSS_SUPPORT 85
Ben Cheng655a7c02013-10-16 16:09:24 -0700754#define KVM_CAP_PPC_EPR 86
755#define KVM_CAP_ARM_PSCI 87
756#define KVM_CAP_ARM_SET_DEVICE_ADDR 88
757#define KVM_CAP_DEVICE_CTRL 89
Ben Cheng655a7c02013-10-16 16:09:24 -0700758#define KVM_CAP_IRQ_MPIC 90
759#define KVM_CAP_PPC_RTAS 91
760#define KVM_CAP_IRQ_XICS 92
Christopher Ferris38062f92014-07-09 15:33:25 -0700761#define KVM_CAP_ARM_EL1_32BIT 93
762#define KVM_CAP_SPAPR_MULTITCE 94
Christopher Ferris38062f92014-07-09 15:33:25 -0700763#define KVM_CAP_EXT_EMUL_CPUID 95
764#define KVM_CAP_HYPERV_TIME 96
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700765#define KVM_CAP_IOAPIC_POLARITY_IGNORED 97
766#define KVM_CAP_ENABLE_CAP_VM 98
767#define KVM_CAP_S390_IRQCHIP 99
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700768#define KVM_CAP_IOEVENTFD_NO_LENGTH 100
769#define KVM_CAP_VM_ATTRIBUTES 101
770#define KVM_CAP_ARM_PSCI_0_2 102
771#define KVM_CAP_PPC_FIXUP_HCALL 103
Christopher Ferris82d75042015-01-26 10:57:07 -0800772#define KVM_CAP_PPC_ENABLE_HCALL 104
773#define KVM_CAP_CHECK_EXTENSION_VM 105
Christopher Ferris05d08e92016-02-04 13:16:38 -0800774#define KVM_CAP_S390_USER_SIGP 106
775#define KVM_CAP_S390_VECTOR_REGISTERS 107
Christopher Ferris05d08e92016-02-04 13:16:38 -0800776#define KVM_CAP_S390_MEM_OP 108
777#define KVM_CAP_S390_USER_STSI 109
778#define KVM_CAP_S390_SKEYS 110
779#define KVM_CAP_MIPS_FPU 111
Christopher Ferris05d08e92016-02-04 13:16:38 -0800780#define KVM_CAP_MIPS_MSA 112
781#define KVM_CAP_S390_INJECT_IRQ 113
782#define KVM_CAP_S390_IRQ_STATE 114
783#define KVM_CAP_PPC_HWRNG 115
Christopher Ferris05d08e92016-02-04 13:16:38 -0800784#define KVM_CAP_DISABLE_QUIRKS 116
785#define KVM_CAP_X86_SMM 117
786#define KVM_CAP_MULTI_ADDRESS_SPACE 118
787#define KVM_CAP_GUEST_DEBUG_HW_BPS 119
Christopher Ferris05d08e92016-02-04 13:16:38 -0800788#define KVM_CAP_GUEST_DEBUG_HW_WPS 120
789#define KVM_CAP_SPLIT_IRQCHIP 121
790#define KVM_CAP_IOEVENTFD_ANY_LENGTH 122
Christopher Ferris106b3a82016-08-24 12:15:38 -0700791#define KVM_CAP_HYPERV_SYNIC 123
792#define KVM_CAP_S390_RI 124
793#define KVM_CAP_SPAPR_TCE_64 125
Christopher Ferris106b3a82016-08-24 12:15:38 -0700794#define KVM_CAP_ARM_PMU_V3 126
795#define KVM_CAP_VCPU_ATTRIBUTES 127
796#define KVM_CAP_MAX_VCPU_ID 128
Christopher Ferris49f525c2016-12-12 14:55:36 -0800797#define KVM_CAP_X2APIC_API 129
Christopher Ferris49f525c2016-12-12 14:55:36 -0800798#define KVM_CAP_S390_USER_INSTR0 130
799#define KVM_CAP_MSI_DEVID 131
800#define KVM_CAP_PPC_HTM 132
Christopher Ferris525ce912017-07-26 13:12:53 -0700801#define KVM_CAP_SPAPR_RESIZE_HPT 133
802#define KVM_CAP_PPC_MMU_RADIX 134
803#define KVM_CAP_PPC_MMU_HASH_V3 135
804#define KVM_CAP_IMMEDIATE_EXIT 136
805#define KVM_CAP_MIPS_VZ 137
806#define KVM_CAP_MIPS_TE 138
807#define KVM_CAP_MIPS_64BIT 139
808#define KVM_CAP_S390_GS 140
809#define KVM_CAP_S390_AIS 141
810#define KVM_CAP_SPAPR_TCE_VFIO 142
Christopher Ferris76a1d452018-06-27 14:12:29 -0700811#define KVM_CAP_X86_DISABLE_EXITS 143
Christopher Ferris525ce912017-07-26 13:12:53 -0700812#define KVM_CAP_ARM_USER_IRQ 144
Christopher Ferris1308ad32017-11-14 17:32:13 -0800813#define KVM_CAP_S390_CMMA_MIGRATION 145
814#define KVM_CAP_PPC_FWNMI 146
815#define KVM_CAP_PPC_SMT_POSSIBLE 147
816#define KVM_CAP_HYPERV_SYNIC2 148
817#define KVM_CAP_HYPERV_VP_INDEX 149
Christopher Ferris934ec942018-01-31 15:29:16 -0800818#define KVM_CAP_S390_AIS_MIGRATION 150
819#define KVM_CAP_PPC_GET_CPU_CHAR 151
820#define KVM_CAP_S390_BPB 152
Christopher Ferris76a1d452018-06-27 14:12:29 -0700821#define KVM_CAP_GET_MSR_FEATURES 153
822#define KVM_CAP_HYPERV_EVENTFD 154
Christopher Ferris9ce28842018-10-25 12:11:39 -0700823#define KVM_CAP_HYPERV_TLBFLUSH 155
824#define KVM_CAP_S390_HPAGE_1M 156
825#define KVM_CAP_NESTED_STATE 157
826#define KVM_CAP_ARM_INJECT_SERROR_ESR 158
827#define KVM_CAP_MSR_PLATFORM_INFO 159
Christopher Ferris86a48372019-01-10 14:14:59 -0800828#define KVM_CAP_PPC_NESTED_HV 160
829#define KVM_CAP_HYPERV_SEND_IPI 161
830#define KVM_CAP_COALESCED_PIO 162
831#define KVM_CAP_HYPERV_ENLIGHTENED_VMCS 163
832#define KVM_CAP_EXCEPTION_PAYLOAD 164
833#define KVM_CAP_ARM_VM_IPA_SIZE 165
Christopher Ferrisd842e432019-03-07 10:21:59 -0800834#define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT 166
835#define KVM_CAP_HYPERV_CPUID 167
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700836#define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 168
837#define KVM_CAP_PPC_IRQ_XIVE 169
838#define KVM_CAP_ARM_SVE 170
839#define KVM_CAP_ARM_PTRAUTH_ADDRESS 171
840#define KVM_CAP_ARM_PTRAUTH_GENERIC 172
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700841#define KVM_CAP_PMU_EVENT_FILTER 173
Christopher Ferris9584fa42019-12-09 15:36:13 -0800842#define KVM_CAP_ARM_IRQ_LINE_LAYOUT_2 174
843#define KVM_CAP_HYPERV_DIRECT_TLBFLUSH 175
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800844#define KVM_CAP_PPC_GUEST_DEBUG_SSTEP 176
845#define KVM_CAP_ARM_NISV_TO_USER 177
846#define KVM_CAP_ARM_INJECT_EXT_DABT 178
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700847#define KVM_CAP_S390_VCPU_RESETS 179
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700848#define KVM_CAP_S390_PROTECTED 180
849#define KVM_CAP_PPC_SECURE_GUEST 181
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700850#define KVM_CAP_HALT_POLL 182
851#define KVM_CAP_ASYNC_PF_INT 183
Christopher Ferris25c18d42020-10-14 17:42:58 -0700852#define KVM_CAP_LAST_CPU 184
853#define KVM_CAP_SMALLER_MAXPHYADDR 185
854#define KVM_CAP_S390_DIAG318 186
855#define KVM_CAP_STEAL_TIME 187
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800856#define KVM_CAP_X86_USER_SPACE_MSR 188
857#define KVM_CAP_X86_MSR_FILTER 189
858#define KVM_CAP_ENFORCE_PV_FEATURE_CPUID 190
Christopher Ferris05667cd2021-02-16 16:01:34 -0800859#define KVM_CAP_SYS_HYPERV_CPUID 191
860#define KVM_CAP_DIRTY_LOG_RING 192
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700861#define KVM_CAP_X86_BUS_LOCK_EXIT 193
862#define KVM_CAP_PPC_DAWR1 194
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000863#define KVM_CAP_SET_GUEST_DEBUG2 195
864#define KVM_CAP_SGX_ATTRIBUTE 196
865#define KVM_CAP_VM_COPY_ENC_CONTEXT_FROM 197
866#define KVM_CAP_PTP_KVM 198
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000867#define KVM_CAP_HYPERV_ENFORCE_CPUID 199
868#define KVM_CAP_SREGS2 200
869#define KVM_CAP_EXIT_HYPERCALL 201
870#define KVM_CAP_PPC_RPT_INVALIDATE 202
871#define KVM_CAP_BINARY_STATS_FD 203
872#define KVM_CAP_EXIT_ON_EMULATION_FAILURE 204
873#define KVM_CAP_ARM_MTE 205
Christopher Ferrisa4792612022-01-10 13:51:15 -0800874#define KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM 206
Christopher Ferris1ed55342022-03-22 16:06:25 -0700875#define KVM_CAP_VM_GPA_BITS 207
876#define KVM_CAP_XSAVE2 208
877#define KVM_CAP_SYS_ATTRIBUTES 209
878#define KVM_CAP_PPC_AIL_MODE_3 210
Christopher Ferris10a76e62022-06-08 13:31:52 -0700879#define KVM_CAP_S390_MEM_OP_EXTENSION 211
880#define KVM_CAP_PMU_CAPABILITY 212
881#define KVM_CAP_DISABLE_QUIRKS2 213
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700882#define KVM_CAP_VM_TSC_CONTROL 214
Christopher Ferris10a76e62022-06-08 13:31:52 -0700883#define KVM_CAP_SYSTEM_EVENT_DATA 215
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700884#define KVM_CAP_ARM_SYSTEM_SUSPEND 216
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700885#define KVM_CAP_S390_PROTECTED_DUMP 217
886#define KVM_CAP_X86_TRIPLE_FAULT_EVENT 218
887#define KVM_CAP_X86_NOTIFY_VMEXIT 219
888#define KVM_CAP_VM_DISABLE_NX_HUGE_PAGES 220
889#define KVM_CAP_S390_ZPCI_OP 221
890#define KVM_CAP_S390_CPU_TOPOLOGY 222
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000891#define KVM_CAP_DIRTY_LOG_RING_ACQ_REL 223
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800892#define KVM_CAP_S390_PROTECTED_ASYNC_DISABLE 224
893#define KVM_CAP_DIRTY_LOG_RING_WITH_BITMAP 225
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000894#define KVM_CAP_PMU_EVENT_MASKED_EVENTS 226
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700895#define KVM_CAP_COUNTER_OFFSET 227
Christopher Ferris8666d042023-09-06 14:55:31 -0700896#define KVM_CAP_ARM_EAGER_SPLIT_CHUNK_SIZE 228
897#define KVM_CAP_ARM_SUPPORTED_BLOCK_SIZES 229
Christopher Ferris0f795212024-01-17 14:17:28 -0800898#define KVM_CAP_ARM_SUPPORTED_REG_MASK_RANGES 230
Christopher Ferrisb830ddf2024-03-28 11:48:08 -0700899#define KVM_CAP_USER_MEMORY2 231
900#define KVM_CAP_MEMORY_FAULT_INFO 232
901#define KVM_CAP_MEMORY_ATTRIBUTES 233
902#define KVM_CAP_GUEST_MEMFD 234
903#define KVM_CAP_VM_TYPES 235
Christopher Ferris05d08e92016-02-04 13:16:38 -0800904#ifdef KVM_CAP_IRQ_ROUTING
Christopher Ferris05d08e92016-02-04 13:16:38 -0800905struct kvm_irq_routing_irqchip {
Tao Baod7db5942015-01-28 10:07:51 -0800906 __u32 irqchip;
907 __u32 pin;
Ben Cheng655a7c02013-10-16 16:09:24 -0700908};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800909struct kvm_irq_routing_msi {
Tao Baod7db5942015-01-28 10:07:51 -0800910 __u32 address_lo;
911 __u32 address_hi;
912 __u32 data;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800913 union {
914 __u32 pad;
915 __u32 devid;
916 };
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700917};
918struct kvm_irq_routing_s390_adapter {
Tao Baod7db5942015-01-28 10:07:51 -0800919 __u64 ind_addr;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800920 __u64 summary_addr;
Tao Baod7db5942015-01-28 10:07:51 -0800921 __u64 ind_offset;
922 __u32 summary_offset;
923 __u32 adapter_id;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800924};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700925struct kvm_irq_routing_hv_sint {
926 __u32 vcpu;
927 __u32 sint;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700928};
Christopher Ferris1ed55342022-03-22 16:06:25 -0700929struct kvm_irq_routing_xen_evtchn {
930 __u32 port;
931 __u32 vcpu;
932 __u32 priority;
933};
934#define KVM_IRQ_ROUTING_XEN_EVTCHN_PRIO_2LEVEL ((__u32) (- 1))
Ben Cheng655a7c02013-10-16 16:09:24 -0700935#define KVM_IRQ_ROUTING_IRQCHIP 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700936#define KVM_IRQ_ROUTING_MSI 2
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700937#define KVM_IRQ_ROUTING_S390_ADAPTER 3
Christopher Ferris106b3a82016-08-24 12:15:38 -0700938#define KVM_IRQ_ROUTING_HV_SINT 4
Christopher Ferris1ed55342022-03-22 16:06:25 -0700939#define KVM_IRQ_ROUTING_XEN_EVTCHN 5
Christopher Ferris05d08e92016-02-04 13:16:38 -0800940struct kvm_irq_routing_entry {
Tao Baod7db5942015-01-28 10:07:51 -0800941 __u32 gsi;
942 __u32 type;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700943 __u32 flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800944 __u32 pad;
Tao Baod7db5942015-01-28 10:07:51 -0800945 union {
946 struct kvm_irq_routing_irqchip irqchip;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700947 struct kvm_irq_routing_msi msi;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800948 struct kvm_irq_routing_s390_adapter adapter;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700949 struct kvm_irq_routing_hv_sint hv_sint;
Christopher Ferris1ed55342022-03-22 16:06:25 -0700950 struct kvm_irq_routing_xen_evtchn xen_evtchn;
Tao Baod7db5942015-01-28 10:07:51 -0800951 __u32 pad[8];
952 } u;
Ben Cheng655a7c02013-10-16 16:09:24 -0700953};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800954struct kvm_irq_routing {
Tao Baod7db5942015-01-28 10:07:51 -0800955 __u32 nr;
956 __u32 flags;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700957 struct kvm_irq_routing_entry entries[];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800958};
Ben Cheng655a7c02013-10-16 16:09:24 -0700959#endif
960#ifdef KVM_CAP_MCE
961struct kvm_x86_mce {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800962 __u64 status;
Tao Baod7db5942015-01-28 10:07:51 -0800963 __u64 addr;
964 __u64 misc;
965 __u64 mcg_status;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800966 __u8 bank;
Tao Baod7db5942015-01-28 10:07:51 -0800967 __u8 pad1[7];
968 __u64 pad2[3];
Ben Cheng655a7c02013-10-16 16:09:24 -0700969};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800970#endif
Ben Cheng655a7c02013-10-16 16:09:24 -0700971#ifdef KVM_CAP_XEN_HVM
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700972#define KVM_XEN_HVM_CONFIG_HYPERCALL_MSR (1 << 0)
973#define KVM_XEN_HVM_CONFIG_INTERCEPT_HCALL (1 << 1)
974#define KVM_XEN_HVM_CONFIG_SHARED_INFO (1 << 2)
975#define KVM_XEN_HVM_CONFIG_RUNSTATE (1 << 3)
Christopher Ferris1ed55342022-03-22 16:06:25 -0700976#define KVM_XEN_HVM_CONFIG_EVTCHN_2LEVEL (1 << 4)
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700977#define KVM_XEN_HVM_CONFIG_EVTCHN_SEND (1 << 5)
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800978#define KVM_XEN_HVM_CONFIG_RUNSTATE_UPDATE_FLAG (1 << 6)
Christopher Ferrisb830ddf2024-03-28 11:48:08 -0700979#define KVM_XEN_HVM_CONFIG_PVCLOCK_TSC_UNSTABLE (1 << 7)
Ben Cheng655a7c02013-10-16 16:09:24 -0700980struct kvm_xen_hvm_config {
Tao Baod7db5942015-01-28 10:07:51 -0800981 __u32 flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800982 __u32 msr;
Tao Baod7db5942015-01-28 10:07:51 -0800983 __u64 blob_addr_32;
984 __u64 blob_addr_64;
985 __u8 blob_size_32;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800986 __u8 blob_size_64;
Tao Baod7db5942015-01-28 10:07:51 -0800987 __u8 pad2[30];
Ben Cheng655a7c02013-10-16 16:09:24 -0700988};
989#endif
Christopher Ferris05d08e92016-02-04 13:16:38 -0800990#define KVM_IRQFD_FLAG_DEASSIGN (1 << 0)
Ben Cheng655a7c02013-10-16 16:09:24 -0700991#define KVM_IRQFD_FLAG_RESAMPLE (1 << 1)
992struct kvm_irqfd {
Tao Baod7db5942015-01-28 10:07:51 -0800993 __u32 fd;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800994 __u32 gsi;
Tao Baod7db5942015-01-28 10:07:51 -0800995 __u32 flags;
996 __u32 resamplefd;
997 __u8 pad[16];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800998};
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800999#define KVM_CLOCK_TSC_STABLE 2
Christopher Ferrisa4792612022-01-10 13:51:15 -08001000#define KVM_CLOCK_REALTIME (1 << 2)
1001#define KVM_CLOCK_HOST_TSC (1 << 3)
Ben Cheng655a7c02013-10-16 16:09:24 -07001002struct kvm_clock_data {
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001003 __u64 clock;
Tao Baod7db5942015-01-28 10:07:51 -08001004 __u32 flags;
Christopher Ferrisa4792612022-01-10 13:51:15 -08001005 __u32 pad0;
1006 __u64 realtime;
1007 __u64 host_tsc;
1008 __u32 pad[4];
Ben Cheng655a7c02013-10-16 16:09:24 -07001009};
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001010#define KVM_MMU_FSL_BOOKE_NOHV 0
Ben Cheng655a7c02013-10-16 16:09:24 -07001011#define KVM_MMU_FSL_BOOKE_HV 1
Christopher Ferris05d08e92016-02-04 13:16:38 -08001012struct kvm_config_tlb {
Tao Baod7db5942015-01-28 10:07:51 -08001013 __u64 params;
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001014 __u64 array;
Tao Baod7db5942015-01-28 10:07:51 -08001015 __u32 mmu_type;
Christopher Ferris05d08e92016-02-04 13:16:38 -08001016 __u32 array_len;
Ben Cheng655a7c02013-10-16 16:09:24 -07001017};
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001018struct kvm_dirty_tlb {
Tao Baod7db5942015-01-28 10:07:51 -08001019 __u64 bitmap;
Christopher Ferris05d08e92016-02-04 13:16:38 -08001020 __u32 num_dirty;
Ben Cheng655a7c02013-10-16 16:09:24 -07001021};
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001022#define KVM_REG_ARCH_MASK 0xff00000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -07001023#define KVM_REG_GENERIC 0x0000000000000000ULL
Christopher Ferris05d08e92016-02-04 13:16:38 -08001024#define KVM_REG_PPC 0x1000000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -07001025#define KVM_REG_X86 0x2000000000000000ULL
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001026#define KVM_REG_IA64 0x3000000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -07001027#define KVM_REG_ARM 0x4000000000000000ULL
Christopher Ferris05d08e92016-02-04 13:16:38 -08001028#define KVM_REG_S390 0x5000000000000000ULL
Christopher Ferris38062f92014-07-09 15:33:25 -07001029#define KVM_REG_ARM64 0x6000000000000000ULL
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001030#define KVM_REG_MIPS 0x7000000000000000ULL
Christopher Ferris9584fa42019-12-09 15:36:13 -08001031#define KVM_REG_RISCV 0x8000000000000000ULL
Christopher Ferris0f795212024-01-17 14:17:28 -08001032#define KVM_REG_LOONGARCH 0x9000000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -07001033#define KVM_REG_SIZE_SHIFT 52
Christopher Ferris05d08e92016-02-04 13:16:38 -08001034#define KVM_REG_SIZE_MASK 0x00f0000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -07001035#define KVM_REG_SIZE_U8 0x0000000000000000ULL
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001036#define KVM_REG_SIZE_U16 0x0010000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -07001037#define KVM_REG_SIZE_U32 0x0020000000000000ULL
Christopher Ferris05d08e92016-02-04 13:16:38 -08001038#define KVM_REG_SIZE_U64 0x0030000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -07001039#define KVM_REG_SIZE_U128 0x0040000000000000ULL
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001040#define KVM_REG_SIZE_U256 0x0050000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -07001041#define KVM_REG_SIZE_U512 0x0060000000000000ULL
Christopher Ferris05d08e92016-02-04 13:16:38 -08001042#define KVM_REG_SIZE_U1024 0x0070000000000000ULL
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -07001043#define KVM_REG_SIZE_U2048 0x0080000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -07001044struct kvm_reg_list {
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001045 __u64 n;
Christopher Ferris7447a1c2022-10-04 18:24:44 -07001046 __u64 reg[];
Christopher Ferris05d08e92016-02-04 13:16:38 -08001047};
Ben Cheng655a7c02013-10-16 16:09:24 -07001048struct kvm_one_reg {
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001049 __u64 id;
Tao Baod7db5942015-01-28 10:07:51 -08001050 __u64 addr;
Christopher Ferris05d08e92016-02-04 13:16:38 -08001051};
Christopher Ferris49f525c2016-12-12 14:55:36 -08001052#define KVM_MSI_VALID_DEVID (1U << 0)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001053struct kvm_msi {
Tao Baod7db5942015-01-28 10:07:51 -08001054 __u32 address_lo;
1055 __u32 address_hi;
Christopher Ferris05d08e92016-02-04 13:16:38 -08001056 __u32 data;
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001057 __u32 flags;
Christopher Ferris49f525c2016-12-12 14:55:36 -08001058 __u32 devid;
1059 __u8 pad[12];
Ben Cheng655a7c02013-10-16 16:09:24 -07001060};
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001061struct kvm_arm_device_addr {
Christopher Ferris49f525c2016-12-12 14:55:36 -08001062 __u64 id;
Tao Baod7db5942015-01-28 10:07:51 -08001063 __u64 addr;
Ben Cheng655a7c02013-10-16 16:09:24 -07001064};
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001065#define KVM_CREATE_DEVICE_TEST 1
Christopher Ferris49f525c2016-12-12 14:55:36 -08001066struct kvm_create_device {
Tao Baod7db5942015-01-28 10:07:51 -08001067 __u32 type;
1068 __u32 fd;
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001069 __u32 flags;
Christopher Ferris49f525c2016-12-12 14:55:36 -08001070};
Ben Cheng655a7c02013-10-16 16:09:24 -07001071struct kvm_device_attr {
Tao Baod7db5942015-01-28 10:07:51 -08001072 __u32 flags;
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001073 __u32 group;
Christopher Ferris49f525c2016-12-12 14:55:36 -08001074 __u64 attr;
Tao Baod7db5942015-01-28 10:07:51 -08001075 __u64 addr;
Ben Cheng655a7c02013-10-16 16:09:24 -07001076};
Christopher Ferris67d1e5e2023-10-31 13:36:37 -07001077#define KVM_DEV_VFIO_FILE 1
1078#define KVM_DEV_VFIO_FILE_ADD 1
1079#define KVM_DEV_VFIO_FILE_DEL 2
1080#define KVM_DEV_VFIO_GROUP KVM_DEV_VFIO_FILE
1081#define KVM_DEV_VFIO_GROUP_ADD KVM_DEV_VFIO_FILE_ADD
1082#define KVM_DEV_VFIO_GROUP_DEL KVM_DEV_VFIO_FILE_DEL
Christopher Ferris525ce912017-07-26 13:12:53 -07001083#define KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE 3
Christopher Ferris82d75042015-01-26 10:57:07 -08001084enum kvm_device_type {
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001085 KVM_DEV_TYPE_FSL_MPIC_20 = 1,
Christopher Ferris49f525c2016-12-12 14:55:36 -08001086#define KVM_DEV_TYPE_FSL_MPIC_20 KVM_DEV_TYPE_FSL_MPIC_20
Tao Baod7db5942015-01-28 10:07:51 -08001087 KVM_DEV_TYPE_FSL_MPIC_42,
Christopher Ferris82d75042015-01-26 10:57:07 -08001088#define KVM_DEV_TYPE_FSL_MPIC_42 KVM_DEV_TYPE_FSL_MPIC_42
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001089 KVM_DEV_TYPE_XICS,
Christopher Ferris49f525c2016-12-12 14:55:36 -08001090#define KVM_DEV_TYPE_XICS KVM_DEV_TYPE_XICS
Tao Baod7db5942015-01-28 10:07:51 -08001091 KVM_DEV_TYPE_VFIO,
Christopher Ferris82d75042015-01-26 10:57:07 -08001092#define KVM_DEV_TYPE_VFIO KVM_DEV_TYPE_VFIO
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001093 KVM_DEV_TYPE_ARM_VGIC_V2,
Christopher Ferris49f525c2016-12-12 14:55:36 -08001094#define KVM_DEV_TYPE_ARM_VGIC_V2 KVM_DEV_TYPE_ARM_VGIC_V2
Tao Baod7db5942015-01-28 10:07:51 -08001095 KVM_DEV_TYPE_FLIC,
Christopher Ferris82d75042015-01-26 10:57:07 -08001096#define KVM_DEV_TYPE_FLIC KVM_DEV_TYPE_FLIC
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001097 KVM_DEV_TYPE_ARM_VGIC_V3,
Christopher Ferris49f525c2016-12-12 14:55:36 -08001098#define KVM_DEV_TYPE_ARM_VGIC_V3 KVM_DEV_TYPE_ARM_VGIC_V3
1099 KVM_DEV_TYPE_ARM_VGIC_ITS,
1100#define KVM_DEV_TYPE_ARM_VGIC_ITS KVM_DEV_TYPE_ARM_VGIC_ITS
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -07001101 KVM_DEV_TYPE_XIVE,
1102#define KVM_DEV_TYPE_XIVE KVM_DEV_TYPE_XIVE
Christopher Ferrisd32ca142020-02-04 16:16:51 -08001103 KVM_DEV_TYPE_ARM_PV_TIME,
1104#define KVM_DEV_TYPE_ARM_PV_TIME KVM_DEV_TYPE_ARM_PV_TIME
Christopher Ferris8666d042023-09-06 14:55:31 -07001105 KVM_DEV_TYPE_RISCV_AIA,
1106#define KVM_DEV_TYPE_RISCV_AIA KVM_DEV_TYPE_RISCV_AIA
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001107 KVM_DEV_TYPE_MAX,
Christopher Ferris82d75042015-01-26 10:57:07 -08001108};
Christopher Ferris525ce912017-07-26 13:12:53 -07001109struct kvm_vfio_spapr_tce {
1110 __s32 groupfd;
1111 __s32 tablefd;
1112};
Ben Cheng655a7c02013-10-16 16:09:24 -07001113#define KVM_CREATE_VCPU _IO(KVMIO, 0x41)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001114#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log)
Ben Cheng655a7c02013-10-16 16:09:24 -07001115#define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44)
Ben Cheng655a7c02013-10-16 16:09:24 -07001116#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001117#define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46, struct kvm_userspace_memory_region)
Ben Cheng655a7c02013-10-16 16:09:24 -07001118#define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47)
1119#define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64)
Christopher Ferrisb830ddf2024-03-28 11:48:08 -07001120#define KVM_SET_USER_MEMORY_REGION2 _IOW(KVMIO, 0x49, struct kvm_userspace_memory_region2)
Ben Cheng655a7c02013-10-16 16:09:24 -07001121struct kvm_s390_ucas_mapping {
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001122 __u64 user_addr;
Tao Baod7db5942015-01-28 10:07:51 -08001123 __u64 vcpu_addr;
1124 __u64 length;
Ben Cheng655a7c02013-10-16 16:09:24 -07001125};
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001126#define KVM_S390_UCAS_MAP _IOW(KVMIO, 0x50, struct kvm_s390_ucas_mapping)
Ben Cheng655a7c02013-10-16 16:09:24 -07001127#define KVM_S390_UCAS_UNMAP _IOW(KVMIO, 0x51, struct kvm_s390_ucas_mapping)
1128#define KVM_S390_VCPU_FAULT _IOW(KVMIO, 0x52, unsigned long)
Ben Cheng655a7c02013-10-16 16:09:24 -07001129#define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001130#define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level)
Ben Cheng655a7c02013-10-16 16:09:24 -07001131#define KVM_GET_IRQCHIP _IOWR(KVMIO, 0x62, struct kvm_irqchip)
1132#define KVM_SET_IRQCHIP _IOR(KVMIO, 0x63, struct kvm_irqchip)
Ben Cheng655a7c02013-10-16 16:09:24 -07001133#define KVM_CREATE_PIT _IO(KVMIO, 0x64)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001134#define KVM_GET_PIT _IOWR(KVMIO, 0x65, struct kvm_pit_state)
Ben Cheng655a7c02013-10-16 16:09:24 -07001135#define KVM_SET_PIT _IOR(KVMIO, 0x66, struct kvm_pit_state)
1136#define KVM_IRQ_LINE_STATUS _IOWR(KVMIO, 0x67, struct kvm_irq_level)
Tao Baod7db5942015-01-28 10:07:51 -08001137#define KVM_REGISTER_COALESCED_MMIO _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001138#define KVM_UNREGISTER_COALESCED_MMIO _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone)
Ben Cheng655a7c02013-10-16 16:09:24 -07001139#define KVM_SET_GSI_ROUTING _IOW(KVMIO, 0x6a, struct kvm_irq_routing)
Ben Cheng655a7c02013-10-16 16:09:24 -07001140#define KVM_REINJECT_CONTROL _IO(KVMIO, 0x71)
Ben Cheng655a7c02013-10-16 16:09:24 -07001141#define KVM_IRQFD _IOW(KVMIO, 0x76, struct kvm_irqfd)
Ben Cheng655a7c02013-10-16 16:09:24 -07001142#define KVM_CREATE_PIT2 _IOW(KVMIO, 0x77, struct kvm_pit_config)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001143#define KVM_SET_BOOT_CPU_ID _IO(KVMIO, 0x78)
Ben Cheng655a7c02013-10-16 16:09:24 -07001144#define KVM_IOEVENTFD _IOW(KVMIO, 0x79, struct kvm_ioeventfd)
1145#define KVM_XEN_HVM_CONFIG _IOW(KVMIO, 0x7a, struct kvm_xen_hvm_config)
Ben Cheng655a7c02013-10-16 16:09:24 -07001146#define KVM_SET_CLOCK _IOW(KVMIO, 0x7b, struct kvm_clock_data)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001147#define KVM_GET_CLOCK _IOR(KVMIO, 0x7c, struct kvm_clock_data)
Ben Cheng655a7c02013-10-16 16:09:24 -07001148#define KVM_GET_PIT2 _IOR(KVMIO, 0x9f, struct kvm_pit_state2)
1149#define KVM_SET_PIT2 _IOW(KVMIO, 0xa0, struct kvm_pit_state2)
Ben Cheng655a7c02013-10-16 16:09:24 -07001150#define KVM_PPC_GET_PVINFO _IOW(KVMIO, 0xa1, struct kvm_ppc_pvinfo)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001151#define KVM_SET_TSC_KHZ _IO(KVMIO, 0xa2)
Ben Cheng655a7c02013-10-16 16:09:24 -07001152#define KVM_GET_TSC_KHZ _IO(KVMIO, 0xa3)
Ben Cheng655a7c02013-10-16 16:09:24 -07001153#define KVM_SIGNAL_MSI _IOW(KVMIO, 0xa5, struct kvm_msi)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001154#define KVM_PPC_GET_SMMU_INFO _IOR(KVMIO, 0xa6, struct kvm_ppc_smmu_info)
Ben Cheng655a7c02013-10-16 16:09:24 -07001155#define KVM_PPC_ALLOCATE_HTAB _IOWR(KVMIO, 0xa7, __u32)
1156#define KVM_CREATE_SPAPR_TCE _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce)
Christopher Ferris106b3a82016-08-24 12:15:38 -07001157#define KVM_CREATE_SPAPR_TCE_64 _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce_64)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001158#define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma)
Christopher Ferris38062f92014-07-09 15:33:25 -07001159#define KVM_PPC_GET_HTAB_FD _IOW(KVMIO, 0xaa, struct kvm_get_htab_fd)
Ben Cheng655a7c02013-10-16 16:09:24 -07001160#define KVM_ARM_SET_DEVICE_ADDR _IOW(KVMIO, 0xab, struct kvm_arm_device_addr)
1161#define KVM_PPC_RTAS_DEFINE_TOKEN _IOW(KVMIO, 0xac, struct kvm_rtas_token_args)
Christopher Ferris525ce912017-07-26 13:12:53 -07001162#define KVM_PPC_RESIZE_HPT_PREPARE _IOR(KVMIO, 0xad, struct kvm_ppc_resize_hpt)
1163#define KVM_PPC_RESIZE_HPT_COMMIT _IOR(KVMIO, 0xae, struct kvm_ppc_resize_hpt)
1164#define KVM_PPC_CONFIGURE_V3_MMU _IOW(KVMIO, 0xaf, struct kvm_ppc_mmuv3_cfg)
1165#define KVM_PPC_GET_RMMU_INFO _IOW(KVMIO, 0xb0, struct kvm_ppc_rmmu_info)
Christopher Ferris934ec942018-01-31 15:29:16 -08001166#define KVM_PPC_GET_CPU_CHAR _IOR(KVMIO, 0xb1, struct kvm_ppc_cpu_char)
Christopher Ferrisb8a95e22019-10-02 18:29:20 -07001167#define KVM_SET_PMU_EVENT_FILTER _IOW(KVMIO, 0xb2, struct kvm_pmu_event_filter)
Christopher Ferrisd32ca142020-02-04 16:16:51 -08001168#define KVM_PPC_SVM_OFF _IO(KVMIO, 0xb3)
Christopher Ferris3a39c0b2021-09-02 00:03:38 +00001169#define KVM_ARM_MTE_COPY_TAGS _IOR(KVMIO, 0xb4, struct kvm_arm_copy_mte_tags)
Christopher Ferris37c3f3c2023-07-10 10:59:05 -07001170#define KVM_ARM_SET_COUNTER_OFFSET _IOW(KVMIO, 0xb5, struct kvm_arm_counter_offset)
Christopher Ferris0f795212024-01-17 14:17:28 -08001171#define KVM_ARM_GET_REG_WRITABLE_MASKS _IOR(KVMIO, 0xb6, struct reg_mask_range)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001172#define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device)
Christopher Ferris38062f92014-07-09 15:33:25 -07001173#define KVM_SET_DEVICE_ATTR _IOW(KVMIO, 0xe1, struct kvm_device_attr)
Ben Cheng655a7c02013-10-16 16:09:24 -07001174#define KVM_GET_DEVICE_ATTR _IOW(KVMIO, 0xe2, struct kvm_device_attr)
1175#define KVM_HAS_DEVICE_ATTR _IOW(KVMIO, 0xe3, struct kvm_device_attr)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001176#define KVM_RUN _IO(KVMIO, 0x80)
Christopher Ferris38062f92014-07-09 15:33:25 -07001177#define KVM_GET_REGS _IOR(KVMIO, 0x81, struct kvm_regs)
Ben Cheng655a7c02013-10-16 16:09:24 -07001178#define KVM_SET_REGS _IOW(KVMIO, 0x82, struct kvm_regs)
1179#define KVM_GET_SREGS _IOR(KVMIO, 0x83, struct kvm_sregs)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001180#define KVM_SET_SREGS _IOW(KVMIO, 0x84, struct kvm_sregs)
Christopher Ferris38062f92014-07-09 15:33:25 -07001181#define KVM_TRANSLATE _IOWR(KVMIO, 0x85, struct kvm_translation)
Ben Cheng655a7c02013-10-16 16:09:24 -07001182#define KVM_INTERRUPT _IOW(KVMIO, 0x86, struct kvm_interrupt)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001183#define KVM_GET_MSRS _IOWR(KVMIO, 0x88, struct kvm_msrs)
Christopher Ferris38062f92014-07-09 15:33:25 -07001184#define KVM_SET_MSRS _IOW(KVMIO, 0x89, struct kvm_msrs)
Ben Cheng655a7c02013-10-16 16:09:24 -07001185#define KVM_SET_CPUID _IOW(KVMIO, 0x8a, struct kvm_cpuid)
1186#define KVM_SET_SIGNAL_MASK _IOW(KVMIO, 0x8b, struct kvm_signal_mask)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001187#define KVM_GET_FPU _IOR(KVMIO, 0x8c, struct kvm_fpu)
Christopher Ferris38062f92014-07-09 15:33:25 -07001188#define KVM_SET_FPU _IOW(KVMIO, 0x8d, struct kvm_fpu)
Ben Cheng655a7c02013-10-16 16:09:24 -07001189#define KVM_GET_LAPIC _IOR(KVMIO, 0x8e, struct kvm_lapic_state)
1190#define KVM_SET_LAPIC _IOW(KVMIO, 0x8f, struct kvm_lapic_state)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001191#define KVM_SET_CPUID2 _IOW(KVMIO, 0x90, struct kvm_cpuid2)
Christopher Ferris38062f92014-07-09 15:33:25 -07001192#define KVM_GET_CPUID2 _IOWR(KVMIO, 0x91, struct kvm_cpuid2)
Ben Cheng655a7c02013-10-16 16:09:24 -07001193#define KVM_TPR_ACCESS_REPORTING _IOWR(KVMIO, 0x92, struct kvm_tpr_access_ctl)
1194#define KVM_SET_VAPIC_ADDR _IOW(KVMIO, 0x93, struct kvm_vapic_addr)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001195#define KVM_S390_INTERRUPT _IOW(KVMIO, 0x94, struct kvm_s390_interrupt)
Tao Baod7db5942015-01-28 10:07:51 -08001196#define KVM_S390_STORE_STATUS_NOADDR (- 1ul)
Tao Baod7db5942015-01-28 10:07:51 -08001197#define KVM_S390_STORE_STATUS_PREFIXED (- 2ul)
Ben Cheng655a7c02013-10-16 16:09:24 -07001198#define KVM_S390_STORE_STATUS _IOW(KVMIO, 0x95, unsigned long)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001199#define KVM_S390_SET_INITIAL_PSW _IOW(KVMIO, 0x96, struct kvm_s390_psw)
Christopher Ferris38062f92014-07-09 15:33:25 -07001200#define KVM_S390_INITIAL_RESET _IO(KVMIO, 0x97)
Ben Cheng655a7c02013-10-16 16:09:24 -07001201#define KVM_GET_MP_STATE _IOR(KVMIO, 0x98, struct kvm_mp_state)
1202#define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001203#define KVM_NMI _IO(KVMIO, 0x9a)
Christopher Ferris38062f92014-07-09 15:33:25 -07001204#define KVM_SET_GUEST_DEBUG _IOW(KVMIO, 0x9b, struct kvm_guest_debug)
Ben Cheng655a7c02013-10-16 16:09:24 -07001205#define KVM_X86_SETUP_MCE _IOW(KVMIO, 0x9c, __u64)
1206#define KVM_X86_GET_MCE_CAP_SUPPORTED _IOR(KVMIO, 0x9d, __u64)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001207#define KVM_X86_SET_MCE _IOW(KVMIO, 0x9e, struct kvm_x86_mce)
Ben Cheng655a7c02013-10-16 16:09:24 -07001208#define KVM_GET_VCPU_EVENTS _IOR(KVMIO, 0x9f, struct kvm_vcpu_events)
Ben Cheng655a7c02013-10-16 16:09:24 -07001209#define KVM_SET_VCPU_EVENTS _IOW(KVMIO, 0xa0, struct kvm_vcpu_events)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001210#define KVM_GET_DEBUGREGS _IOR(KVMIO, 0xa1, struct kvm_debugregs)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001211#define KVM_SET_DEBUGREGS _IOW(KVMIO, 0xa2, struct kvm_debugregs)
Ben Cheng655a7c02013-10-16 16:09:24 -07001212#define KVM_ENABLE_CAP _IOW(KVMIO, 0xa3, struct kvm_enable_cap)
Ben Cheng655a7c02013-10-16 16:09:24 -07001213#define KVM_GET_XSAVE _IOR(KVMIO, 0xa4, struct kvm_xsave)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001214#define KVM_SET_XSAVE _IOW(KVMIO, 0xa5, struct kvm_xsave)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001215#define KVM_GET_XCRS _IOR(KVMIO, 0xa6, struct kvm_xcrs)
Ben Cheng655a7c02013-10-16 16:09:24 -07001216#define KVM_SET_XCRS _IOW(KVMIO, 0xa7, struct kvm_xcrs)
Ben Cheng655a7c02013-10-16 16:09:24 -07001217#define KVM_DIRTY_TLB _IOW(KVMIO, 0xaa, struct kvm_dirty_tlb)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001218#define KVM_GET_ONE_REG _IOW(KVMIO, 0xab, struct kvm_one_reg)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001219#define KVM_SET_ONE_REG _IOW(KVMIO, 0xac, struct kvm_one_reg)
Ben Cheng655a7c02013-10-16 16:09:24 -07001220#define KVM_KVMCLOCK_CTRL _IO(KVMIO, 0xad)
Ben Cheng655a7c02013-10-16 16:09:24 -07001221#define KVM_ARM_VCPU_INIT _IOW(KVMIO, 0xae, struct kvm_vcpu_init)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001222#define KVM_ARM_PREFERRED_TARGET _IOR(KVMIO, 0xaf, struct kvm_vcpu_init)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001223#define KVM_GET_REG_LIST _IOWR(KVMIO, 0xb0, struct kvm_reg_list)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001224#define KVM_S390_MEM_OP _IOW(KVMIO, 0xb1, struct kvm_s390_mem_op)
1225#define KVM_S390_GET_SKEYS _IOW(KVMIO, 0xb2, struct kvm_s390_skeys)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001226#define KVM_S390_SET_SKEYS _IOW(KVMIO, 0xb3, struct kvm_s390_skeys)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001227#define KVM_S390_IRQ _IOW(KVMIO, 0xb4, struct kvm_s390_irq)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001228#define KVM_S390_SET_IRQ_STATE _IOW(KVMIO, 0xb5, struct kvm_s390_irq_state)
1229#define KVM_S390_GET_IRQ_STATE _IOW(KVMIO, 0xb6, struct kvm_s390_irq_state)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001230#define KVM_SMI _IO(KVMIO, 0xb7)
Christopher Ferris1308ad32017-11-14 17:32:13 -08001231#define KVM_S390_GET_CMMA_BITS _IOWR(KVMIO, 0xb8, struct kvm_s390_cmma_log)
1232#define KVM_S390_SET_CMMA_BITS _IOW(KVMIO, 0xb9, struct kvm_s390_cmma_log)
Christopher Ferris76a1d452018-06-27 14:12:29 -07001233#define KVM_MEMORY_ENCRYPT_OP _IOWR(KVMIO, 0xba, unsigned long)
1234struct kvm_enc_region {
1235 __u64 addr;
1236 __u64 size;
1237};
1238#define KVM_MEMORY_ENCRYPT_REG_REGION _IOR(KVMIO, 0xbb, struct kvm_enc_region)
1239#define KVM_MEMORY_ENCRYPT_UNREG_REGION _IOR(KVMIO, 0xbc, struct kvm_enc_region)
1240#define KVM_HYPERV_EVENTFD _IOW(KVMIO, 0xbd, struct kvm_hyperv_eventfd)
Christopher Ferris9ce28842018-10-25 12:11:39 -07001241#define KVM_GET_NESTED_STATE _IOWR(KVMIO, 0xbe, struct kvm_nested_state)
1242#define KVM_SET_NESTED_STATE _IOW(KVMIO, 0xbf, struct kvm_nested_state)
Christopher Ferrisd842e432019-03-07 10:21:59 -08001243#define KVM_CLEAR_DIRTY_LOG _IOWR(KVMIO, 0xc0, struct kvm_clear_dirty_log)
1244#define KVM_GET_SUPPORTED_HV_CPUID _IOWR(KVMIO, 0xc1, struct kvm_cpuid2)
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -07001245#define KVM_ARM_VCPU_FINALIZE _IOW(KVMIO, 0xc2, int)
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -07001246#define KVM_S390_NORMAL_RESET _IO(KVMIO, 0xc3)
1247#define KVM_S390_CLEAR_RESET _IO(KVMIO, 0xc4)
Christopher Ferrisaf09c702020-06-01 20:29:29 -07001248struct kvm_s390_pv_sec_parm {
1249 __u64 origin;
1250 __u64 length;
1251};
1252struct kvm_s390_pv_unp {
1253 __u64 addr;
1254 __u64 size;
1255 __u64 tweak;
1256};
Christopher Ferris7447a1c2022-10-04 18:24:44 -07001257enum pv_cmd_dmp_id {
1258 KVM_PV_DUMP_INIT,
1259 KVM_PV_DUMP_CONFIG_STOR_STATE,
1260 KVM_PV_DUMP_COMPLETE,
1261 KVM_PV_DUMP_CPU,
1262};
1263struct kvm_s390_pv_dmp {
1264 __u64 subcmd;
1265 __u64 buff_addr;
1266 __u64 buff_len;
1267 __u64 gaddr;
1268 __u64 reserved[4];
1269};
1270enum pv_cmd_info_id {
1271 KVM_PV_INFO_VM,
1272 KVM_PV_INFO_DUMP,
1273};
1274struct kvm_s390_pv_info_dump {
1275 __u64 dump_cpu_buffer_len;
1276 __u64 dump_config_mem_buffer_per_1m;
1277 __u64 dump_config_finalize_len;
1278};
1279struct kvm_s390_pv_info_vm {
1280 __u64 inst_calls_list[4];
1281 __u64 max_cpus;
1282 __u64 max_guests;
1283 __u64 max_guest_addr;
1284 __u64 feature_indication;
1285};
1286struct kvm_s390_pv_info_header {
1287 __u32 id;
1288 __u32 len_max;
1289 __u32 len_written;
1290 __u32 reserved;
1291};
1292struct kvm_s390_pv_info {
1293 struct kvm_s390_pv_info_header header;
1294 union {
1295 struct kvm_s390_pv_info_dump dump;
1296 struct kvm_s390_pv_info_vm vm;
1297 };
1298};
Christopher Ferrisaf09c702020-06-01 20:29:29 -07001299enum pv_cmd_id {
1300 KVM_PV_ENABLE,
1301 KVM_PV_DISABLE,
1302 KVM_PV_SET_SEC_PARMS,
1303 KVM_PV_UNPACK,
1304 KVM_PV_VERIFY,
1305 KVM_PV_PREP_RESET,
1306 KVM_PV_UNSHARE_ALL,
Christopher Ferris7447a1c2022-10-04 18:24:44 -07001307 KVM_PV_INFO,
1308 KVM_PV_DUMP,
Christopher Ferris8b7fdc92023-02-21 13:36:32 -08001309 KVM_PV_ASYNC_CLEANUP_PREPARE,
1310 KVM_PV_ASYNC_CLEANUP_PERFORM,
Christopher Ferrisaf09c702020-06-01 20:29:29 -07001311};
1312struct kvm_pv_cmd {
1313 __u32 cmd;
1314 __u16 rc;
1315 __u16 rrc;
1316 __u64 data;
1317 __u32 flags;
1318 __u32 reserved[3];
1319};
1320#define KVM_S390_PV_COMMAND _IOWR(KVMIO, 0xc5, struct kvm_pv_cmd)
Christopher Ferris32ff3f82020-12-14 13:10:04 -08001321#define KVM_X86_SET_MSR_FILTER _IOW(KVMIO, 0xc6, struct kvm_msr_filter)
Christopher Ferris05667cd2021-02-16 16:01:34 -08001322#define KVM_RESET_DIRTY_RINGS _IO(KVMIO, 0xc7)
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001323#define KVM_XEN_HVM_GET_ATTR _IOWR(KVMIO, 0xc8, struct kvm_xen_hvm_attr)
1324#define KVM_XEN_HVM_SET_ATTR _IOW(KVMIO, 0xc9, struct kvm_xen_hvm_attr)
1325struct kvm_xen_hvm_attr {
1326 __u16 type;
1327 __u16 pad[3];
1328 union {
1329 __u8 long_mode;
1330 __u8 vector;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -08001331 __u8 runstate_update_flag;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001332 struct {
1333 __u64 gfn;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -08001334#define KVM_XEN_INVALID_GFN ((__u64) - 1)
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001335 } shared_info;
Christopher Ferris80ae69d2022-08-02 16:32:21 -07001336 struct {
1337 __u32 send_port;
1338 __u32 type;
1339 __u32 flags;
1340#define KVM_XEN_EVTCHN_DEASSIGN (1 << 0)
1341#define KVM_XEN_EVTCHN_UPDATE (1 << 1)
1342#define KVM_XEN_EVTCHN_RESET (1 << 2)
1343 union {
1344 struct {
1345 __u32 port;
1346 __u32 vcpu;
1347 __u32 priority;
1348 } port;
1349 struct {
1350 __u32 port;
1351 __s32 fd;
1352 } eventfd;
1353 __u32 padding[4];
1354 } deliver;
1355 } evtchn;
1356 __u32 xen_version;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001357 __u64 pad[8];
1358 } u;
1359};
1360#define KVM_XEN_ATTR_TYPE_LONG_MODE 0x0
1361#define KVM_XEN_ATTR_TYPE_SHARED_INFO 0x1
1362#define KVM_XEN_ATTR_TYPE_UPCALL_VECTOR 0x2
Christopher Ferris80ae69d2022-08-02 16:32:21 -07001363#define KVM_XEN_ATTR_TYPE_EVTCHN 0x3
1364#define KVM_XEN_ATTR_TYPE_XEN_VERSION 0x4
Christopher Ferris8b7fdc92023-02-21 13:36:32 -08001365#define KVM_XEN_ATTR_TYPE_RUNSTATE_UPDATE_FLAG 0x5
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001366#define KVM_XEN_VCPU_GET_ATTR _IOWR(KVMIO, 0xca, struct kvm_xen_vcpu_attr)
1367#define KVM_XEN_VCPU_SET_ATTR _IOW(KVMIO, 0xcb, struct kvm_xen_vcpu_attr)
Christopher Ferris80ae69d2022-08-02 16:32:21 -07001368#define KVM_XEN_HVM_EVTCHN_SEND _IOW(KVMIO, 0xd0, struct kvm_irq_routing_xen_evtchn)
Christopher Ferris3a39c0b2021-09-02 00:03:38 +00001369#define KVM_GET_SREGS2 _IOR(KVMIO, 0xcc, struct kvm_sregs2)
1370#define KVM_SET_SREGS2 _IOW(KVMIO, 0xcd, struct kvm_sregs2)
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001371struct kvm_xen_vcpu_attr {
1372 __u16 type;
1373 __u16 pad[3];
1374 union {
1375 __u64 gpa;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -08001376#define KVM_XEN_INVALID_GPA ((__u64) - 1)
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001377 __u64 pad[8];
1378 struct {
1379 __u64 state;
1380 __u64 state_entry_time;
1381 __u64 time_running;
1382 __u64 time_runnable;
1383 __u64 time_blocked;
1384 __u64 time_offline;
1385 } runstate;
Christopher Ferris80ae69d2022-08-02 16:32:21 -07001386 __u32 vcpu_id;
1387 struct {
1388 __u32 port;
1389 __u32 priority;
1390 __u64 expires_ns;
1391 } timer;
1392 __u8 vector;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001393 } u;
1394};
1395#define KVM_XEN_VCPU_ATTR_TYPE_VCPU_INFO 0x0
1396#define KVM_XEN_VCPU_ATTR_TYPE_VCPU_TIME_INFO 0x1
1397#define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_ADDR 0x2
1398#define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_CURRENT 0x3
1399#define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_DATA 0x4
1400#define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_ADJUST 0x5
Christopher Ferris80ae69d2022-08-02 16:32:21 -07001401#define KVM_XEN_VCPU_ATTR_TYPE_VCPU_ID 0x6
1402#define KVM_XEN_VCPU_ATTR_TYPE_TIMER 0x7
1403#define KVM_XEN_VCPU_ATTR_TYPE_UPCALL_VECTOR 0x8
Christopher Ferris76a1d452018-06-27 14:12:29 -07001404enum sev_cmd_id {
1405 KVM_SEV_INIT = 0,
1406 KVM_SEV_ES_INIT,
1407 KVM_SEV_LAUNCH_START,
1408 KVM_SEV_LAUNCH_UPDATE_DATA,
1409 KVM_SEV_LAUNCH_UPDATE_VMSA,
1410 KVM_SEV_LAUNCH_SECRET,
1411 KVM_SEV_LAUNCH_MEASURE,
1412 KVM_SEV_LAUNCH_FINISH,
1413 KVM_SEV_SEND_START,
1414 KVM_SEV_SEND_UPDATE_DATA,
1415 KVM_SEV_SEND_UPDATE_VMSA,
1416 KVM_SEV_SEND_FINISH,
1417 KVM_SEV_RECEIVE_START,
1418 KVM_SEV_RECEIVE_UPDATE_DATA,
1419 KVM_SEV_RECEIVE_UPDATE_VMSA,
1420 KVM_SEV_RECEIVE_FINISH,
1421 KVM_SEV_GUEST_STATUS,
1422 KVM_SEV_DBG_DECRYPT,
1423 KVM_SEV_DBG_ENCRYPT,
1424 KVM_SEV_CERT_EXPORT,
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001425 KVM_SEV_GET_ATTESTATION_REPORT,
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +00001426 KVM_SEV_SEND_CANCEL,
Christopher Ferris76a1d452018-06-27 14:12:29 -07001427 KVM_SEV_NR_MAX,
1428};
1429struct kvm_sev_cmd {
1430 __u32 id;
1431 __u64 data;
1432 __u32 error;
1433 __u32 sev_fd;
1434};
1435struct kvm_sev_launch_start {
1436 __u32 handle;
1437 __u32 policy;
1438 __u64 dh_uaddr;
1439 __u32 dh_len;
1440 __u64 session_uaddr;
1441 __u32 session_len;
1442};
1443struct kvm_sev_launch_update_data {
1444 __u64 uaddr;
1445 __u32 len;
1446};
1447struct kvm_sev_launch_secret {
1448 __u64 hdr_uaddr;
1449 __u32 hdr_len;
1450 __u64 guest_uaddr;
1451 __u32 guest_len;
1452 __u64 trans_uaddr;
1453 __u32 trans_len;
1454};
1455struct kvm_sev_launch_measure {
1456 __u64 uaddr;
1457 __u32 len;
1458};
1459struct kvm_sev_guest_status {
1460 __u32 handle;
1461 __u32 policy;
1462 __u32 state;
1463};
1464struct kvm_sev_dbg {
1465 __u64 src_uaddr;
1466 __u64 dst_uaddr;
1467 __u32 len;
1468};
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001469struct kvm_sev_attestation_report {
1470 __u8 mnonce[16];
1471 __u64 uaddr;
1472 __u32 len;
1473};
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +00001474struct kvm_sev_send_start {
1475 __u32 policy;
1476 __u64 pdh_cert_uaddr;
1477 __u32 pdh_cert_len;
1478 __u64 plat_certs_uaddr;
1479 __u32 plat_certs_len;
1480 __u64 amd_certs_uaddr;
1481 __u32 amd_certs_len;
1482 __u64 session_uaddr;
1483 __u32 session_len;
1484};
1485struct kvm_sev_send_update_data {
1486 __u64 hdr_uaddr;
1487 __u32 hdr_len;
1488 __u64 guest_uaddr;
1489 __u32 guest_len;
1490 __u64 trans_uaddr;
1491 __u32 trans_len;
1492};
1493struct kvm_sev_receive_start {
1494 __u32 handle;
1495 __u32 policy;
1496 __u64 pdh_uaddr;
1497 __u32 pdh_len;
1498 __u64 session_uaddr;
1499 __u32 session_len;
1500};
1501struct kvm_sev_receive_update_data {
1502 __u64 hdr_uaddr;
1503 __u32 hdr_len;
1504 __u64 guest_uaddr;
1505 __u32 guest_len;
1506 __u64 trans_uaddr;
1507 __u32 trans_len;
1508};
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001509#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
Ben Cheng655a7c02013-10-16 16:09:24 -07001510#define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1)
Ben Cheng655a7c02013-10-16 16:09:24 -07001511#define KVM_DEV_ASSIGN_MASK_INTX (1 << 2)
1512struct kvm_assigned_pci_dev {
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001513 __u32 assigned_dev_id;
Tao Baod7db5942015-01-28 10:07:51 -08001514 __u32 busnr;
1515 __u32 devfn;
Tao Baod7db5942015-01-28 10:07:51 -08001516 __u32 flags;
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001517 __u32 segnr;
Tao Baod7db5942015-01-28 10:07:51 -08001518 union {
1519 __u32 reserved[11];
Tao Baod7db5942015-01-28 10:07:51 -08001520 };
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001521};
Ben Cheng655a7c02013-10-16 16:09:24 -07001522#define KVM_DEV_IRQ_HOST_INTX (1 << 0)
Ben Cheng655a7c02013-10-16 16:09:24 -07001523#define KVM_DEV_IRQ_HOST_MSI (1 << 1)
1524#define KVM_DEV_IRQ_HOST_MSIX (1 << 2)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001525#define KVM_DEV_IRQ_GUEST_INTX (1 << 8)
Ben Cheng655a7c02013-10-16 16:09:24 -07001526#define KVM_DEV_IRQ_GUEST_MSI (1 << 9)
Ben Cheng655a7c02013-10-16 16:09:24 -07001527#define KVM_DEV_IRQ_GUEST_MSIX (1 << 10)
1528#define KVM_DEV_IRQ_HOST_MASK 0x00ff
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001529#define KVM_DEV_IRQ_GUEST_MASK 0xff00
Ben Cheng655a7c02013-10-16 16:09:24 -07001530struct kvm_assigned_irq {
Tao Baod7db5942015-01-28 10:07:51 -08001531 __u32 assigned_dev_id;
Tao Baod7db5942015-01-28 10:07:51 -08001532 __u32 host_irq;
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001533 __u32 guest_irq;
Tao Baod7db5942015-01-28 10:07:51 -08001534 __u32 flags;
1535 union {
Tao Baod7db5942015-01-28 10:07:51 -08001536 __u32 reserved[12];
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001537 };
Ben Cheng655a7c02013-10-16 16:09:24 -07001538};
Ben Cheng655a7c02013-10-16 16:09:24 -07001539struct kvm_assigned_msix_nr {
Tao Baod7db5942015-01-28 10:07:51 -08001540 __u32 assigned_dev_id;
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001541 __u16 entry_nr;
Tao Baod7db5942015-01-28 10:07:51 -08001542 __u16 padding;
Ben Cheng655a7c02013-10-16 16:09:24 -07001543};
1544#define KVM_MAX_MSIX_PER_DEV 256
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001545struct kvm_assigned_msix_entry {
Tao Baod7db5942015-01-28 10:07:51 -08001546 __u32 assigned_dev_id;
1547 __u32 gsi;
Tao Baod7db5942015-01-28 10:07:51 -08001548 __u16 entry;
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001549 __u16 padding[3];
Ben Cheng655a7c02013-10-16 16:09:24 -07001550};
Christopher Ferris49f525c2016-12-12 14:55:36 -08001551#define KVM_X2APIC_API_USE_32BIT_IDS (1ULL << 0)
1552#define KVM_X2APIC_API_DISABLE_BROADCAST_QUIRK (1ULL << 1)
Christopher Ferris525ce912017-07-26 13:12:53 -07001553#define KVM_ARM_DEV_EL1_VTIMER (1 << 0)
1554#define KVM_ARM_DEV_EL1_PTIMER (1 << 1)
1555#define KVM_ARM_DEV_PMU (1 << 2)
Christopher Ferris76a1d452018-06-27 14:12:29 -07001556struct kvm_hyperv_eventfd {
1557 __u32 conn_id;
1558 __s32 fd;
1559 __u32 flags;
1560 __u32 padding[3];
1561};
1562#define KVM_HYPERV_CONN_ID_MASK 0x00ffffff
1563#define KVM_HYPERV_EVENTFD_DEASSIGN (1 << 0)
Christopher Ferrisaf09c702020-06-01 20:29:29 -07001564#define KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE (1 << 0)
1565#define KVM_DIRTY_LOG_INITIALLY_SET (1 << 1)
Christopher Ferris05667cd2021-02-16 16:01:34 -08001566#ifndef KVM_DIRTY_LOG_PAGE_OFFSET
1567#define KVM_DIRTY_LOG_PAGE_OFFSET 0
1568#endif
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +00001569#define KVM_DIRTY_GFN_F_DIRTY _BITUL(0)
1570#define KVM_DIRTY_GFN_F_RESET _BITUL(1)
Christopher Ferris05667cd2021-02-16 16:01:34 -08001571#define KVM_DIRTY_GFN_F_MASK 0x3
1572struct kvm_dirty_gfn {
1573 __u32 flags;
1574 __u32 slot;
1575 __u64 offset;
1576};
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001577#define KVM_BUS_LOCK_DETECTION_OFF (1 << 0)
1578#define KVM_BUS_LOCK_DETECTION_EXIT (1 << 1)
Christopher Ferris10a76e62022-06-08 13:31:52 -07001579#define KVM_PMU_CAP_DISABLE (1 << 0)
Christopher Ferris3a39c0b2021-09-02 00:03:38 +00001580struct kvm_stats_header {
1581 __u32 flags;
1582 __u32 name_size;
1583 __u32 num_desc;
1584 __u32 id_offset;
1585 __u32 desc_offset;
1586 __u32 data_offset;
1587};
1588#define KVM_STATS_TYPE_SHIFT 0
1589#define KVM_STATS_TYPE_MASK (0xF << KVM_STATS_TYPE_SHIFT)
1590#define KVM_STATS_TYPE_CUMULATIVE (0x0 << KVM_STATS_TYPE_SHIFT)
1591#define KVM_STATS_TYPE_INSTANT (0x1 << KVM_STATS_TYPE_SHIFT)
1592#define KVM_STATS_TYPE_PEAK (0x2 << KVM_STATS_TYPE_SHIFT)
Christopher Ferris2abfa9e2021-11-01 16:26:06 -07001593#define KVM_STATS_TYPE_LINEAR_HIST (0x3 << KVM_STATS_TYPE_SHIFT)
1594#define KVM_STATS_TYPE_LOG_HIST (0x4 << KVM_STATS_TYPE_SHIFT)
1595#define KVM_STATS_TYPE_MAX KVM_STATS_TYPE_LOG_HIST
Christopher Ferris3a39c0b2021-09-02 00:03:38 +00001596#define KVM_STATS_UNIT_SHIFT 4
1597#define KVM_STATS_UNIT_MASK (0xF << KVM_STATS_UNIT_SHIFT)
1598#define KVM_STATS_UNIT_NONE (0x0 << KVM_STATS_UNIT_SHIFT)
1599#define KVM_STATS_UNIT_BYTES (0x1 << KVM_STATS_UNIT_SHIFT)
1600#define KVM_STATS_UNIT_SECONDS (0x2 << KVM_STATS_UNIT_SHIFT)
1601#define KVM_STATS_UNIT_CYCLES (0x3 << KVM_STATS_UNIT_SHIFT)
Christopher Ferris80ae69d2022-08-02 16:32:21 -07001602#define KVM_STATS_UNIT_BOOLEAN (0x4 << KVM_STATS_UNIT_SHIFT)
1603#define KVM_STATS_UNIT_MAX KVM_STATS_UNIT_BOOLEAN
Christopher Ferris3a39c0b2021-09-02 00:03:38 +00001604#define KVM_STATS_BASE_SHIFT 8
1605#define KVM_STATS_BASE_MASK (0xF << KVM_STATS_BASE_SHIFT)
1606#define KVM_STATS_BASE_POW10 (0x0 << KVM_STATS_BASE_SHIFT)
1607#define KVM_STATS_BASE_POW2 (0x1 << KVM_STATS_BASE_SHIFT)
1608#define KVM_STATS_BASE_MAX KVM_STATS_BASE_POW2
1609struct kvm_stats_desc {
1610 __u32 flags;
1611 __s16 exponent;
1612 __u16 size;
1613 __u32 offset;
Christopher Ferris2abfa9e2021-11-01 16:26:06 -07001614 __u32 bucket_size;
Christopher Ferris3a39c0b2021-09-02 00:03:38 +00001615 char name[];
1616};
1617#define KVM_GET_STATS_FD _IO(KVMIO, 0xce)
Christopher Ferris1ed55342022-03-22 16:06:25 -07001618#define KVM_GET_XSAVE2 _IOR(KVMIO, 0xcf, struct kvm_xsave)
Christopher Ferris7447a1c2022-10-04 18:24:44 -07001619#define KVM_S390_PV_CPU_COMMAND _IOWR(KVMIO, 0xd0, struct kvm_pv_cmd)
1620#define KVM_X86_NOTIFY_VMEXIT_ENABLED (1ULL << 0)
1621#define KVM_X86_NOTIFY_VMEXIT_USER (1ULL << 1)
1622#define KVM_S390_ZPCI_OP _IOW(KVMIO, 0xd1, struct kvm_s390_zpci_op)
1623struct kvm_s390_zpci_op {
1624 __u32 fh;
1625 __u8 op;
1626 __u8 pad[3];
1627 union {
1628 struct {
1629 __u64 ibv;
1630 __u64 sb;
1631 __u32 flags;
1632 __u32 noi;
1633 __u8 isc;
1634 __u8 sbo;
1635 __u16 pad;
1636 } reg_aen;
1637 __u64 reserved[8];
1638 } u;
1639};
1640#define KVM_S390_ZPCIOP_REG_AEN 0
1641#define KVM_S390_ZPCIOP_DEREG_AEN 1
1642#define KVM_S390_ZPCIOP_REGAEN_HOST (1 << 0)
Christopher Ferrisb830ddf2024-03-28 11:48:08 -07001643#define KVM_SET_MEMORY_ATTRIBUTES _IOW(KVMIO, 0xd2, struct kvm_memory_attributes)
1644struct kvm_memory_attributes {
1645 __u64 address;
1646 __u64 size;
1647 __u64 attributes;
1648 __u64 flags;
1649};
1650#define KVM_MEMORY_ATTRIBUTE_PRIVATE (1ULL << 3)
1651#define KVM_CREATE_GUEST_MEMFD _IOWR(KVMIO, 0xd4, struct kvm_create_guest_memfd)
1652struct kvm_create_guest_memfd {
1653 __u64 size;
1654 __u64 flags;
1655 __u64 reserved[6];
1656};
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001657#endif