blob: 1153458b05d2452a4b04ced476379fff6dd77707 [file] [log] [blame]
Ben Cheng655a7c02013-10-16 16:09:24 -07001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef __LINUX_KVM_H
20#define __LINUX_KVM_H
21#include <linux/types.h>
22#include <linux/compiler.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070023#include <linux/ioctl.h>
24#include <asm/kvm.h>
25#define KVM_API_VERSION 12
26#define KVM_TRC_SHIFT 16
Ben Cheng655a7c02013-10-16 16:09:24 -070027#define KVM_TRC_ENTRYEXIT (1 << KVM_TRC_SHIFT)
28#define KVM_TRC_HANDLER (1 << (KVM_TRC_SHIFT + 1))
29#define KVM_TRC_VMENTRY (KVM_TRC_ENTRYEXIT + 0x01)
30#define KVM_TRC_VMEXIT (KVM_TRC_ENTRYEXIT + 0x02)
Ben Cheng655a7c02013-10-16 16:09:24 -070031#define KVM_TRC_PAGE_FAULT (KVM_TRC_HANDLER + 0x01)
32#define KVM_TRC_HEAD_SIZE 12
33#define KVM_TRC_CYCLE_SIZE 8
34#define KVM_TRC_EXTRA_MAX 7
Ben Cheng655a7c02013-10-16 16:09:24 -070035#define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02)
36#define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03)
37#define KVM_TRC_PEND_INTR (KVM_TRC_HANDLER + 0x04)
38#define KVM_TRC_IO_READ (KVM_TRC_HANDLER + 0x05)
Ben Cheng655a7c02013-10-16 16:09:24 -070039#define KVM_TRC_IO_WRITE (KVM_TRC_HANDLER + 0x06)
40#define KVM_TRC_CR_READ (KVM_TRC_HANDLER + 0x07)
41#define KVM_TRC_CR_WRITE (KVM_TRC_HANDLER + 0x08)
42#define KVM_TRC_DR_READ (KVM_TRC_HANDLER + 0x09)
Ben Cheng655a7c02013-10-16 16:09:24 -070043#define KVM_TRC_DR_WRITE (KVM_TRC_HANDLER + 0x0A)
44#define KVM_TRC_MSR_READ (KVM_TRC_HANDLER + 0x0B)
45#define KVM_TRC_MSR_WRITE (KVM_TRC_HANDLER + 0x0C)
46#define KVM_TRC_CPUID (KVM_TRC_HANDLER + 0x0D)
Ben Cheng655a7c02013-10-16 16:09:24 -070047#define KVM_TRC_INTR (KVM_TRC_HANDLER + 0x0E)
48#define KVM_TRC_NMI (KVM_TRC_HANDLER + 0x0F)
49#define KVM_TRC_VMMCALL (KVM_TRC_HANDLER + 0x10)
50#define KVM_TRC_HLT (KVM_TRC_HANDLER + 0x11)
Ben Cheng655a7c02013-10-16 16:09:24 -070051#define KVM_TRC_CLTS (KVM_TRC_HANDLER + 0x12)
52#define KVM_TRC_LMSW (KVM_TRC_HANDLER + 0x13)
53#define KVM_TRC_APIC_ACCESS (KVM_TRC_HANDLER + 0x14)
54#define KVM_TRC_TDP_FAULT (KVM_TRC_HANDLER + 0x15)
Ben Cheng655a7c02013-10-16 16:09:24 -070055#define KVM_TRC_GTLB_WRITE (KVM_TRC_HANDLER + 0x16)
56#define KVM_TRC_STLB_WRITE (KVM_TRC_HANDLER + 0x17)
57#define KVM_TRC_STLB_INVAL (KVM_TRC_HANDLER + 0x18)
58#define KVM_TRC_PPC_INSTR (KVM_TRC_HANDLER + 0x19)
Ben Cheng655a7c02013-10-16 16:09:24 -070059struct kvm_user_trace_setup {
Tao Baod7db5942015-01-28 10:07:51 -080060 __u32 buf_size;
61 __u32 buf_nr;
Ben Cheng655a7c02013-10-16 16:09:24 -070062};
Tao Baod7db5942015-01-28 10:07:51 -080063#define __KVM_DEPRECATED_MAIN_W_0x06 _IOW(KVMIO, 0x06, struct kvm_user_trace_setup)
Ben Cheng655a7c02013-10-16 16:09:24 -070064#define __KVM_DEPRECATED_MAIN_0x07 _IO(KVMIO, 0x07)
65#define __KVM_DEPRECATED_MAIN_0x08 _IO(KVMIO, 0x08)
66#define __KVM_DEPRECATED_VM_R_0x70 _IOR(KVMIO, 0x70, struct kvm_assigned_irq)
Ben Cheng655a7c02013-10-16 16:09:24 -070067struct kvm_breakpoint {
Tao Baod7db5942015-01-28 10:07:51 -080068 __u32 enabled;
69 __u32 padding;
70 __u64 address;
Ben Cheng655a7c02013-10-16 16:09:24 -070071};
72struct kvm_debug_guest {
Tao Baod7db5942015-01-28 10:07:51 -080073 __u32 enabled;
74 __u32 pad;
Tao Baod7db5942015-01-28 10:07:51 -080075 struct kvm_breakpoint breakpoints[4];
76 __u32 singlestep;
Ben Cheng655a7c02013-10-16 16:09:24 -070077};
78#define __KVM_DEPRECATED_VCPU_W_0x87 _IOW(KVMIO, 0x87, struct kvm_debug_guest)
Ben Cheng655a7c02013-10-16 16:09:24 -070079struct kvm_memory_region {
Tao Baod7db5942015-01-28 10:07:51 -080080 __u32 slot;
81 __u32 flags;
82 __u64 guest_phys_addr;
Tao Baod7db5942015-01-28 10:07:51 -080083 __u64 memory_size;
Ben Cheng655a7c02013-10-16 16:09:24 -070084};
85struct kvm_userspace_memory_region {
Tao Baod7db5942015-01-28 10:07:51 -080086 __u32 slot;
Tao Baod7db5942015-01-28 10:07:51 -080087 __u32 flags;
88 __u64 guest_phys_addr;
89 __u64 memory_size;
90 __u64 userspace_addr;
Ben Cheng655a7c02013-10-16 16:09:24 -070091};
92#define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0)
93#define KVM_MEM_READONLY (1UL << 1)
94struct kvm_irq_level {
Tao Baod7db5942015-01-28 10:07:51 -080095 union {
96 __u32 irq;
97 __s32 status;
98 };
Tao Baod7db5942015-01-28 10:07:51 -080099 __u32 level;
Ben Cheng655a7c02013-10-16 16:09:24 -0700100};
101struct kvm_irqchip {
Tao Baod7db5942015-01-28 10:07:51 -0800102 __u32 chip_id;
Tao Baod7db5942015-01-28 10:07:51 -0800103 __u32 pad;
104 union {
105 char dummy[512];
Ben Cheng655a7c02013-10-16 16:09:24 -0700106#ifdef __KVM_HAVE_PIT
Tao Baod7db5942015-01-28 10:07:51 -0800107 struct kvm_pic_state pic;
Ben Cheng655a7c02013-10-16 16:09:24 -0700108#endif
109#ifdef __KVM_HAVE_IOAPIC
Tao Baod7db5942015-01-28 10:07:51 -0800110 struct kvm_ioapic_state ioapic;
Ben Cheng655a7c02013-10-16 16:09:24 -0700111#endif
Tao Baod7db5942015-01-28 10:07:51 -0800112 } chip;
Ben Cheng655a7c02013-10-16 16:09:24 -0700113};
114struct kvm_pit_config {
Tao Baod7db5942015-01-28 10:07:51 -0800115 __u32 flags;
116 __u32 pad[15];
Ben Cheng655a7c02013-10-16 16:09:24 -0700117};
118#define KVM_PIT_SPEAKER_DUMMY 1
Christopher Ferris05d08e92016-02-04 13:16:38 -0800119struct kvm_s390_skeys {
120 __u64 start_gfn;
121 __u64 count;
122 __u64 skeydata_addr;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800123 __u32 flags;
124 __u32 reserved[9];
125};
Christopher Ferris1308ad32017-11-14 17:32:13 -0800126#define KVM_S390_CMMA_PEEK (1 << 0)
127struct kvm_s390_cmma_log {
128 __u64 start_gfn;
129 __u32 count;
130 __u32 flags;
131 union {
132 __u64 remaining;
133 __u64 mask;
134 };
135 __u64 values;
136};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700137struct kvm_hyperv_exit {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700138#define KVM_EXIT_HYPERV_SYNIC 1
139#define KVM_EXIT_HYPERV_HCALL 2
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700140#define KVM_EXIT_HYPERV_SYNDBG 3
Christopher Ferris106b3a82016-08-24 12:15:38 -0700141 __u32 type;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700142 __u32 pad1;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700143 union {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700144 struct {
145 __u32 msr;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700146 __u32 pad2;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700147 __u64 control;
148 __u64 evt_page;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700149 __u64 msg_page;
150 } synic;
151 struct {
152 __u64 input;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700153 __u64 result;
154 __u64 params[2];
155 } hcall;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700156 struct {
157 __u32 msr;
158 __u32 pad2;
159 __u64 control;
160 __u64 status;
161 __u64 send_page;
162 __u64 recv_page;
163 __u64 pending_page;
164 } syndbg;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700165 } u;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700166};
167#define KVM_S390_GET_SKEYS_NONE 1
Christopher Ferris05d08e92016-02-04 13:16:38 -0800168#define KVM_S390_SKEYS_MAX 1048576
Ben Cheng655a7c02013-10-16 16:09:24 -0700169#define KVM_EXIT_UNKNOWN 0
170#define KVM_EXIT_EXCEPTION 1
171#define KVM_EXIT_IO 2
Christopher Ferris05d08e92016-02-04 13:16:38 -0800172#define KVM_EXIT_HYPERCALL 3
Ben Cheng655a7c02013-10-16 16:09:24 -0700173#define KVM_EXIT_DEBUG 4
174#define KVM_EXIT_HLT 5
175#define KVM_EXIT_MMIO 6
Christopher Ferris05d08e92016-02-04 13:16:38 -0800176#define KVM_EXIT_IRQ_WINDOW_OPEN 7
Ben Cheng655a7c02013-10-16 16:09:24 -0700177#define KVM_EXIT_SHUTDOWN 8
178#define KVM_EXIT_FAIL_ENTRY 9
179#define KVM_EXIT_INTR 10
Christopher Ferris05d08e92016-02-04 13:16:38 -0800180#define KVM_EXIT_SET_TPR 11
Ben Cheng655a7c02013-10-16 16:09:24 -0700181#define KVM_EXIT_TPR_ACCESS 12
182#define KVM_EXIT_S390_SIEIC 13
183#define KVM_EXIT_S390_RESET 14
Christopher Ferris05d08e92016-02-04 13:16:38 -0800184#define KVM_EXIT_DCR 15
Ben Cheng655a7c02013-10-16 16:09:24 -0700185#define KVM_EXIT_NMI 16
186#define KVM_EXIT_INTERNAL_ERROR 17
187#define KVM_EXIT_OSI 18
Christopher Ferris05d08e92016-02-04 13:16:38 -0800188#define KVM_EXIT_PAPR_HCALL 19
Ben Cheng655a7c02013-10-16 16:09:24 -0700189#define KVM_EXIT_S390_UCONTROL 20
190#define KVM_EXIT_WATCHDOG 21
191#define KVM_EXIT_S390_TSCH 22
Christopher Ferris05d08e92016-02-04 13:16:38 -0800192#define KVM_EXIT_EPR 23
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700193#define KVM_EXIT_SYSTEM_EVENT 24
Christopher Ferris05d08e92016-02-04 13:16:38 -0800194#define KVM_EXIT_S390_STSI 25
195#define KVM_EXIT_IOAPIC_EOI 26
Christopher Ferris106b3a82016-08-24 12:15:38 -0700196#define KVM_EXIT_HYPERV 27
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800197#define KVM_EXIT_ARM_NISV 28
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800198#define KVM_EXIT_X86_RDMSR 29
199#define KVM_EXIT_X86_WRMSR 30
Christopher Ferris05667cd2021-02-16 16:01:34 -0800200#define KVM_EXIT_DIRTY_RING_FULL 31
201#define KVM_EXIT_AP_RESET_HOLD 32
Ben Cheng655a7c02013-10-16 16:09:24 -0700202#define KVM_INTERNAL_ERROR_EMULATION 1
203#define KVM_INTERNAL_ERROR_SIMUL_EX 2
204#define KVM_INTERNAL_ERROR_DELIVERY_EV 3
Christopher Ferris9584fa42019-12-09 15:36:13 -0800205#define KVM_INTERNAL_ERROR_UNEXPECTED_EXIT_REASON 4
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700206struct kvm_run {
Tao Baod7db5942015-01-28 10:07:51 -0800207 __u8 request_interrupt_window;
Christopher Ferris525ce912017-07-26 13:12:53 -0700208 __u8 immediate_exit;
209 __u8 padding1[6];
Tao Baod7db5942015-01-28 10:07:51 -0800210 __u32 exit_reason;
Tao Baod7db5942015-01-28 10:07:51 -0800211 __u8 ready_for_interrupt_injection;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800212 __u8 if_flag;
213 __u16 flags;
214 __u64 cr8;
Tao Baod7db5942015-01-28 10:07:51 -0800215 __u64 apic_base;
Ben Cheng655a7c02013-10-16 16:09:24 -0700216#ifdef __KVM_S390
Tao Baod7db5942015-01-28 10:07:51 -0800217 __u64 psw_mask;
218 __u64 psw_addr;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700219#endif
Tao Baod7db5942015-01-28 10:07:51 -0800220 union {
221 struct {
222 __u64 hardware_exit_reason;
Tao Baod7db5942015-01-28 10:07:51 -0800223 } hw;
224 struct {
225 __u64 hardware_entry_failure_reason;
Christopher Ferris25c18d42020-10-14 17:42:58 -0700226 __u32 cpu;
Tao Baod7db5942015-01-28 10:07:51 -0800227 } fail_entry;
Tao Baod7db5942015-01-28 10:07:51 -0800228 struct {
229 __u32 exception;
230 __u32 error_code;
231 } ex;
Tao Baod7db5942015-01-28 10:07:51 -0800232 struct {
Ben Cheng655a7c02013-10-16 16:09:24 -0700233#define KVM_EXIT_IO_IN 0
234#define KVM_EXIT_IO_OUT 1
Tao Baod7db5942015-01-28 10:07:51 -0800235 __u8 direction;
Tao Baod7db5942015-01-28 10:07:51 -0800236 __u8 size;
237 __u16 port;
238 __u32 count;
239 __u64 data_offset;
Tao Baod7db5942015-01-28 10:07:51 -0800240 } io;
241 struct {
242 struct kvm_debug_exit_arch arch;
243 } debug;
Tao Baod7db5942015-01-28 10:07:51 -0800244 struct {
245 __u64 phys_addr;
246 __u8 data[8];
247 __u32 len;
Tao Baod7db5942015-01-28 10:07:51 -0800248 __u8 is_write;
249 } mmio;
250 struct {
251 __u64 nr;
Tao Baod7db5942015-01-28 10:07:51 -0800252 __u64 args[6];
253 __u64 ret;
254 __u32 longmode;
255 __u32 pad;
Tao Baod7db5942015-01-28 10:07:51 -0800256 } hypercall;
257 struct {
258 __u64 rip;
259 __u32 is_write;
Tao Baod7db5942015-01-28 10:07:51 -0800260 __u32 pad;
261 } tpr_access;
262 struct {
263 __u8 icptcode;
Tao Baod7db5942015-01-28 10:07:51 -0800264 __u16 ipa;
265 __u32 ipb;
266 } s390_sieic;
Ben Cheng655a7c02013-10-16 16:09:24 -0700267#define KVM_S390_RESET_POR 1
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700268#define KVM_S390_RESET_CLEAR 2
Ben Cheng655a7c02013-10-16 16:09:24 -0700269#define KVM_S390_RESET_SUBSYSTEM 4
270#define KVM_S390_RESET_CPU_INIT 8
271#define KVM_S390_RESET_IPL 16
Tao Baod7db5942015-01-28 10:07:51 -0800272 __u64 s390_reset_flags;
273 struct {
274 __u64 trans_exc_code;
275 __u32 pgm_code;
Tao Baod7db5942015-01-28 10:07:51 -0800276 } s390_ucontrol;
277 struct {
278 __u32 dcrn;
279 __u32 data;
Tao Baod7db5942015-01-28 10:07:51 -0800280 __u8 is_write;
281 } dcr;
282 struct {
283 __u32 suberror;
Tao Baod7db5942015-01-28 10:07:51 -0800284 __u32 ndata;
285 __u64 data[16];
286 } internal;
287 struct {
Tao Baod7db5942015-01-28 10:07:51 -0800288 __u64 gprs[32];
289 } osi;
290 struct {
291 __u64 nr;
Tao Baod7db5942015-01-28 10:07:51 -0800292 __u64 ret;
293 __u64 args[9];
294 } papr_hcall;
295 struct {
Tao Baod7db5942015-01-28 10:07:51 -0800296 __u16 subchannel_id;
297 __u16 subchannel_nr;
298 __u32 io_int_parm;
299 __u32 io_int_word;
Tao Baod7db5942015-01-28 10:07:51 -0800300 __u32 ipb;
301 __u8 dequeued;
302 } s390_tsch;
303 struct {
Tao Baod7db5942015-01-28 10:07:51 -0800304 __u32 epr;
305 } epr;
306 struct {
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700307#define KVM_SYSTEM_EVENT_SHUTDOWN 1
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700308#define KVM_SYSTEM_EVENT_RESET 2
Christopher Ferris05d08e92016-02-04 13:16:38 -0800309#define KVM_SYSTEM_EVENT_CRASH 3
Tao Baod7db5942015-01-28 10:07:51 -0800310 __u32 type;
311 __u64 flags;
312 } system_event;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800313 struct {
314 __u64 addr;
315 __u8 ar;
316 __u8 reserved;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800317 __u8 fc;
318 __u8 sel1;
319 __u16 sel2;
320 } s390_stsi;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800321 struct {
322 __u8 vector;
323 } eoi;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700324 struct kvm_hyperv_exit hyperv;
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800325 struct {
326 __u64 esr_iss;
327 __u64 fault_ipa;
328 } arm_nisv;
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800329 struct {
330 __u8 error;
331 __u8 pad[7];
332#define KVM_MSR_EXIT_REASON_INVAL (1 << 0)
333#define KVM_MSR_EXIT_REASON_UNKNOWN (1 << 1)
334#define KVM_MSR_EXIT_REASON_FILTER (1 << 2)
335 __u32 reason;
336 __u32 index;
337 __u64 data;
338 } msr;
Tao Baod7db5942015-01-28 10:07:51 -0800339 char padding[256];
340 };
Christopher Ferris76a1d452018-06-27 14:12:29 -0700341#define SYNC_REGS_SIZE_BYTES 2048
Tao Baod7db5942015-01-28 10:07:51 -0800342 __u64 kvm_valid_regs;
343 __u64 kvm_dirty_regs;
Tao Baod7db5942015-01-28 10:07:51 -0800344 union {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800345 struct kvm_sync_regs regs;
Christopher Ferris76a1d452018-06-27 14:12:29 -0700346 char padding[SYNC_REGS_SIZE_BYTES];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800347 } s;
Ben Cheng655a7c02013-10-16 16:09:24 -0700348};
349struct kvm_coalesced_mmio_zone {
Tao Baod7db5942015-01-28 10:07:51 -0800350 __u64 addr;
351 __u32 size;
Christopher Ferris86a48372019-01-10 14:14:59 -0800352 union {
353 __u32 pad;
354 __u32 pio;
355 };
Ben Cheng655a7c02013-10-16 16:09:24 -0700356};
357struct kvm_coalesced_mmio {
Tao Baod7db5942015-01-28 10:07:51 -0800358 __u64 phys_addr;
Tao Baod7db5942015-01-28 10:07:51 -0800359 __u32 len;
Christopher Ferris86a48372019-01-10 14:14:59 -0800360 union {
361 __u32 pad;
362 __u32 pio;
363 };
Tao Baod7db5942015-01-28 10:07:51 -0800364 __u8 data[8];
Ben Cheng655a7c02013-10-16 16:09:24 -0700365};
366struct kvm_coalesced_mmio_ring {
Tao Baod7db5942015-01-28 10:07:51 -0800367 __u32 first, last;
368 struct kvm_coalesced_mmio coalesced_mmio[0];
Ben Cheng655a7c02013-10-16 16:09:24 -0700369};
Tao Baod7db5942015-01-28 10:07:51 -0800370#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 -0700371struct kvm_translation {
Tao Baod7db5942015-01-28 10:07:51 -0800372 __u64 linear_address;
373 __u64 physical_address;
Tao Baod7db5942015-01-28 10:07:51 -0800374 __u8 valid;
375 __u8 writeable;
376 __u8 usermode;
377 __u8 pad[5];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800378};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800379struct kvm_s390_mem_op {
380 __u64 gaddr;
381 __u64 flags;
382 __u32 size;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800383 __u32 op;
384 __u64 buf;
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700385 union {
386 __u8 ar;
387 __u32 sida_offset;
388 __u8 reserved[32];
389 };
Ben Cheng655a7c02013-10-16 16:09:24 -0700390};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800391#define KVM_S390_MEMOP_LOGICAL_READ 0
392#define KVM_S390_MEMOP_LOGICAL_WRITE 1
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700393#define KVM_S390_MEMOP_SIDA_READ 2
394#define KVM_S390_MEMOP_SIDA_WRITE 3
Christopher Ferris05d08e92016-02-04 13:16:38 -0800395#define KVM_S390_MEMOP_F_CHECK_ONLY (1ULL << 0)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800396#define KVM_S390_MEMOP_F_INJECT_EXCEPTION (1ULL << 1)
Ben Cheng655a7c02013-10-16 16:09:24 -0700397struct kvm_interrupt {
Tao Baod7db5942015-01-28 10:07:51 -0800398 __u32 irq;
Ben Cheng655a7c02013-10-16 16:09:24 -0700399};
400struct kvm_dirty_log {
Tao Baod7db5942015-01-28 10:07:51 -0800401 __u32 slot;
402 __u32 padding1;
403 union {
Tao Baod7db5942015-01-28 10:07:51 -0800404 void __user * dirty_bitmap;
405 __u64 padding2;
406 };
Ben Cheng655a7c02013-10-16 16:09:24 -0700407};
Christopher Ferrisd842e432019-03-07 10:21:59 -0800408struct kvm_clear_dirty_log {
409 __u32 slot;
410 __u32 num_pages;
411 __u64 first_page;
412 union {
413 void __user * dirty_bitmap;
414 __u64 padding2;
415 };
416};
Ben Cheng655a7c02013-10-16 16:09:24 -0700417struct kvm_signal_mask {
Tao Baod7db5942015-01-28 10:07:51 -0800418 __u32 len;
419 __u8 sigset[0];
Ben Cheng655a7c02013-10-16 16:09:24 -0700420};
421struct kvm_tpr_access_ctl {
Tao Baod7db5942015-01-28 10:07:51 -0800422 __u32 enabled;
423 __u32 flags;
424 __u32 reserved[8];
Ben Cheng655a7c02013-10-16 16:09:24 -0700425};
426struct kvm_vapic_addr {
Tao Baod7db5942015-01-28 10:07:51 -0800427 __u64 vapic_addr;
Ben Cheng655a7c02013-10-16 16:09:24 -0700428};
429#define KVM_MP_STATE_RUNNABLE 0
430#define KVM_MP_STATE_UNINITIALIZED 1
431#define KVM_MP_STATE_INIT_RECEIVED 2
Ben Cheng655a7c02013-10-16 16:09:24 -0700432#define KVM_MP_STATE_HALTED 3
433#define KVM_MP_STATE_SIPI_RECEIVED 4
Christopher Ferris82d75042015-01-26 10:57:07 -0800434#define KVM_MP_STATE_STOPPED 5
435#define KVM_MP_STATE_CHECK_STOP 6
436#define KVM_MP_STATE_OPERATING 7
Christopher Ferris82d75042015-01-26 10:57:07 -0800437#define KVM_MP_STATE_LOAD 8
Christopher Ferris05667cd2021-02-16 16:01:34 -0800438#define KVM_MP_STATE_AP_RESET_HOLD 9
Ben Cheng655a7c02013-10-16 16:09:24 -0700439struct kvm_mp_state {
Tao Baod7db5942015-01-28 10:07:51 -0800440 __u32 mp_state;
Ben Cheng655a7c02013-10-16 16:09:24 -0700441};
442struct kvm_s390_psw {
Tao Baod7db5942015-01-28 10:07:51 -0800443 __u64 mask;
444 __u64 addr;
Ben Cheng655a7c02013-10-16 16:09:24 -0700445};
446#define KVM_S390_SIGP_STOP 0xfffe0000u
447#define KVM_S390_PROGRAM_INT 0xfffe0001u
448#define KVM_S390_SIGP_SET_PREFIX 0xfffe0002u
Ben Cheng655a7c02013-10-16 16:09:24 -0700449#define KVM_S390_RESTART 0xfffe0003u
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700450#define KVM_S390_INT_PFAULT_INIT 0xfffe0004u
451#define KVM_S390_INT_PFAULT_DONE 0xfffe0005u
Ben Cheng655a7c02013-10-16 16:09:24 -0700452#define KVM_S390_MCHK 0xfffe1000u
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700453#define KVM_S390_INT_CLOCK_COMP 0xffff1004u
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700454#define KVM_S390_INT_CPU_TIMER 0xffff1005u
Ben Cheng655a7c02013-10-16 16:09:24 -0700455#define KVM_S390_INT_VIRTIO 0xffff2603u
456#define KVM_S390_INT_SERVICE 0xffff2401u
Ben Cheng655a7c02013-10-16 16:09:24 -0700457#define KVM_S390_INT_EMERGENCY 0xffff1201u
458#define KVM_S390_INT_EXTERNAL_CALL 0xffff1202u
Tao Baod7db5942015-01-28 10:07:51 -0800459#define KVM_S390_INT_IO(ai,cssid,ssid,schid) (((schid)) | ((ssid) << 16) | ((cssid) << 18) | ((ai) << 26))
Ben Cheng655a7c02013-10-16 16:09:24 -0700460#define KVM_S390_INT_IO_MIN 0x00000000u
Ben Cheng655a7c02013-10-16 16:09:24 -0700461#define KVM_S390_INT_IO_MAX 0xfffdffffu
Christopher Ferris05d08e92016-02-04 13:16:38 -0800462#define KVM_S390_INT_IO_AI_MASK 0x04000000u
Ben Cheng655a7c02013-10-16 16:09:24 -0700463struct kvm_s390_interrupt {
Tao Baod7db5942015-01-28 10:07:51 -0800464 __u32 type;
465 __u32 parm;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800466 __u64 parm64;
Ben Cheng655a7c02013-10-16 16:09:24 -0700467};
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700468struct kvm_s390_io_info {
Tao Baod7db5942015-01-28 10:07:51 -0800469 __u16 subchannel_id;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800470 __u16 subchannel_nr;
Tao Baod7db5942015-01-28 10:07:51 -0800471 __u32 io_int_parm;
472 __u32 io_int_word;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700473};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800474struct kvm_s390_ext_info {
Tao Baod7db5942015-01-28 10:07:51 -0800475 __u32 ext_params;
476 __u32 pad;
477 __u64 ext_params2;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800478};
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700479struct kvm_s390_pgm_info {
Tao Baod7db5942015-01-28 10:07:51 -0800480 __u64 trans_exc_code;
481 __u64 mon_code;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800482 __u64 per_address;
Tao Baod7db5942015-01-28 10:07:51 -0800483 __u32 data_exc_code;
484 __u16 code;
485 __u16 mon_class_nr;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800486 __u8 per_code;
Tao Baod7db5942015-01-28 10:07:51 -0800487 __u8 per_atmid;
488 __u8 exc_access_id;
489 __u8 per_access_id;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800490 __u8 op_access_id;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700491#define KVM_S390_PGM_FLAGS_ILC_VALID 0x01
492#define KVM_S390_PGM_FLAGS_ILC_0 0x02
493#define KVM_S390_PGM_FLAGS_ILC_1 0x04
Christopher Ferris106b3a82016-08-24 12:15:38 -0700494#define KVM_S390_PGM_FLAGS_ILC_MASK 0x06
495#define KVM_S390_PGM_FLAGS_NO_REWIND 0x08
496 __u8 flags;
497 __u8 pad[2];
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700498};
499struct kvm_s390_prefix_info {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800500 __u32 address;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700501};
502struct kvm_s390_extcall_info {
Tao Baod7db5942015-01-28 10:07:51 -0800503 __u16 code;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800504};
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700505struct kvm_s390_emerg_info {
Tao Baod7db5942015-01-28 10:07:51 -0800506 __u16 code;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700507};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800508#define KVM_S390_STOP_FLAG_STORE_STATUS 0x01
509struct kvm_s390_stop_info {
510 __u32 flags;
511};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800512struct kvm_s390_mchk_info {
Tao Baod7db5942015-01-28 10:07:51 -0800513 __u64 cr14;
514 __u64 mcic;
515 __u64 failing_storage_address;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800516 __u32 ext_damage_code;
Tao Baod7db5942015-01-28 10:07:51 -0800517 __u32 pad;
518 __u8 fixed_logout[16];
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700519};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800520struct kvm_s390_irq {
Tao Baod7db5942015-01-28 10:07:51 -0800521 __u64 type;
522 union {
523 struct kvm_s390_io_info io;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800524 struct kvm_s390_ext_info ext;
Tao Baod7db5942015-01-28 10:07:51 -0800525 struct kvm_s390_pgm_info pgm;
526 struct kvm_s390_emerg_info emerg;
527 struct kvm_s390_extcall_info extcall;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800528 struct kvm_s390_prefix_info prefix;
529 struct kvm_s390_stop_info stop;
Tao Baod7db5942015-01-28 10:07:51 -0800530 struct kvm_s390_mchk_info mchk;
531 char reserved[64];
532 } u;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700533};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800534struct kvm_s390_irq_state {
535 __u64 buf;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800536 __u32 flags;
537 __u32 len;
538 __u32 reserved[4];
539};
Ben Cheng655a7c02013-10-16 16:09:24 -0700540#define KVM_GUESTDBG_ENABLE 0x00000001
541#define KVM_GUESTDBG_SINGLESTEP 0x00000002
Ben Cheng655a7c02013-10-16 16:09:24 -0700542struct kvm_guest_debug {
Tao Baod7db5942015-01-28 10:07:51 -0800543 __u32 control;
Tao Baod7db5942015-01-28 10:07:51 -0800544 __u32 pad;
545 struct kvm_guest_debug_arch arch;
Ben Cheng655a7c02013-10-16 16:09:24 -0700546};
547enum {
Tao Baod7db5942015-01-28 10:07:51 -0800548 kvm_ioeventfd_flag_nr_datamatch,
549 kvm_ioeventfd_flag_nr_pio,
550 kvm_ioeventfd_flag_nr_deassign,
551 kvm_ioeventfd_flag_nr_virtio_ccw_notify,
Tao Baod7db5942015-01-28 10:07:51 -0800552 kvm_ioeventfd_flag_nr_fast_mmio,
553 kvm_ioeventfd_flag_nr_max,
Ben Cheng655a7c02013-10-16 16:09:24 -0700554};
Ben Cheng655a7c02013-10-16 16:09:24 -0700555#define KVM_IOEVENTFD_FLAG_DATAMATCH (1 << kvm_ioeventfd_flag_nr_datamatch)
556#define KVM_IOEVENTFD_FLAG_PIO (1 << kvm_ioeventfd_flag_nr_pio)
557#define KVM_IOEVENTFD_FLAG_DEASSIGN (1 << kvm_ioeventfd_flag_nr_deassign)
Tao Baod7db5942015-01-28 10:07:51 -0800558#define KVM_IOEVENTFD_FLAG_VIRTIO_CCW_NOTIFY (1 << kvm_ioeventfd_flag_nr_virtio_ccw_notify)
Ben Cheng655a7c02013-10-16 16:09:24 -0700559#define KVM_IOEVENTFD_VALID_FLAG_MASK ((1 << kvm_ioeventfd_flag_nr_max) - 1)
560struct kvm_ioeventfd {
Tao Baod7db5942015-01-28 10:07:51 -0800561 __u64 datamatch;
562 __u64 addr;
563 __u32 len;
Tao Baod7db5942015-01-28 10:07:51 -0800564 __s32 fd;
565 __u32 flags;
566 __u8 pad[36];
Ben Cheng655a7c02013-10-16 16:09:24 -0700567};
Christopher Ferris76a1d452018-06-27 14:12:29 -0700568#define KVM_X86_DISABLE_EXITS_MWAIT (1 << 0)
569#define KVM_X86_DISABLE_EXITS_HLT (1 << 1)
570#define KVM_X86_DISABLE_EXITS_PAUSE (1 << 2)
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700571#define KVM_X86_DISABLE_EXITS_CSTATE (1 << 3)
572#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 -0700573struct kvm_enable_cap {
Tao Baod7db5942015-01-28 10:07:51 -0800574 __u32 cap;
575 __u32 flags;
576 __u64 args[4];
Tao Baod7db5942015-01-28 10:07:51 -0800577 __u8 pad[64];
Ben Cheng655a7c02013-10-16 16:09:24 -0700578};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800579#define KVM_PPC_PVINFO_FLAGS_EV_IDLE (1 << 0)
Ben Cheng655a7c02013-10-16 16:09:24 -0700580struct kvm_ppc_pvinfo {
Tao Baod7db5942015-01-28 10:07:51 -0800581 __u32 flags;
Tao Baod7db5942015-01-28 10:07:51 -0800582 __u32 hcall[4];
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800583 __u8 pad[108];
Ben Cheng655a7c02013-10-16 16:09:24 -0700584};
Ben Cheng655a7c02013-10-16 16:09:24 -0700585#define KVM_PPC_PAGE_SIZES_MAX_SZ 8
586struct kvm_ppc_one_page_size {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800587 __u32 page_shift;
Tao Baod7db5942015-01-28 10:07:51 -0800588 __u32 pte_enc;
Ben Cheng655a7c02013-10-16 16:09:24 -0700589};
590struct kvm_ppc_one_seg_page_size {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800591 __u32 page_shift;
Tao Baod7db5942015-01-28 10:07:51 -0800592 __u32 slb_enc;
593 struct kvm_ppc_one_page_size enc[KVM_PPC_PAGE_SIZES_MAX_SZ];
Ben Cheng655a7c02013-10-16 16:09:24 -0700594};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800595#define KVM_PPC_PAGE_SIZES_REAL 0x00000001
Ben Cheng655a7c02013-10-16 16:09:24 -0700596#define KVM_PPC_1T_SEGMENTS 0x00000002
Christopher Ferris86a48372019-01-10 14:14:59 -0800597#define KVM_PPC_NO_HASH 0x00000004
Ben Cheng655a7c02013-10-16 16:09:24 -0700598struct kvm_ppc_smmu_info {
Tao Baod7db5942015-01-28 10:07:51 -0800599 __u64 flags;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800600 __u32 slb_size;
Christopher Ferris1308ad32017-11-14 17:32:13 -0800601 __u16 data_keys;
602 __u16 instr_keys;
Tao Baod7db5942015-01-28 10:07:51 -0800603 struct kvm_ppc_one_seg_page_size sps[KVM_PPC_PAGE_SIZES_MAX_SZ];
Ben Cheng655a7c02013-10-16 16:09:24 -0700604};
Christopher Ferris525ce912017-07-26 13:12:53 -0700605struct kvm_ppc_resize_hpt {
606 __u64 flags;
607 __u32 shift;
608 __u32 pad;
609};
Ben Cheng655a7c02013-10-16 16:09:24 -0700610#define KVMIO 0xAE
Ben Cheng655a7c02013-10-16 16:09:24 -0700611#define KVM_VM_S390_UCONTROL 1
Christopher Ferris38062f92014-07-09 15:33:25 -0700612#define KVM_VM_PPC_HV 1
613#define KVM_VM_PPC_PR 2
Christopher Ferris25c18d42020-10-14 17:42:58 -0700614#define KVM_VM_MIPS_AUTO 0
Christopher Ferris525ce912017-07-26 13:12:53 -0700615#define KVM_VM_MIPS_VZ 1
Christopher Ferris25c18d42020-10-14 17:42:58 -0700616#define KVM_VM_MIPS_TE 2
Ben Cheng655a7c02013-10-16 16:09:24 -0700617#define KVM_S390_SIE_PAGE_OFFSET 1
Christopher Ferris86a48372019-01-10 14:14:59 -0800618#define KVM_VM_TYPE_ARM_IPA_SIZE_MASK 0xffULL
619#define KVM_VM_TYPE_ARM_IPA_SIZE(x) ((x) & KVM_VM_TYPE_ARM_IPA_SIZE_MASK)
Ben Cheng655a7c02013-10-16 16:09:24 -0700620#define KVM_GET_API_VERSION _IO(KVMIO, 0x00)
621#define KVM_CREATE_VM _IO(KVMIO, 0x01)
Ben Cheng655a7c02013-10-16 16:09:24 -0700622#define KVM_GET_MSR_INDEX_LIST _IOWR(KVMIO, 0x02, struct kvm_msr_list)
623#define KVM_S390_ENABLE_SIE _IO(KVMIO, 0x06)
624#define KVM_CHECK_EXTENSION _IO(KVMIO, 0x03)
625#define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04)
Ben Cheng655a7c02013-10-16 16:09:24 -0700626#define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x05, struct kvm_cpuid2)
627#define KVM_TRACE_ENABLE __KVM_DEPRECATED_MAIN_W_0x06
628#define KVM_TRACE_PAUSE __KVM_DEPRECATED_MAIN_0x07
629#define KVM_TRACE_DISABLE __KVM_DEPRECATED_MAIN_0x08
Christopher Ferris38062f92014-07-09 15:33:25 -0700630#define KVM_GET_EMULATED_CPUID _IOWR(KVMIO, 0x09, struct kvm_cpuid2)
Christopher Ferris76a1d452018-06-27 14:12:29 -0700631#define KVM_GET_MSR_FEATURE_INDEX_LIST _IOWR(KVMIO, 0x0a, struct kvm_msr_list)
Ben Cheng655a7c02013-10-16 16:09:24 -0700632#define KVM_CAP_IRQCHIP 0
633#define KVM_CAP_HLT 1
634#define KVM_CAP_MMU_SHADOW_CACHE_CONTROL 2
635#define KVM_CAP_USER_MEMORY 3
Ben Cheng655a7c02013-10-16 16:09:24 -0700636#define KVM_CAP_SET_TSS_ADDR 4
637#define KVM_CAP_VAPIC 6
638#define KVM_CAP_EXT_CPUID 7
639#define KVM_CAP_CLOCKSOURCE 8
Ben Cheng655a7c02013-10-16 16:09:24 -0700640#define KVM_CAP_NR_VCPUS 9
641#define KVM_CAP_NR_MEMSLOTS 10
642#define KVM_CAP_PIT 11
643#define KVM_CAP_NOP_IO_DELAY 12
Ben Cheng655a7c02013-10-16 16:09:24 -0700644#define KVM_CAP_PV_MMU 13
645#define KVM_CAP_MP_STATE 14
646#define KVM_CAP_COALESCED_MMIO 15
647#define KVM_CAP_SYNC_MMU 16
Ben Cheng655a7c02013-10-16 16:09:24 -0700648#define KVM_CAP_IOMMU 18
Ben Cheng655a7c02013-10-16 16:09:24 -0700649#define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21
Ben Cheng655a7c02013-10-16 16:09:24 -0700650#define KVM_CAP_USER_NMI 22
Ben Cheng655a7c02013-10-16 16:09:24 -0700651#ifdef __KVM_HAVE_GUEST_DEBUG
652#define KVM_CAP_SET_GUEST_DEBUG 23
653#endif
Ben Cheng655a7c02013-10-16 16:09:24 -0700654#ifdef __KVM_HAVE_PIT
655#define KVM_CAP_REINJECT_CONTROL 24
656#endif
657#define KVM_CAP_IRQ_ROUTING 25
Ben Cheng655a7c02013-10-16 16:09:24 -0700658#define KVM_CAP_IRQ_INJECT_STATUS 26
Ben Cheng655a7c02013-10-16 16:09:24 -0700659#define KVM_CAP_ASSIGN_DEV_IRQ 29
660#define KVM_CAP_JOIN_MEMORY_REGIONS_WORKS 30
661#ifdef __KVM_HAVE_MCE
Ben Cheng655a7c02013-10-16 16:09:24 -0700662#define KVM_CAP_MCE 31
663#endif
664#define KVM_CAP_IRQFD 32
665#ifdef __KVM_HAVE_PIT
Ben Cheng655a7c02013-10-16 16:09:24 -0700666#define KVM_CAP_PIT2 33
667#endif
668#define KVM_CAP_SET_BOOT_CPU_ID 34
669#ifdef __KVM_HAVE_PIT_STATE2
Ben Cheng655a7c02013-10-16 16:09:24 -0700670#define KVM_CAP_PIT_STATE2 35
671#endif
672#define KVM_CAP_IOEVENTFD 36
673#define KVM_CAP_SET_IDENTITY_MAP_ADDR 37
Ben Cheng655a7c02013-10-16 16:09:24 -0700674#ifdef __KVM_HAVE_XEN_HVM
675#define KVM_CAP_XEN_HVM 38
676#endif
677#define KVM_CAP_ADJUST_CLOCK 39
Ben Cheng655a7c02013-10-16 16:09:24 -0700678#define KVM_CAP_INTERNAL_ERROR_DATA 40
679#ifdef __KVM_HAVE_VCPU_EVENTS
680#define KVM_CAP_VCPU_EVENTS 41
681#endif
Ben Cheng655a7c02013-10-16 16:09:24 -0700682#define KVM_CAP_S390_PSW 42
683#define KVM_CAP_PPC_SEGSTATE 43
684#define KVM_CAP_HYPERV 44
685#define KVM_CAP_HYPERV_VAPIC 45
Ben Cheng655a7c02013-10-16 16:09:24 -0700686#define KVM_CAP_HYPERV_SPIN 46
687#define KVM_CAP_PCI_SEGMENT 47
688#define KVM_CAP_PPC_PAIRED_SINGLES 48
689#define KVM_CAP_INTR_SHADOW 49
Ben Cheng655a7c02013-10-16 16:09:24 -0700690#ifdef __KVM_HAVE_DEBUGREGS
691#define KVM_CAP_DEBUGREGS 50
692#endif
693#define KVM_CAP_X86_ROBUST_SINGLESTEP 51
Ben Cheng655a7c02013-10-16 16:09:24 -0700694#define KVM_CAP_PPC_OSI 52
695#define KVM_CAP_PPC_UNSET_IRQ 53
696#define KVM_CAP_ENABLE_CAP 54
697#ifdef __KVM_HAVE_XSAVE
Ben Cheng655a7c02013-10-16 16:09:24 -0700698#define KVM_CAP_XSAVE 55
699#endif
700#ifdef __KVM_HAVE_XCRS
701#define KVM_CAP_XCRS 56
Ben Cheng655a7c02013-10-16 16:09:24 -0700702#endif
703#define KVM_CAP_PPC_GET_PVINFO 57
704#define KVM_CAP_PPC_IRQ_LEVEL 58
705#define KVM_CAP_ASYNC_PF 59
Ben Cheng655a7c02013-10-16 16:09:24 -0700706#define KVM_CAP_TSC_CONTROL 60
707#define KVM_CAP_GET_TSC_KHZ 61
708#define KVM_CAP_PPC_BOOKE_SREGS 62
709#define KVM_CAP_SPAPR_TCE 63
Ben Cheng655a7c02013-10-16 16:09:24 -0700710#define KVM_CAP_PPC_SMT 64
711#define KVM_CAP_PPC_RMA 65
712#define KVM_CAP_MAX_VCPUS 66
713#define KVM_CAP_PPC_HIOR 67
Ben Cheng655a7c02013-10-16 16:09:24 -0700714#define KVM_CAP_PPC_PAPR 68
715#define KVM_CAP_SW_TLB 69
716#define KVM_CAP_ONE_REG 70
717#define KVM_CAP_S390_GMAP 71
Ben Cheng655a7c02013-10-16 16:09:24 -0700718#define KVM_CAP_TSC_DEADLINE_TIMER 72
719#define KVM_CAP_S390_UCONTROL 73
720#define KVM_CAP_SYNC_REGS 74
721#define KVM_CAP_PCI_2_3 75
Ben Cheng655a7c02013-10-16 16:09:24 -0700722#define KVM_CAP_KVMCLOCK_CTRL 76
723#define KVM_CAP_SIGNAL_MSI 77
724#define KVM_CAP_PPC_GET_SMMU_INFO 78
725#define KVM_CAP_S390_COW 79
Christopher Ferris82d75042015-01-26 10:57:07 -0800726#define KVM_CAP_PPC_ALLOC_HTAB 80
Ben Cheng655a7c02013-10-16 16:09:24 -0700727#define KVM_CAP_READONLY_MEM 81
Ben Cheng655a7c02013-10-16 16:09:24 -0700728#define KVM_CAP_IRQFD_RESAMPLE 82
729#define KVM_CAP_PPC_BOOKE_WATCHDOG 83
730#define KVM_CAP_PPC_HTAB_FD 84
731#define KVM_CAP_S390_CSS_SUPPORT 85
Ben Cheng655a7c02013-10-16 16:09:24 -0700732#define KVM_CAP_PPC_EPR 86
733#define KVM_CAP_ARM_PSCI 87
734#define KVM_CAP_ARM_SET_DEVICE_ADDR 88
735#define KVM_CAP_DEVICE_CTRL 89
Ben Cheng655a7c02013-10-16 16:09:24 -0700736#define KVM_CAP_IRQ_MPIC 90
737#define KVM_CAP_PPC_RTAS 91
738#define KVM_CAP_IRQ_XICS 92
Christopher Ferris38062f92014-07-09 15:33:25 -0700739#define KVM_CAP_ARM_EL1_32BIT 93
740#define KVM_CAP_SPAPR_MULTITCE 94
Christopher Ferris38062f92014-07-09 15:33:25 -0700741#define KVM_CAP_EXT_EMUL_CPUID 95
742#define KVM_CAP_HYPERV_TIME 96
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700743#define KVM_CAP_IOAPIC_POLARITY_IGNORED 97
744#define KVM_CAP_ENABLE_CAP_VM 98
745#define KVM_CAP_S390_IRQCHIP 99
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700746#define KVM_CAP_IOEVENTFD_NO_LENGTH 100
747#define KVM_CAP_VM_ATTRIBUTES 101
748#define KVM_CAP_ARM_PSCI_0_2 102
749#define KVM_CAP_PPC_FIXUP_HCALL 103
Christopher Ferris82d75042015-01-26 10:57:07 -0800750#define KVM_CAP_PPC_ENABLE_HCALL 104
751#define KVM_CAP_CHECK_EXTENSION_VM 105
Christopher Ferris05d08e92016-02-04 13:16:38 -0800752#define KVM_CAP_S390_USER_SIGP 106
753#define KVM_CAP_S390_VECTOR_REGISTERS 107
Christopher Ferris05d08e92016-02-04 13:16:38 -0800754#define KVM_CAP_S390_MEM_OP 108
755#define KVM_CAP_S390_USER_STSI 109
756#define KVM_CAP_S390_SKEYS 110
757#define KVM_CAP_MIPS_FPU 111
Christopher Ferris05d08e92016-02-04 13:16:38 -0800758#define KVM_CAP_MIPS_MSA 112
759#define KVM_CAP_S390_INJECT_IRQ 113
760#define KVM_CAP_S390_IRQ_STATE 114
761#define KVM_CAP_PPC_HWRNG 115
Christopher Ferris05d08e92016-02-04 13:16:38 -0800762#define KVM_CAP_DISABLE_QUIRKS 116
763#define KVM_CAP_X86_SMM 117
764#define KVM_CAP_MULTI_ADDRESS_SPACE 118
765#define KVM_CAP_GUEST_DEBUG_HW_BPS 119
Christopher Ferris05d08e92016-02-04 13:16:38 -0800766#define KVM_CAP_GUEST_DEBUG_HW_WPS 120
767#define KVM_CAP_SPLIT_IRQCHIP 121
768#define KVM_CAP_IOEVENTFD_ANY_LENGTH 122
Christopher Ferris106b3a82016-08-24 12:15:38 -0700769#define KVM_CAP_HYPERV_SYNIC 123
770#define KVM_CAP_S390_RI 124
771#define KVM_CAP_SPAPR_TCE_64 125
Christopher Ferris106b3a82016-08-24 12:15:38 -0700772#define KVM_CAP_ARM_PMU_V3 126
773#define KVM_CAP_VCPU_ATTRIBUTES 127
774#define KVM_CAP_MAX_VCPU_ID 128
Christopher Ferris49f525c2016-12-12 14:55:36 -0800775#define KVM_CAP_X2APIC_API 129
Christopher Ferris49f525c2016-12-12 14:55:36 -0800776#define KVM_CAP_S390_USER_INSTR0 130
777#define KVM_CAP_MSI_DEVID 131
778#define KVM_CAP_PPC_HTM 132
Christopher Ferris525ce912017-07-26 13:12:53 -0700779#define KVM_CAP_SPAPR_RESIZE_HPT 133
780#define KVM_CAP_PPC_MMU_RADIX 134
781#define KVM_CAP_PPC_MMU_HASH_V3 135
782#define KVM_CAP_IMMEDIATE_EXIT 136
783#define KVM_CAP_MIPS_VZ 137
784#define KVM_CAP_MIPS_TE 138
785#define KVM_CAP_MIPS_64BIT 139
786#define KVM_CAP_S390_GS 140
787#define KVM_CAP_S390_AIS 141
788#define KVM_CAP_SPAPR_TCE_VFIO 142
Christopher Ferris76a1d452018-06-27 14:12:29 -0700789#define KVM_CAP_X86_DISABLE_EXITS 143
Christopher Ferris525ce912017-07-26 13:12:53 -0700790#define KVM_CAP_ARM_USER_IRQ 144
Christopher Ferris1308ad32017-11-14 17:32:13 -0800791#define KVM_CAP_S390_CMMA_MIGRATION 145
792#define KVM_CAP_PPC_FWNMI 146
793#define KVM_CAP_PPC_SMT_POSSIBLE 147
794#define KVM_CAP_HYPERV_SYNIC2 148
795#define KVM_CAP_HYPERV_VP_INDEX 149
Christopher Ferris934ec942018-01-31 15:29:16 -0800796#define KVM_CAP_S390_AIS_MIGRATION 150
797#define KVM_CAP_PPC_GET_CPU_CHAR 151
798#define KVM_CAP_S390_BPB 152
Christopher Ferris76a1d452018-06-27 14:12:29 -0700799#define KVM_CAP_GET_MSR_FEATURES 153
800#define KVM_CAP_HYPERV_EVENTFD 154
Christopher Ferris9ce28842018-10-25 12:11:39 -0700801#define KVM_CAP_HYPERV_TLBFLUSH 155
802#define KVM_CAP_S390_HPAGE_1M 156
803#define KVM_CAP_NESTED_STATE 157
804#define KVM_CAP_ARM_INJECT_SERROR_ESR 158
805#define KVM_CAP_MSR_PLATFORM_INFO 159
Christopher Ferris86a48372019-01-10 14:14:59 -0800806#define KVM_CAP_PPC_NESTED_HV 160
807#define KVM_CAP_HYPERV_SEND_IPI 161
808#define KVM_CAP_COALESCED_PIO 162
809#define KVM_CAP_HYPERV_ENLIGHTENED_VMCS 163
810#define KVM_CAP_EXCEPTION_PAYLOAD 164
811#define KVM_CAP_ARM_VM_IPA_SIZE 165
Christopher Ferrisd842e432019-03-07 10:21:59 -0800812#define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT 166
813#define KVM_CAP_HYPERV_CPUID 167
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700814#define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 168
815#define KVM_CAP_PPC_IRQ_XIVE 169
816#define KVM_CAP_ARM_SVE 170
817#define KVM_CAP_ARM_PTRAUTH_ADDRESS 171
818#define KVM_CAP_ARM_PTRAUTH_GENERIC 172
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700819#define KVM_CAP_PMU_EVENT_FILTER 173
Christopher Ferris9584fa42019-12-09 15:36:13 -0800820#define KVM_CAP_ARM_IRQ_LINE_LAYOUT_2 174
821#define KVM_CAP_HYPERV_DIRECT_TLBFLUSH 175
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800822#define KVM_CAP_PPC_GUEST_DEBUG_SSTEP 176
823#define KVM_CAP_ARM_NISV_TO_USER 177
824#define KVM_CAP_ARM_INJECT_EXT_DABT 178
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700825#define KVM_CAP_S390_VCPU_RESETS 179
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700826#define KVM_CAP_S390_PROTECTED 180
827#define KVM_CAP_PPC_SECURE_GUEST 181
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700828#define KVM_CAP_HALT_POLL 182
829#define KVM_CAP_ASYNC_PF_INT 183
Christopher Ferris25c18d42020-10-14 17:42:58 -0700830#define KVM_CAP_LAST_CPU 184
831#define KVM_CAP_SMALLER_MAXPHYADDR 185
832#define KVM_CAP_S390_DIAG318 186
833#define KVM_CAP_STEAL_TIME 187
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800834#define KVM_CAP_X86_USER_SPACE_MSR 188
835#define KVM_CAP_X86_MSR_FILTER 189
836#define KVM_CAP_ENFORCE_PV_FEATURE_CPUID 190
Christopher Ferris05667cd2021-02-16 16:01:34 -0800837#define KVM_CAP_SYS_HYPERV_CPUID 191
838#define KVM_CAP_DIRTY_LOG_RING 192
Christopher Ferris05d08e92016-02-04 13:16:38 -0800839#ifdef KVM_CAP_IRQ_ROUTING
Christopher Ferris05d08e92016-02-04 13:16:38 -0800840struct kvm_irq_routing_irqchip {
Tao Baod7db5942015-01-28 10:07:51 -0800841 __u32 irqchip;
842 __u32 pin;
Ben Cheng655a7c02013-10-16 16:09:24 -0700843};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800844struct kvm_irq_routing_msi {
Tao Baod7db5942015-01-28 10:07:51 -0800845 __u32 address_lo;
846 __u32 address_hi;
847 __u32 data;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800848 union {
849 __u32 pad;
850 __u32 devid;
851 };
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700852};
853struct kvm_irq_routing_s390_adapter {
Tao Baod7db5942015-01-28 10:07:51 -0800854 __u64 ind_addr;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800855 __u64 summary_addr;
Tao Baod7db5942015-01-28 10:07:51 -0800856 __u64 ind_offset;
857 __u32 summary_offset;
858 __u32 adapter_id;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800859};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700860struct kvm_irq_routing_hv_sint {
861 __u32 vcpu;
862 __u32 sint;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700863};
Ben Cheng655a7c02013-10-16 16:09:24 -0700864#define KVM_IRQ_ROUTING_IRQCHIP 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700865#define KVM_IRQ_ROUTING_MSI 2
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700866#define KVM_IRQ_ROUTING_S390_ADAPTER 3
Christopher Ferris106b3a82016-08-24 12:15:38 -0700867#define KVM_IRQ_ROUTING_HV_SINT 4
Christopher Ferris05d08e92016-02-04 13:16:38 -0800868struct kvm_irq_routing_entry {
Tao Baod7db5942015-01-28 10:07:51 -0800869 __u32 gsi;
870 __u32 type;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700871 __u32 flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800872 __u32 pad;
Tao Baod7db5942015-01-28 10:07:51 -0800873 union {
874 struct kvm_irq_routing_irqchip irqchip;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700875 struct kvm_irq_routing_msi msi;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800876 struct kvm_irq_routing_s390_adapter adapter;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700877 struct kvm_irq_routing_hv_sint hv_sint;
Tao Baod7db5942015-01-28 10:07:51 -0800878 __u32 pad[8];
879 } u;
Ben Cheng655a7c02013-10-16 16:09:24 -0700880};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800881struct kvm_irq_routing {
Tao Baod7db5942015-01-28 10:07:51 -0800882 __u32 nr;
883 __u32 flags;
884 struct kvm_irq_routing_entry entries[0];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800885};
Ben Cheng655a7c02013-10-16 16:09:24 -0700886#endif
887#ifdef KVM_CAP_MCE
888struct kvm_x86_mce {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800889 __u64 status;
Tao Baod7db5942015-01-28 10:07:51 -0800890 __u64 addr;
891 __u64 misc;
892 __u64 mcg_status;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800893 __u8 bank;
Tao Baod7db5942015-01-28 10:07:51 -0800894 __u8 pad1[7];
895 __u64 pad2[3];
Ben Cheng655a7c02013-10-16 16:09:24 -0700896};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800897#endif
Ben Cheng655a7c02013-10-16 16:09:24 -0700898#ifdef KVM_CAP_XEN_HVM
899struct kvm_xen_hvm_config {
Tao Baod7db5942015-01-28 10:07:51 -0800900 __u32 flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800901 __u32 msr;
Tao Baod7db5942015-01-28 10:07:51 -0800902 __u64 blob_addr_32;
903 __u64 blob_addr_64;
904 __u8 blob_size_32;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800905 __u8 blob_size_64;
Tao Baod7db5942015-01-28 10:07:51 -0800906 __u8 pad2[30];
Ben Cheng655a7c02013-10-16 16:09:24 -0700907};
908#endif
Christopher Ferris05d08e92016-02-04 13:16:38 -0800909#define KVM_IRQFD_FLAG_DEASSIGN (1 << 0)
Ben Cheng655a7c02013-10-16 16:09:24 -0700910#define KVM_IRQFD_FLAG_RESAMPLE (1 << 1)
911struct kvm_irqfd {
Tao Baod7db5942015-01-28 10:07:51 -0800912 __u32 fd;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800913 __u32 gsi;
Tao Baod7db5942015-01-28 10:07:51 -0800914 __u32 flags;
915 __u32 resamplefd;
916 __u8 pad[16];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800917};
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800918#define KVM_CLOCK_TSC_STABLE 2
Ben Cheng655a7c02013-10-16 16:09:24 -0700919struct kvm_clock_data {
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800920 __u64 clock;
Tao Baod7db5942015-01-28 10:07:51 -0800921 __u32 flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800922 __u32 pad[9];
Ben Cheng655a7c02013-10-16 16:09:24 -0700923};
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800924#define KVM_MMU_FSL_BOOKE_NOHV 0
Ben Cheng655a7c02013-10-16 16:09:24 -0700925#define KVM_MMU_FSL_BOOKE_HV 1
Christopher Ferris05d08e92016-02-04 13:16:38 -0800926struct kvm_config_tlb {
Tao Baod7db5942015-01-28 10:07:51 -0800927 __u64 params;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800928 __u64 array;
Tao Baod7db5942015-01-28 10:07:51 -0800929 __u32 mmu_type;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800930 __u32 array_len;
Ben Cheng655a7c02013-10-16 16:09:24 -0700931};
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800932struct kvm_dirty_tlb {
Tao Baod7db5942015-01-28 10:07:51 -0800933 __u64 bitmap;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800934 __u32 num_dirty;
Ben Cheng655a7c02013-10-16 16:09:24 -0700935};
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800936#define KVM_REG_ARCH_MASK 0xff00000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -0700937#define KVM_REG_GENERIC 0x0000000000000000ULL
Christopher Ferris05d08e92016-02-04 13:16:38 -0800938#define KVM_REG_PPC 0x1000000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -0700939#define KVM_REG_X86 0x2000000000000000ULL
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800940#define KVM_REG_IA64 0x3000000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -0700941#define KVM_REG_ARM 0x4000000000000000ULL
Christopher Ferris05d08e92016-02-04 13:16:38 -0800942#define KVM_REG_S390 0x5000000000000000ULL
Christopher Ferris38062f92014-07-09 15:33:25 -0700943#define KVM_REG_ARM64 0x6000000000000000ULL
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800944#define KVM_REG_MIPS 0x7000000000000000ULL
Christopher Ferris9584fa42019-12-09 15:36:13 -0800945#define KVM_REG_RISCV 0x8000000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -0700946#define KVM_REG_SIZE_SHIFT 52
Christopher Ferris05d08e92016-02-04 13:16:38 -0800947#define KVM_REG_SIZE_MASK 0x00f0000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -0700948#define KVM_REG_SIZE_U8 0x0000000000000000ULL
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800949#define KVM_REG_SIZE_U16 0x0010000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -0700950#define KVM_REG_SIZE_U32 0x0020000000000000ULL
Christopher Ferris05d08e92016-02-04 13:16:38 -0800951#define KVM_REG_SIZE_U64 0x0030000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -0700952#define KVM_REG_SIZE_U128 0x0040000000000000ULL
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800953#define KVM_REG_SIZE_U256 0x0050000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -0700954#define KVM_REG_SIZE_U512 0x0060000000000000ULL
Christopher Ferris05d08e92016-02-04 13:16:38 -0800955#define KVM_REG_SIZE_U1024 0x0070000000000000ULL
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700956#define KVM_REG_SIZE_U2048 0x0080000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -0700957struct kvm_reg_list {
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800958 __u64 n;
Tao Baod7db5942015-01-28 10:07:51 -0800959 __u64 reg[0];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800960};
Ben Cheng655a7c02013-10-16 16:09:24 -0700961struct kvm_one_reg {
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800962 __u64 id;
Tao Baod7db5942015-01-28 10:07:51 -0800963 __u64 addr;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800964};
Christopher Ferris49f525c2016-12-12 14:55:36 -0800965#define KVM_MSI_VALID_DEVID (1U << 0)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800966struct kvm_msi {
Tao Baod7db5942015-01-28 10:07:51 -0800967 __u32 address_lo;
968 __u32 address_hi;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800969 __u32 data;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800970 __u32 flags;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800971 __u32 devid;
972 __u8 pad[12];
Ben Cheng655a7c02013-10-16 16:09:24 -0700973};
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800974struct kvm_arm_device_addr {
Christopher Ferris49f525c2016-12-12 14:55:36 -0800975 __u64 id;
Tao Baod7db5942015-01-28 10:07:51 -0800976 __u64 addr;
Ben Cheng655a7c02013-10-16 16:09:24 -0700977};
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800978#define KVM_CREATE_DEVICE_TEST 1
Christopher Ferris49f525c2016-12-12 14:55:36 -0800979struct kvm_create_device {
Tao Baod7db5942015-01-28 10:07:51 -0800980 __u32 type;
981 __u32 fd;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800982 __u32 flags;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800983};
Ben Cheng655a7c02013-10-16 16:09:24 -0700984struct kvm_device_attr {
Tao Baod7db5942015-01-28 10:07:51 -0800985 __u32 flags;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800986 __u32 group;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800987 __u64 attr;
Tao Baod7db5942015-01-28 10:07:51 -0800988 __u64 addr;
Ben Cheng655a7c02013-10-16 16:09:24 -0700989};
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800990#define KVM_DEV_VFIO_GROUP 1
Christopher Ferris49f525c2016-12-12 14:55:36 -0800991#define KVM_DEV_VFIO_GROUP_ADD 1
Christopher Ferris38062f92014-07-09 15:33:25 -0700992#define KVM_DEV_VFIO_GROUP_DEL 2
Christopher Ferris525ce912017-07-26 13:12:53 -0700993#define KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE 3
Christopher Ferris82d75042015-01-26 10:57:07 -0800994enum kvm_device_type {
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800995 KVM_DEV_TYPE_FSL_MPIC_20 = 1,
Christopher Ferris49f525c2016-12-12 14:55:36 -0800996#define KVM_DEV_TYPE_FSL_MPIC_20 KVM_DEV_TYPE_FSL_MPIC_20
Tao Baod7db5942015-01-28 10:07:51 -0800997 KVM_DEV_TYPE_FSL_MPIC_42,
Christopher Ferris82d75042015-01-26 10:57:07 -0800998#define KVM_DEV_TYPE_FSL_MPIC_42 KVM_DEV_TYPE_FSL_MPIC_42
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800999 KVM_DEV_TYPE_XICS,
Christopher Ferris49f525c2016-12-12 14:55:36 -08001000#define KVM_DEV_TYPE_XICS KVM_DEV_TYPE_XICS
Tao Baod7db5942015-01-28 10:07:51 -08001001 KVM_DEV_TYPE_VFIO,
Christopher Ferris82d75042015-01-26 10:57:07 -08001002#define KVM_DEV_TYPE_VFIO KVM_DEV_TYPE_VFIO
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001003 KVM_DEV_TYPE_ARM_VGIC_V2,
Christopher Ferris49f525c2016-12-12 14:55:36 -08001004#define KVM_DEV_TYPE_ARM_VGIC_V2 KVM_DEV_TYPE_ARM_VGIC_V2
Tao Baod7db5942015-01-28 10:07:51 -08001005 KVM_DEV_TYPE_FLIC,
Christopher Ferris82d75042015-01-26 10:57:07 -08001006#define KVM_DEV_TYPE_FLIC KVM_DEV_TYPE_FLIC
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001007 KVM_DEV_TYPE_ARM_VGIC_V3,
Christopher Ferris49f525c2016-12-12 14:55:36 -08001008#define KVM_DEV_TYPE_ARM_VGIC_V3 KVM_DEV_TYPE_ARM_VGIC_V3
1009 KVM_DEV_TYPE_ARM_VGIC_ITS,
1010#define KVM_DEV_TYPE_ARM_VGIC_ITS KVM_DEV_TYPE_ARM_VGIC_ITS
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -07001011 KVM_DEV_TYPE_XIVE,
1012#define KVM_DEV_TYPE_XIVE KVM_DEV_TYPE_XIVE
Christopher Ferrisd32ca142020-02-04 16:16:51 -08001013 KVM_DEV_TYPE_ARM_PV_TIME,
1014#define KVM_DEV_TYPE_ARM_PV_TIME KVM_DEV_TYPE_ARM_PV_TIME
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001015 KVM_DEV_TYPE_MAX,
Christopher Ferris82d75042015-01-26 10:57:07 -08001016};
Christopher Ferris525ce912017-07-26 13:12:53 -07001017struct kvm_vfio_spapr_tce {
1018 __s32 groupfd;
1019 __s32 tablefd;
1020};
Ben Cheng655a7c02013-10-16 16:09:24 -07001021#define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region)
Ben Cheng655a7c02013-10-16 16:09:24 -07001022#define KVM_CREATE_VCPU _IO(KVMIO, 0x41)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001023#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log)
Ben Cheng655a7c02013-10-16 16:09:24 -07001024#define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias)
1025#define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44)
Ben Cheng655a7c02013-10-16 16:09:24 -07001026#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001027#define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46, struct kvm_userspace_memory_region)
Ben Cheng655a7c02013-10-16 16:09:24 -07001028#define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47)
1029#define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64)
Ben Cheng655a7c02013-10-16 16:09:24 -07001030struct kvm_s390_ucas_mapping {
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001031 __u64 user_addr;
Tao Baod7db5942015-01-28 10:07:51 -08001032 __u64 vcpu_addr;
1033 __u64 length;
Ben Cheng655a7c02013-10-16 16:09:24 -07001034};
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001035#define KVM_S390_UCAS_MAP _IOW(KVMIO, 0x50, struct kvm_s390_ucas_mapping)
Ben Cheng655a7c02013-10-16 16:09:24 -07001036#define KVM_S390_UCAS_UNMAP _IOW(KVMIO, 0x51, struct kvm_s390_ucas_mapping)
1037#define KVM_S390_VCPU_FAULT _IOW(KVMIO, 0x52, unsigned long)
Ben Cheng655a7c02013-10-16 16:09:24 -07001038#define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001039#define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level)
Ben Cheng655a7c02013-10-16 16:09:24 -07001040#define KVM_GET_IRQCHIP _IOWR(KVMIO, 0x62, struct kvm_irqchip)
1041#define KVM_SET_IRQCHIP _IOR(KVMIO, 0x63, struct kvm_irqchip)
Ben Cheng655a7c02013-10-16 16:09:24 -07001042#define KVM_CREATE_PIT _IO(KVMIO, 0x64)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001043#define KVM_GET_PIT _IOWR(KVMIO, 0x65, struct kvm_pit_state)
Ben Cheng655a7c02013-10-16 16:09:24 -07001044#define KVM_SET_PIT _IOR(KVMIO, 0x66, struct kvm_pit_state)
1045#define KVM_IRQ_LINE_STATUS _IOWR(KVMIO, 0x67, struct kvm_irq_level)
Tao Baod7db5942015-01-28 10:07:51 -08001046#define KVM_REGISTER_COALESCED_MMIO _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001047#define KVM_UNREGISTER_COALESCED_MMIO _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone)
Tao Baod7db5942015-01-28 10:07:51 -08001048#define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, struct kvm_assigned_pci_dev)
Ben Cheng655a7c02013-10-16 16:09:24 -07001049#define KVM_SET_GSI_ROUTING _IOW(KVMIO, 0x6a, struct kvm_irq_routing)
Ben Cheng655a7c02013-10-16 16:09:24 -07001050#define KVM_ASSIGN_IRQ __KVM_DEPRECATED_VM_R_0x70
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001051#define KVM_ASSIGN_DEV_IRQ _IOW(KVMIO, 0x70, struct kvm_assigned_irq)
Ben Cheng655a7c02013-10-16 16:09:24 -07001052#define KVM_REINJECT_CONTROL _IO(KVMIO, 0x71)
Tao Baod7db5942015-01-28 10:07:51 -08001053#define KVM_DEASSIGN_PCI_DEVICE _IOW(KVMIO, 0x72, struct kvm_assigned_pci_dev)
1054#define KVM_ASSIGN_SET_MSIX_NR _IOW(KVMIO, 0x73, struct kvm_assigned_msix_nr)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001055#define KVM_ASSIGN_SET_MSIX_ENTRY _IOW(KVMIO, 0x74, struct kvm_assigned_msix_entry)
Ben Cheng655a7c02013-10-16 16:09:24 -07001056#define KVM_DEASSIGN_DEV_IRQ _IOW(KVMIO, 0x75, struct kvm_assigned_irq)
1057#define KVM_IRQFD _IOW(KVMIO, 0x76, struct kvm_irqfd)
Ben Cheng655a7c02013-10-16 16:09:24 -07001058#define KVM_CREATE_PIT2 _IOW(KVMIO, 0x77, struct kvm_pit_config)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001059#define KVM_SET_BOOT_CPU_ID _IO(KVMIO, 0x78)
Ben Cheng655a7c02013-10-16 16:09:24 -07001060#define KVM_IOEVENTFD _IOW(KVMIO, 0x79, struct kvm_ioeventfd)
1061#define KVM_XEN_HVM_CONFIG _IOW(KVMIO, 0x7a, struct kvm_xen_hvm_config)
Ben Cheng655a7c02013-10-16 16:09:24 -07001062#define KVM_SET_CLOCK _IOW(KVMIO, 0x7b, struct kvm_clock_data)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001063#define KVM_GET_CLOCK _IOR(KVMIO, 0x7c, struct kvm_clock_data)
Ben Cheng655a7c02013-10-16 16:09:24 -07001064#define KVM_GET_PIT2 _IOR(KVMIO, 0x9f, struct kvm_pit_state2)
1065#define KVM_SET_PIT2 _IOW(KVMIO, 0xa0, struct kvm_pit_state2)
Ben Cheng655a7c02013-10-16 16:09:24 -07001066#define KVM_PPC_GET_PVINFO _IOW(KVMIO, 0xa1, struct kvm_ppc_pvinfo)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001067#define KVM_SET_TSC_KHZ _IO(KVMIO, 0xa2)
Ben Cheng655a7c02013-10-16 16:09:24 -07001068#define KVM_GET_TSC_KHZ _IO(KVMIO, 0xa3)
Tao Baod7db5942015-01-28 10:07:51 -08001069#define KVM_ASSIGN_SET_INTX_MASK _IOW(KVMIO, 0xa4, struct kvm_assigned_pci_dev)
Ben Cheng655a7c02013-10-16 16:09:24 -07001070#define KVM_SIGNAL_MSI _IOW(KVMIO, 0xa5, struct kvm_msi)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001071#define KVM_PPC_GET_SMMU_INFO _IOR(KVMIO, 0xa6, struct kvm_ppc_smmu_info)
Ben Cheng655a7c02013-10-16 16:09:24 -07001072#define KVM_PPC_ALLOCATE_HTAB _IOWR(KVMIO, 0xa7, __u32)
1073#define KVM_CREATE_SPAPR_TCE _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce)
Christopher Ferris106b3a82016-08-24 12:15:38 -07001074#define KVM_CREATE_SPAPR_TCE_64 _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce_64)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001075#define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma)
Christopher Ferris38062f92014-07-09 15:33:25 -07001076#define KVM_PPC_GET_HTAB_FD _IOW(KVMIO, 0xaa, struct kvm_get_htab_fd)
Ben Cheng655a7c02013-10-16 16:09:24 -07001077#define KVM_ARM_SET_DEVICE_ADDR _IOW(KVMIO, 0xab, struct kvm_arm_device_addr)
1078#define KVM_PPC_RTAS_DEFINE_TOKEN _IOW(KVMIO, 0xac, struct kvm_rtas_token_args)
Christopher Ferris525ce912017-07-26 13:12:53 -07001079#define KVM_PPC_RESIZE_HPT_PREPARE _IOR(KVMIO, 0xad, struct kvm_ppc_resize_hpt)
1080#define KVM_PPC_RESIZE_HPT_COMMIT _IOR(KVMIO, 0xae, struct kvm_ppc_resize_hpt)
1081#define KVM_PPC_CONFIGURE_V3_MMU _IOW(KVMIO, 0xaf, struct kvm_ppc_mmuv3_cfg)
1082#define KVM_PPC_GET_RMMU_INFO _IOW(KVMIO, 0xb0, struct kvm_ppc_rmmu_info)
Christopher Ferris934ec942018-01-31 15:29:16 -08001083#define KVM_PPC_GET_CPU_CHAR _IOR(KVMIO, 0xb1, struct kvm_ppc_cpu_char)
Christopher Ferrisb8a95e22019-10-02 18:29:20 -07001084#define KVM_SET_PMU_EVENT_FILTER _IOW(KVMIO, 0xb2, struct kvm_pmu_event_filter)
Christopher Ferrisd32ca142020-02-04 16:16:51 -08001085#define KVM_PPC_SVM_OFF _IO(KVMIO, 0xb3)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001086#define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device)
Christopher Ferris38062f92014-07-09 15:33:25 -07001087#define KVM_SET_DEVICE_ATTR _IOW(KVMIO, 0xe1, struct kvm_device_attr)
Ben Cheng655a7c02013-10-16 16:09:24 -07001088#define KVM_GET_DEVICE_ATTR _IOW(KVMIO, 0xe2, struct kvm_device_attr)
1089#define KVM_HAS_DEVICE_ATTR _IOW(KVMIO, 0xe3, struct kvm_device_attr)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001090#define KVM_RUN _IO(KVMIO, 0x80)
Christopher Ferris38062f92014-07-09 15:33:25 -07001091#define KVM_GET_REGS _IOR(KVMIO, 0x81, struct kvm_regs)
Ben Cheng655a7c02013-10-16 16:09:24 -07001092#define KVM_SET_REGS _IOW(KVMIO, 0x82, struct kvm_regs)
1093#define KVM_GET_SREGS _IOR(KVMIO, 0x83, struct kvm_sregs)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001094#define KVM_SET_SREGS _IOW(KVMIO, 0x84, struct kvm_sregs)
Christopher Ferris38062f92014-07-09 15:33:25 -07001095#define KVM_TRANSLATE _IOWR(KVMIO, 0x85, struct kvm_translation)
Ben Cheng655a7c02013-10-16 16:09:24 -07001096#define KVM_INTERRUPT _IOW(KVMIO, 0x86, struct kvm_interrupt)
1097#define KVM_DEBUG_GUEST __KVM_DEPRECATED_VCPU_W_0x87
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001098#define KVM_GET_MSRS _IOWR(KVMIO, 0x88, struct kvm_msrs)
Christopher Ferris38062f92014-07-09 15:33:25 -07001099#define KVM_SET_MSRS _IOW(KVMIO, 0x89, struct kvm_msrs)
Ben Cheng655a7c02013-10-16 16:09:24 -07001100#define KVM_SET_CPUID _IOW(KVMIO, 0x8a, struct kvm_cpuid)
1101#define KVM_SET_SIGNAL_MASK _IOW(KVMIO, 0x8b, struct kvm_signal_mask)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001102#define KVM_GET_FPU _IOR(KVMIO, 0x8c, struct kvm_fpu)
Christopher Ferris38062f92014-07-09 15:33:25 -07001103#define KVM_SET_FPU _IOW(KVMIO, 0x8d, struct kvm_fpu)
Ben Cheng655a7c02013-10-16 16:09:24 -07001104#define KVM_GET_LAPIC _IOR(KVMIO, 0x8e, struct kvm_lapic_state)
1105#define KVM_SET_LAPIC _IOW(KVMIO, 0x8f, struct kvm_lapic_state)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001106#define KVM_SET_CPUID2 _IOW(KVMIO, 0x90, struct kvm_cpuid2)
Christopher Ferris38062f92014-07-09 15:33:25 -07001107#define KVM_GET_CPUID2 _IOWR(KVMIO, 0x91, struct kvm_cpuid2)
Ben Cheng655a7c02013-10-16 16:09:24 -07001108#define KVM_TPR_ACCESS_REPORTING _IOWR(KVMIO, 0x92, struct kvm_tpr_access_ctl)
1109#define KVM_SET_VAPIC_ADDR _IOW(KVMIO, 0x93, struct kvm_vapic_addr)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001110#define KVM_S390_INTERRUPT _IOW(KVMIO, 0x94, struct kvm_s390_interrupt)
Tao Baod7db5942015-01-28 10:07:51 -08001111#define KVM_S390_STORE_STATUS_NOADDR (- 1ul)
Tao Baod7db5942015-01-28 10:07:51 -08001112#define KVM_S390_STORE_STATUS_PREFIXED (- 2ul)
Ben Cheng655a7c02013-10-16 16:09:24 -07001113#define KVM_S390_STORE_STATUS _IOW(KVMIO, 0x95, unsigned long)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001114#define KVM_S390_SET_INITIAL_PSW _IOW(KVMIO, 0x96, struct kvm_s390_psw)
Christopher Ferris38062f92014-07-09 15:33:25 -07001115#define KVM_S390_INITIAL_RESET _IO(KVMIO, 0x97)
Ben Cheng655a7c02013-10-16 16:09:24 -07001116#define KVM_GET_MP_STATE _IOR(KVMIO, 0x98, struct kvm_mp_state)
1117#define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001118#define KVM_NMI _IO(KVMIO, 0x9a)
Christopher Ferris38062f92014-07-09 15:33:25 -07001119#define KVM_SET_GUEST_DEBUG _IOW(KVMIO, 0x9b, struct kvm_guest_debug)
Ben Cheng655a7c02013-10-16 16:09:24 -07001120#define KVM_X86_SETUP_MCE _IOW(KVMIO, 0x9c, __u64)
1121#define KVM_X86_GET_MCE_CAP_SUPPORTED _IOR(KVMIO, 0x9d, __u64)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001122#define KVM_X86_SET_MCE _IOW(KVMIO, 0x9e, struct kvm_x86_mce)
Ben Cheng655a7c02013-10-16 16:09:24 -07001123#define KVM_GET_VCPU_EVENTS _IOR(KVMIO, 0x9f, struct kvm_vcpu_events)
Ben Cheng655a7c02013-10-16 16:09:24 -07001124#define KVM_SET_VCPU_EVENTS _IOW(KVMIO, 0xa0, struct kvm_vcpu_events)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001125#define KVM_GET_DEBUGREGS _IOR(KVMIO, 0xa1, struct kvm_debugregs)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001126#define KVM_SET_DEBUGREGS _IOW(KVMIO, 0xa2, struct kvm_debugregs)
Ben Cheng655a7c02013-10-16 16:09:24 -07001127#define KVM_ENABLE_CAP _IOW(KVMIO, 0xa3, struct kvm_enable_cap)
Ben Cheng655a7c02013-10-16 16:09:24 -07001128#define KVM_GET_XSAVE _IOR(KVMIO, 0xa4, struct kvm_xsave)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001129#define KVM_SET_XSAVE _IOW(KVMIO, 0xa5, struct kvm_xsave)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001130#define KVM_GET_XCRS _IOR(KVMIO, 0xa6, struct kvm_xcrs)
Ben Cheng655a7c02013-10-16 16:09:24 -07001131#define KVM_SET_XCRS _IOW(KVMIO, 0xa7, struct kvm_xcrs)
Ben Cheng655a7c02013-10-16 16:09:24 -07001132#define KVM_DIRTY_TLB _IOW(KVMIO, 0xaa, struct kvm_dirty_tlb)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001133#define KVM_GET_ONE_REG _IOW(KVMIO, 0xab, struct kvm_one_reg)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001134#define KVM_SET_ONE_REG _IOW(KVMIO, 0xac, struct kvm_one_reg)
Ben Cheng655a7c02013-10-16 16:09:24 -07001135#define KVM_KVMCLOCK_CTRL _IO(KVMIO, 0xad)
Ben Cheng655a7c02013-10-16 16:09:24 -07001136#define KVM_ARM_VCPU_INIT _IOW(KVMIO, 0xae, struct kvm_vcpu_init)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001137#define KVM_ARM_PREFERRED_TARGET _IOR(KVMIO, 0xaf, struct kvm_vcpu_init)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001138#define KVM_GET_REG_LIST _IOWR(KVMIO, 0xb0, struct kvm_reg_list)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001139#define KVM_S390_MEM_OP _IOW(KVMIO, 0xb1, struct kvm_s390_mem_op)
1140#define KVM_S390_GET_SKEYS _IOW(KVMIO, 0xb2, struct kvm_s390_skeys)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001141#define KVM_S390_SET_SKEYS _IOW(KVMIO, 0xb3, struct kvm_s390_skeys)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001142#define KVM_S390_IRQ _IOW(KVMIO, 0xb4, struct kvm_s390_irq)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001143#define KVM_S390_SET_IRQ_STATE _IOW(KVMIO, 0xb5, struct kvm_s390_irq_state)
1144#define KVM_S390_GET_IRQ_STATE _IOW(KVMIO, 0xb6, struct kvm_s390_irq_state)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001145#define KVM_SMI _IO(KVMIO, 0xb7)
Christopher Ferris1308ad32017-11-14 17:32:13 -08001146#define KVM_S390_GET_CMMA_BITS _IOWR(KVMIO, 0xb8, struct kvm_s390_cmma_log)
1147#define KVM_S390_SET_CMMA_BITS _IOW(KVMIO, 0xb9, struct kvm_s390_cmma_log)
Christopher Ferris76a1d452018-06-27 14:12:29 -07001148#define KVM_MEMORY_ENCRYPT_OP _IOWR(KVMIO, 0xba, unsigned long)
1149struct kvm_enc_region {
1150 __u64 addr;
1151 __u64 size;
1152};
1153#define KVM_MEMORY_ENCRYPT_REG_REGION _IOR(KVMIO, 0xbb, struct kvm_enc_region)
1154#define KVM_MEMORY_ENCRYPT_UNREG_REGION _IOR(KVMIO, 0xbc, struct kvm_enc_region)
1155#define KVM_HYPERV_EVENTFD _IOW(KVMIO, 0xbd, struct kvm_hyperv_eventfd)
Christopher Ferris9ce28842018-10-25 12:11:39 -07001156#define KVM_GET_NESTED_STATE _IOWR(KVMIO, 0xbe, struct kvm_nested_state)
1157#define KVM_SET_NESTED_STATE _IOW(KVMIO, 0xbf, struct kvm_nested_state)
Christopher Ferrisd842e432019-03-07 10:21:59 -08001158#define KVM_CLEAR_DIRTY_LOG _IOWR(KVMIO, 0xc0, struct kvm_clear_dirty_log)
1159#define KVM_GET_SUPPORTED_HV_CPUID _IOWR(KVMIO, 0xc1, struct kvm_cpuid2)
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -07001160#define KVM_ARM_VCPU_FINALIZE _IOW(KVMIO, 0xc2, int)
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -07001161#define KVM_S390_NORMAL_RESET _IO(KVMIO, 0xc3)
1162#define KVM_S390_CLEAR_RESET _IO(KVMIO, 0xc4)
Christopher Ferrisaf09c702020-06-01 20:29:29 -07001163struct kvm_s390_pv_sec_parm {
1164 __u64 origin;
1165 __u64 length;
1166};
1167struct kvm_s390_pv_unp {
1168 __u64 addr;
1169 __u64 size;
1170 __u64 tweak;
1171};
1172enum pv_cmd_id {
1173 KVM_PV_ENABLE,
1174 KVM_PV_DISABLE,
1175 KVM_PV_SET_SEC_PARMS,
1176 KVM_PV_UNPACK,
1177 KVM_PV_VERIFY,
1178 KVM_PV_PREP_RESET,
1179 KVM_PV_UNSHARE_ALL,
1180};
1181struct kvm_pv_cmd {
1182 __u32 cmd;
1183 __u16 rc;
1184 __u16 rrc;
1185 __u64 data;
1186 __u32 flags;
1187 __u32 reserved[3];
1188};
1189#define KVM_S390_PV_COMMAND _IOWR(KVMIO, 0xc5, struct kvm_pv_cmd)
Christopher Ferris32ff3f82020-12-14 13:10:04 -08001190#define KVM_X86_SET_MSR_FILTER _IOW(KVMIO, 0xc6, struct kvm_msr_filter)
Christopher Ferris05667cd2021-02-16 16:01:34 -08001191#define KVM_RESET_DIRTY_RINGS _IO(KVMIO, 0xc7)
Christopher Ferris76a1d452018-06-27 14:12:29 -07001192enum sev_cmd_id {
1193 KVM_SEV_INIT = 0,
1194 KVM_SEV_ES_INIT,
1195 KVM_SEV_LAUNCH_START,
1196 KVM_SEV_LAUNCH_UPDATE_DATA,
1197 KVM_SEV_LAUNCH_UPDATE_VMSA,
1198 KVM_SEV_LAUNCH_SECRET,
1199 KVM_SEV_LAUNCH_MEASURE,
1200 KVM_SEV_LAUNCH_FINISH,
1201 KVM_SEV_SEND_START,
1202 KVM_SEV_SEND_UPDATE_DATA,
1203 KVM_SEV_SEND_UPDATE_VMSA,
1204 KVM_SEV_SEND_FINISH,
1205 KVM_SEV_RECEIVE_START,
1206 KVM_SEV_RECEIVE_UPDATE_DATA,
1207 KVM_SEV_RECEIVE_UPDATE_VMSA,
1208 KVM_SEV_RECEIVE_FINISH,
1209 KVM_SEV_GUEST_STATUS,
1210 KVM_SEV_DBG_DECRYPT,
1211 KVM_SEV_DBG_ENCRYPT,
1212 KVM_SEV_CERT_EXPORT,
1213 KVM_SEV_NR_MAX,
1214};
1215struct kvm_sev_cmd {
1216 __u32 id;
1217 __u64 data;
1218 __u32 error;
1219 __u32 sev_fd;
1220};
1221struct kvm_sev_launch_start {
1222 __u32 handle;
1223 __u32 policy;
1224 __u64 dh_uaddr;
1225 __u32 dh_len;
1226 __u64 session_uaddr;
1227 __u32 session_len;
1228};
1229struct kvm_sev_launch_update_data {
1230 __u64 uaddr;
1231 __u32 len;
1232};
1233struct kvm_sev_launch_secret {
1234 __u64 hdr_uaddr;
1235 __u32 hdr_len;
1236 __u64 guest_uaddr;
1237 __u32 guest_len;
1238 __u64 trans_uaddr;
1239 __u32 trans_len;
1240};
1241struct kvm_sev_launch_measure {
1242 __u64 uaddr;
1243 __u32 len;
1244};
1245struct kvm_sev_guest_status {
1246 __u32 handle;
1247 __u32 policy;
1248 __u32 state;
1249};
1250struct kvm_sev_dbg {
1251 __u64 src_uaddr;
1252 __u64 dst_uaddr;
1253 __u32 len;
1254};
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001255#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
Ben Cheng655a7c02013-10-16 16:09:24 -07001256#define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1)
Ben Cheng655a7c02013-10-16 16:09:24 -07001257#define KVM_DEV_ASSIGN_MASK_INTX (1 << 2)
1258struct kvm_assigned_pci_dev {
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001259 __u32 assigned_dev_id;
Tao Baod7db5942015-01-28 10:07:51 -08001260 __u32 busnr;
1261 __u32 devfn;
Tao Baod7db5942015-01-28 10:07:51 -08001262 __u32 flags;
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001263 __u32 segnr;
Tao Baod7db5942015-01-28 10:07:51 -08001264 union {
1265 __u32 reserved[11];
Tao Baod7db5942015-01-28 10:07:51 -08001266 };
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001267};
Ben Cheng655a7c02013-10-16 16:09:24 -07001268#define KVM_DEV_IRQ_HOST_INTX (1 << 0)
Ben Cheng655a7c02013-10-16 16:09:24 -07001269#define KVM_DEV_IRQ_HOST_MSI (1 << 1)
1270#define KVM_DEV_IRQ_HOST_MSIX (1 << 2)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001271#define KVM_DEV_IRQ_GUEST_INTX (1 << 8)
Ben Cheng655a7c02013-10-16 16:09:24 -07001272#define KVM_DEV_IRQ_GUEST_MSI (1 << 9)
Ben Cheng655a7c02013-10-16 16:09:24 -07001273#define KVM_DEV_IRQ_GUEST_MSIX (1 << 10)
1274#define KVM_DEV_IRQ_HOST_MASK 0x00ff
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001275#define KVM_DEV_IRQ_GUEST_MASK 0xff00
Ben Cheng655a7c02013-10-16 16:09:24 -07001276struct kvm_assigned_irq {
Tao Baod7db5942015-01-28 10:07:51 -08001277 __u32 assigned_dev_id;
Tao Baod7db5942015-01-28 10:07:51 -08001278 __u32 host_irq;
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001279 __u32 guest_irq;
Tao Baod7db5942015-01-28 10:07:51 -08001280 __u32 flags;
1281 union {
Tao Baod7db5942015-01-28 10:07:51 -08001282 __u32 reserved[12];
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001283 };
Ben Cheng655a7c02013-10-16 16:09:24 -07001284};
Ben Cheng655a7c02013-10-16 16:09:24 -07001285struct kvm_assigned_msix_nr {
Tao Baod7db5942015-01-28 10:07:51 -08001286 __u32 assigned_dev_id;
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001287 __u16 entry_nr;
Tao Baod7db5942015-01-28 10:07:51 -08001288 __u16 padding;
Ben Cheng655a7c02013-10-16 16:09:24 -07001289};
1290#define KVM_MAX_MSIX_PER_DEV 256
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001291struct kvm_assigned_msix_entry {
Tao Baod7db5942015-01-28 10:07:51 -08001292 __u32 assigned_dev_id;
1293 __u32 gsi;
Tao Baod7db5942015-01-28 10:07:51 -08001294 __u16 entry;
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001295 __u16 padding[3];
Ben Cheng655a7c02013-10-16 16:09:24 -07001296};
Christopher Ferris49f525c2016-12-12 14:55:36 -08001297#define KVM_X2APIC_API_USE_32BIT_IDS (1ULL << 0)
1298#define KVM_X2APIC_API_DISABLE_BROADCAST_QUIRK (1ULL << 1)
Christopher Ferris525ce912017-07-26 13:12:53 -07001299#define KVM_ARM_DEV_EL1_VTIMER (1 << 0)
1300#define KVM_ARM_DEV_EL1_PTIMER (1 << 1)
1301#define KVM_ARM_DEV_PMU (1 << 2)
Christopher Ferris76a1d452018-06-27 14:12:29 -07001302struct kvm_hyperv_eventfd {
1303 __u32 conn_id;
1304 __s32 fd;
1305 __u32 flags;
1306 __u32 padding[3];
1307};
1308#define KVM_HYPERV_CONN_ID_MASK 0x00ffffff
1309#define KVM_HYPERV_EVENTFD_DEASSIGN (1 << 0)
Christopher Ferrisaf09c702020-06-01 20:29:29 -07001310#define KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE (1 << 0)
1311#define KVM_DIRTY_LOG_INITIALLY_SET (1 << 1)
Christopher Ferris05667cd2021-02-16 16:01:34 -08001312#ifndef KVM_DIRTY_LOG_PAGE_OFFSET
1313#define KVM_DIRTY_LOG_PAGE_OFFSET 0
1314#endif
1315#define KVM_DIRTY_GFN_F_DIRTY BIT(0)
1316#define KVM_DIRTY_GFN_F_RESET BIT(1)
1317#define KVM_DIRTY_GFN_F_MASK 0x3
1318struct kvm_dirty_gfn {
1319 __u32 flags;
1320 __u32 slot;
1321 __u64 offset;
1322};
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001323#endif