blob: 6bd470196eea93e434ed22d6f8164eb32a596dba [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
140 __u32 type;
141 union {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700142 struct {
143 __u32 msr;
144 __u64 control;
145 __u64 evt_page;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700146 __u64 msg_page;
147 } synic;
148 struct {
149 __u64 input;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700150 __u64 result;
151 __u64 params[2];
152 } hcall;
153 } u;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700154};
155#define KVM_S390_GET_SKEYS_NONE 1
Christopher Ferris05d08e92016-02-04 13:16:38 -0800156#define KVM_S390_SKEYS_MAX 1048576
Ben Cheng655a7c02013-10-16 16:09:24 -0700157#define KVM_EXIT_UNKNOWN 0
158#define KVM_EXIT_EXCEPTION 1
159#define KVM_EXIT_IO 2
Christopher Ferris05d08e92016-02-04 13:16:38 -0800160#define KVM_EXIT_HYPERCALL 3
Ben Cheng655a7c02013-10-16 16:09:24 -0700161#define KVM_EXIT_DEBUG 4
162#define KVM_EXIT_HLT 5
163#define KVM_EXIT_MMIO 6
Christopher Ferris05d08e92016-02-04 13:16:38 -0800164#define KVM_EXIT_IRQ_WINDOW_OPEN 7
Ben Cheng655a7c02013-10-16 16:09:24 -0700165#define KVM_EXIT_SHUTDOWN 8
166#define KVM_EXIT_FAIL_ENTRY 9
167#define KVM_EXIT_INTR 10
Christopher Ferris05d08e92016-02-04 13:16:38 -0800168#define KVM_EXIT_SET_TPR 11
Ben Cheng655a7c02013-10-16 16:09:24 -0700169#define KVM_EXIT_TPR_ACCESS 12
170#define KVM_EXIT_S390_SIEIC 13
171#define KVM_EXIT_S390_RESET 14
Christopher Ferris05d08e92016-02-04 13:16:38 -0800172#define KVM_EXIT_DCR 15
Ben Cheng655a7c02013-10-16 16:09:24 -0700173#define KVM_EXIT_NMI 16
174#define KVM_EXIT_INTERNAL_ERROR 17
175#define KVM_EXIT_OSI 18
Christopher Ferris05d08e92016-02-04 13:16:38 -0800176#define KVM_EXIT_PAPR_HCALL 19
Ben Cheng655a7c02013-10-16 16:09:24 -0700177#define KVM_EXIT_S390_UCONTROL 20
178#define KVM_EXIT_WATCHDOG 21
179#define KVM_EXIT_S390_TSCH 22
Christopher Ferris05d08e92016-02-04 13:16:38 -0800180#define KVM_EXIT_EPR 23
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700181#define KVM_EXIT_SYSTEM_EVENT 24
Christopher Ferris05d08e92016-02-04 13:16:38 -0800182#define KVM_EXIT_S390_STSI 25
183#define KVM_EXIT_IOAPIC_EOI 26
Christopher Ferris106b3a82016-08-24 12:15:38 -0700184#define KVM_EXIT_HYPERV 27
Ben Cheng655a7c02013-10-16 16:09:24 -0700185#define KVM_INTERNAL_ERROR_EMULATION 1
186#define KVM_INTERNAL_ERROR_SIMUL_EX 2
187#define KVM_INTERNAL_ERROR_DELIVERY_EV 3
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700188struct kvm_run {
Tao Baod7db5942015-01-28 10:07:51 -0800189 __u8 request_interrupt_window;
Christopher Ferris525ce912017-07-26 13:12:53 -0700190 __u8 immediate_exit;
191 __u8 padding1[6];
Tao Baod7db5942015-01-28 10:07:51 -0800192 __u32 exit_reason;
Tao Baod7db5942015-01-28 10:07:51 -0800193 __u8 ready_for_interrupt_injection;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800194 __u8 if_flag;
195 __u16 flags;
196 __u64 cr8;
Tao Baod7db5942015-01-28 10:07:51 -0800197 __u64 apic_base;
Ben Cheng655a7c02013-10-16 16:09:24 -0700198#ifdef __KVM_S390
Tao Baod7db5942015-01-28 10:07:51 -0800199 __u64 psw_mask;
200 __u64 psw_addr;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700201#endif
Tao Baod7db5942015-01-28 10:07:51 -0800202 union {
203 struct {
204 __u64 hardware_exit_reason;
Tao Baod7db5942015-01-28 10:07:51 -0800205 } hw;
206 struct {
207 __u64 hardware_entry_failure_reason;
208 } fail_entry;
Tao Baod7db5942015-01-28 10:07:51 -0800209 struct {
210 __u32 exception;
211 __u32 error_code;
212 } ex;
Tao Baod7db5942015-01-28 10:07:51 -0800213 struct {
Ben Cheng655a7c02013-10-16 16:09:24 -0700214#define KVM_EXIT_IO_IN 0
215#define KVM_EXIT_IO_OUT 1
Tao Baod7db5942015-01-28 10:07:51 -0800216 __u8 direction;
Tao Baod7db5942015-01-28 10:07:51 -0800217 __u8 size;
218 __u16 port;
219 __u32 count;
220 __u64 data_offset;
Tao Baod7db5942015-01-28 10:07:51 -0800221 } io;
222 struct {
223 struct kvm_debug_exit_arch arch;
224 } debug;
Tao Baod7db5942015-01-28 10:07:51 -0800225 struct {
226 __u64 phys_addr;
227 __u8 data[8];
228 __u32 len;
Tao Baod7db5942015-01-28 10:07:51 -0800229 __u8 is_write;
230 } mmio;
231 struct {
232 __u64 nr;
Tao Baod7db5942015-01-28 10:07:51 -0800233 __u64 args[6];
234 __u64 ret;
235 __u32 longmode;
236 __u32 pad;
Tao Baod7db5942015-01-28 10:07:51 -0800237 } hypercall;
238 struct {
239 __u64 rip;
240 __u32 is_write;
Tao Baod7db5942015-01-28 10:07:51 -0800241 __u32 pad;
242 } tpr_access;
243 struct {
244 __u8 icptcode;
Tao Baod7db5942015-01-28 10:07:51 -0800245 __u16 ipa;
246 __u32 ipb;
247 } s390_sieic;
Ben Cheng655a7c02013-10-16 16:09:24 -0700248#define KVM_S390_RESET_POR 1
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700249#define KVM_S390_RESET_CLEAR 2
Ben Cheng655a7c02013-10-16 16:09:24 -0700250#define KVM_S390_RESET_SUBSYSTEM 4
251#define KVM_S390_RESET_CPU_INIT 8
252#define KVM_S390_RESET_IPL 16
Tao Baod7db5942015-01-28 10:07:51 -0800253 __u64 s390_reset_flags;
254 struct {
255 __u64 trans_exc_code;
256 __u32 pgm_code;
Tao Baod7db5942015-01-28 10:07:51 -0800257 } s390_ucontrol;
258 struct {
259 __u32 dcrn;
260 __u32 data;
Tao Baod7db5942015-01-28 10:07:51 -0800261 __u8 is_write;
262 } dcr;
263 struct {
264 __u32 suberror;
Tao Baod7db5942015-01-28 10:07:51 -0800265 __u32 ndata;
266 __u64 data[16];
267 } internal;
268 struct {
Tao Baod7db5942015-01-28 10:07:51 -0800269 __u64 gprs[32];
270 } osi;
271 struct {
272 __u64 nr;
Tao Baod7db5942015-01-28 10:07:51 -0800273 __u64 ret;
274 __u64 args[9];
275 } papr_hcall;
276 struct {
Tao Baod7db5942015-01-28 10:07:51 -0800277 __u16 subchannel_id;
278 __u16 subchannel_nr;
279 __u32 io_int_parm;
280 __u32 io_int_word;
Tao Baod7db5942015-01-28 10:07:51 -0800281 __u32 ipb;
282 __u8 dequeued;
283 } s390_tsch;
284 struct {
Tao Baod7db5942015-01-28 10:07:51 -0800285 __u32 epr;
286 } epr;
287 struct {
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700288#define KVM_SYSTEM_EVENT_SHUTDOWN 1
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700289#define KVM_SYSTEM_EVENT_RESET 2
Christopher Ferris05d08e92016-02-04 13:16:38 -0800290#define KVM_SYSTEM_EVENT_CRASH 3
Tao Baod7db5942015-01-28 10:07:51 -0800291 __u32 type;
292 __u64 flags;
293 } system_event;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800294 struct {
295 __u64 addr;
296 __u8 ar;
297 __u8 reserved;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800298 __u8 fc;
299 __u8 sel1;
300 __u16 sel2;
301 } s390_stsi;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800302 struct {
303 __u8 vector;
304 } eoi;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700305 struct kvm_hyperv_exit hyperv;
Tao Baod7db5942015-01-28 10:07:51 -0800306 char padding[256];
307 };
308 __u64 kvm_valid_regs;
309 __u64 kvm_dirty_regs;
Tao Baod7db5942015-01-28 10:07:51 -0800310 union {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800311 struct kvm_sync_regs regs;
312 char padding[2048];
313 } s;
Ben Cheng655a7c02013-10-16 16:09:24 -0700314};
315struct kvm_coalesced_mmio_zone {
Tao Baod7db5942015-01-28 10:07:51 -0800316 __u64 addr;
317 __u32 size;
Tao Baod7db5942015-01-28 10:07:51 -0800318 __u32 pad;
Ben Cheng655a7c02013-10-16 16:09:24 -0700319};
320struct kvm_coalesced_mmio {
Tao Baod7db5942015-01-28 10:07:51 -0800321 __u64 phys_addr;
Tao Baod7db5942015-01-28 10:07:51 -0800322 __u32 len;
323 __u32 pad;
324 __u8 data[8];
Ben Cheng655a7c02013-10-16 16:09:24 -0700325};
326struct kvm_coalesced_mmio_ring {
Tao Baod7db5942015-01-28 10:07:51 -0800327 __u32 first, last;
328 struct kvm_coalesced_mmio coalesced_mmio[0];
Ben Cheng655a7c02013-10-16 16:09:24 -0700329};
Tao Baod7db5942015-01-28 10:07:51 -0800330#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 -0700331struct kvm_translation {
Tao Baod7db5942015-01-28 10:07:51 -0800332 __u64 linear_address;
333 __u64 physical_address;
Tao Baod7db5942015-01-28 10:07:51 -0800334 __u8 valid;
335 __u8 writeable;
336 __u8 usermode;
337 __u8 pad[5];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800338};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800339struct kvm_s390_mem_op {
340 __u64 gaddr;
341 __u64 flags;
342 __u32 size;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800343 __u32 op;
344 __u64 buf;
345 __u8 ar;
346 __u8 reserved[31];
Ben Cheng655a7c02013-10-16 16:09:24 -0700347};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800348#define KVM_S390_MEMOP_LOGICAL_READ 0
349#define KVM_S390_MEMOP_LOGICAL_WRITE 1
350#define KVM_S390_MEMOP_F_CHECK_ONLY (1ULL << 0)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800351#define KVM_S390_MEMOP_F_INJECT_EXCEPTION (1ULL << 1)
Ben Cheng655a7c02013-10-16 16:09:24 -0700352struct kvm_interrupt {
Tao Baod7db5942015-01-28 10:07:51 -0800353 __u32 irq;
Ben Cheng655a7c02013-10-16 16:09:24 -0700354};
355struct kvm_dirty_log {
Tao Baod7db5942015-01-28 10:07:51 -0800356 __u32 slot;
357 __u32 padding1;
358 union {
Tao Baod7db5942015-01-28 10:07:51 -0800359 void __user * dirty_bitmap;
360 __u64 padding2;
361 };
Ben Cheng655a7c02013-10-16 16:09:24 -0700362};
363struct kvm_signal_mask {
Tao Baod7db5942015-01-28 10:07:51 -0800364 __u32 len;
365 __u8 sigset[0];
Ben Cheng655a7c02013-10-16 16:09:24 -0700366};
367struct kvm_tpr_access_ctl {
Tao Baod7db5942015-01-28 10:07:51 -0800368 __u32 enabled;
369 __u32 flags;
370 __u32 reserved[8];
Ben Cheng655a7c02013-10-16 16:09:24 -0700371};
372struct kvm_vapic_addr {
Tao Baod7db5942015-01-28 10:07:51 -0800373 __u64 vapic_addr;
Ben Cheng655a7c02013-10-16 16:09:24 -0700374};
375#define KVM_MP_STATE_RUNNABLE 0
376#define KVM_MP_STATE_UNINITIALIZED 1
377#define KVM_MP_STATE_INIT_RECEIVED 2
Ben Cheng655a7c02013-10-16 16:09:24 -0700378#define KVM_MP_STATE_HALTED 3
379#define KVM_MP_STATE_SIPI_RECEIVED 4
Christopher Ferris82d75042015-01-26 10:57:07 -0800380#define KVM_MP_STATE_STOPPED 5
381#define KVM_MP_STATE_CHECK_STOP 6
382#define KVM_MP_STATE_OPERATING 7
Christopher Ferris82d75042015-01-26 10:57:07 -0800383#define KVM_MP_STATE_LOAD 8
Ben Cheng655a7c02013-10-16 16:09:24 -0700384struct kvm_mp_state {
Tao Baod7db5942015-01-28 10:07:51 -0800385 __u32 mp_state;
Ben Cheng655a7c02013-10-16 16:09:24 -0700386};
387struct kvm_s390_psw {
Tao Baod7db5942015-01-28 10:07:51 -0800388 __u64 mask;
389 __u64 addr;
Ben Cheng655a7c02013-10-16 16:09:24 -0700390};
391#define KVM_S390_SIGP_STOP 0xfffe0000u
392#define KVM_S390_PROGRAM_INT 0xfffe0001u
393#define KVM_S390_SIGP_SET_PREFIX 0xfffe0002u
Ben Cheng655a7c02013-10-16 16:09:24 -0700394#define KVM_S390_RESTART 0xfffe0003u
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700395#define KVM_S390_INT_PFAULT_INIT 0xfffe0004u
396#define KVM_S390_INT_PFAULT_DONE 0xfffe0005u
Ben Cheng655a7c02013-10-16 16:09:24 -0700397#define KVM_S390_MCHK 0xfffe1000u
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700398#define KVM_S390_INT_CLOCK_COMP 0xffff1004u
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700399#define KVM_S390_INT_CPU_TIMER 0xffff1005u
Ben Cheng655a7c02013-10-16 16:09:24 -0700400#define KVM_S390_INT_VIRTIO 0xffff2603u
401#define KVM_S390_INT_SERVICE 0xffff2401u
Ben Cheng655a7c02013-10-16 16:09:24 -0700402#define KVM_S390_INT_EMERGENCY 0xffff1201u
403#define KVM_S390_INT_EXTERNAL_CALL 0xffff1202u
Tao Baod7db5942015-01-28 10:07:51 -0800404#define KVM_S390_INT_IO(ai,cssid,ssid,schid) (((schid)) | ((ssid) << 16) | ((cssid) << 18) | ((ai) << 26))
Ben Cheng655a7c02013-10-16 16:09:24 -0700405#define KVM_S390_INT_IO_MIN 0x00000000u
Ben Cheng655a7c02013-10-16 16:09:24 -0700406#define KVM_S390_INT_IO_MAX 0xfffdffffu
Christopher Ferris05d08e92016-02-04 13:16:38 -0800407#define KVM_S390_INT_IO_AI_MASK 0x04000000u
Ben Cheng655a7c02013-10-16 16:09:24 -0700408struct kvm_s390_interrupt {
Tao Baod7db5942015-01-28 10:07:51 -0800409 __u32 type;
410 __u32 parm;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800411 __u64 parm64;
Ben Cheng655a7c02013-10-16 16:09:24 -0700412};
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700413struct kvm_s390_io_info {
Tao Baod7db5942015-01-28 10:07:51 -0800414 __u16 subchannel_id;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800415 __u16 subchannel_nr;
Tao Baod7db5942015-01-28 10:07:51 -0800416 __u32 io_int_parm;
417 __u32 io_int_word;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700418};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800419struct kvm_s390_ext_info {
Tao Baod7db5942015-01-28 10:07:51 -0800420 __u32 ext_params;
421 __u32 pad;
422 __u64 ext_params2;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800423};
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700424struct kvm_s390_pgm_info {
Tao Baod7db5942015-01-28 10:07:51 -0800425 __u64 trans_exc_code;
426 __u64 mon_code;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800427 __u64 per_address;
Tao Baod7db5942015-01-28 10:07:51 -0800428 __u32 data_exc_code;
429 __u16 code;
430 __u16 mon_class_nr;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800431 __u8 per_code;
Tao Baod7db5942015-01-28 10:07:51 -0800432 __u8 per_atmid;
433 __u8 exc_access_id;
434 __u8 per_access_id;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800435 __u8 op_access_id;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700436#define KVM_S390_PGM_FLAGS_ILC_VALID 0x01
437#define KVM_S390_PGM_FLAGS_ILC_0 0x02
438#define KVM_S390_PGM_FLAGS_ILC_1 0x04
Christopher Ferris106b3a82016-08-24 12:15:38 -0700439#define KVM_S390_PGM_FLAGS_ILC_MASK 0x06
440#define KVM_S390_PGM_FLAGS_NO_REWIND 0x08
441 __u8 flags;
442 __u8 pad[2];
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700443};
444struct kvm_s390_prefix_info {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800445 __u32 address;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700446};
447struct kvm_s390_extcall_info {
Tao Baod7db5942015-01-28 10:07:51 -0800448 __u16 code;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800449};
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700450struct kvm_s390_emerg_info {
Tao Baod7db5942015-01-28 10:07:51 -0800451 __u16 code;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700452};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800453#define KVM_S390_STOP_FLAG_STORE_STATUS 0x01
454struct kvm_s390_stop_info {
455 __u32 flags;
456};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800457struct kvm_s390_mchk_info {
Tao Baod7db5942015-01-28 10:07:51 -0800458 __u64 cr14;
459 __u64 mcic;
460 __u64 failing_storage_address;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800461 __u32 ext_damage_code;
Tao Baod7db5942015-01-28 10:07:51 -0800462 __u32 pad;
463 __u8 fixed_logout[16];
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700464};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800465struct kvm_s390_irq {
Tao Baod7db5942015-01-28 10:07:51 -0800466 __u64 type;
467 union {
468 struct kvm_s390_io_info io;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800469 struct kvm_s390_ext_info ext;
Tao Baod7db5942015-01-28 10:07:51 -0800470 struct kvm_s390_pgm_info pgm;
471 struct kvm_s390_emerg_info emerg;
472 struct kvm_s390_extcall_info extcall;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800473 struct kvm_s390_prefix_info prefix;
474 struct kvm_s390_stop_info stop;
Tao Baod7db5942015-01-28 10:07:51 -0800475 struct kvm_s390_mchk_info mchk;
476 char reserved[64];
477 } u;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700478};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800479struct kvm_s390_irq_state {
480 __u64 buf;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800481 __u32 flags;
482 __u32 len;
483 __u32 reserved[4];
484};
Ben Cheng655a7c02013-10-16 16:09:24 -0700485#define KVM_GUESTDBG_ENABLE 0x00000001
486#define KVM_GUESTDBG_SINGLESTEP 0x00000002
Ben Cheng655a7c02013-10-16 16:09:24 -0700487struct kvm_guest_debug {
Tao Baod7db5942015-01-28 10:07:51 -0800488 __u32 control;
Tao Baod7db5942015-01-28 10:07:51 -0800489 __u32 pad;
490 struct kvm_guest_debug_arch arch;
Ben Cheng655a7c02013-10-16 16:09:24 -0700491};
492enum {
Tao Baod7db5942015-01-28 10:07:51 -0800493 kvm_ioeventfd_flag_nr_datamatch,
494 kvm_ioeventfd_flag_nr_pio,
495 kvm_ioeventfd_flag_nr_deassign,
496 kvm_ioeventfd_flag_nr_virtio_ccw_notify,
Tao Baod7db5942015-01-28 10:07:51 -0800497 kvm_ioeventfd_flag_nr_fast_mmio,
498 kvm_ioeventfd_flag_nr_max,
Ben Cheng655a7c02013-10-16 16:09:24 -0700499};
Ben Cheng655a7c02013-10-16 16:09:24 -0700500#define KVM_IOEVENTFD_FLAG_DATAMATCH (1 << kvm_ioeventfd_flag_nr_datamatch)
501#define KVM_IOEVENTFD_FLAG_PIO (1 << kvm_ioeventfd_flag_nr_pio)
502#define KVM_IOEVENTFD_FLAG_DEASSIGN (1 << kvm_ioeventfd_flag_nr_deassign)
Tao Baod7db5942015-01-28 10:07:51 -0800503#define KVM_IOEVENTFD_FLAG_VIRTIO_CCW_NOTIFY (1 << kvm_ioeventfd_flag_nr_virtio_ccw_notify)
Ben Cheng655a7c02013-10-16 16:09:24 -0700504#define KVM_IOEVENTFD_VALID_FLAG_MASK ((1 << kvm_ioeventfd_flag_nr_max) - 1)
505struct kvm_ioeventfd {
Tao Baod7db5942015-01-28 10:07:51 -0800506 __u64 datamatch;
507 __u64 addr;
508 __u32 len;
Tao Baod7db5942015-01-28 10:07:51 -0800509 __s32 fd;
510 __u32 flags;
511 __u8 pad[36];
Ben Cheng655a7c02013-10-16 16:09:24 -0700512};
513struct kvm_enable_cap {
Tao Baod7db5942015-01-28 10:07:51 -0800514 __u32 cap;
515 __u32 flags;
516 __u64 args[4];
Tao Baod7db5942015-01-28 10:07:51 -0800517 __u8 pad[64];
Ben Cheng655a7c02013-10-16 16:09:24 -0700518};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800519#define KVM_PPC_PVINFO_FLAGS_EV_IDLE (1 << 0)
Ben Cheng655a7c02013-10-16 16:09:24 -0700520struct kvm_ppc_pvinfo {
Tao Baod7db5942015-01-28 10:07:51 -0800521 __u32 flags;
Tao Baod7db5942015-01-28 10:07:51 -0800522 __u32 hcall[4];
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800523 __u8 pad[108];
Ben Cheng655a7c02013-10-16 16:09:24 -0700524};
Ben Cheng655a7c02013-10-16 16:09:24 -0700525#define KVM_PPC_PAGE_SIZES_MAX_SZ 8
526struct kvm_ppc_one_page_size {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800527 __u32 page_shift;
Tao Baod7db5942015-01-28 10:07:51 -0800528 __u32 pte_enc;
Ben Cheng655a7c02013-10-16 16:09:24 -0700529};
530struct kvm_ppc_one_seg_page_size {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800531 __u32 page_shift;
Tao Baod7db5942015-01-28 10:07:51 -0800532 __u32 slb_enc;
533 struct kvm_ppc_one_page_size enc[KVM_PPC_PAGE_SIZES_MAX_SZ];
Ben Cheng655a7c02013-10-16 16:09:24 -0700534};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800535#define KVM_PPC_PAGE_SIZES_REAL 0x00000001
Ben Cheng655a7c02013-10-16 16:09:24 -0700536#define KVM_PPC_1T_SEGMENTS 0x00000002
Ben Cheng655a7c02013-10-16 16:09:24 -0700537struct kvm_ppc_smmu_info {
Tao Baod7db5942015-01-28 10:07:51 -0800538 __u64 flags;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800539 __u32 slb_size;
Christopher Ferris1308ad32017-11-14 17:32:13 -0800540 __u16 data_keys;
541 __u16 instr_keys;
Tao Baod7db5942015-01-28 10:07:51 -0800542 struct kvm_ppc_one_seg_page_size sps[KVM_PPC_PAGE_SIZES_MAX_SZ];
Ben Cheng655a7c02013-10-16 16:09:24 -0700543};
Christopher Ferris525ce912017-07-26 13:12:53 -0700544struct kvm_ppc_resize_hpt {
545 __u64 flags;
546 __u32 shift;
547 __u32 pad;
548};
Ben Cheng655a7c02013-10-16 16:09:24 -0700549#define KVMIO 0xAE
Ben Cheng655a7c02013-10-16 16:09:24 -0700550#define KVM_VM_S390_UCONTROL 1
Christopher Ferris38062f92014-07-09 15:33:25 -0700551#define KVM_VM_PPC_HV 1
552#define KVM_VM_PPC_PR 2
Christopher Ferris525ce912017-07-26 13:12:53 -0700553#define KVM_VM_MIPS_TE 0
554#define KVM_VM_MIPS_VZ 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700555#define KVM_S390_SIE_PAGE_OFFSET 1
556#define KVM_GET_API_VERSION _IO(KVMIO, 0x00)
557#define KVM_CREATE_VM _IO(KVMIO, 0x01)
Ben Cheng655a7c02013-10-16 16:09:24 -0700558#define KVM_GET_MSR_INDEX_LIST _IOWR(KVMIO, 0x02, struct kvm_msr_list)
559#define KVM_S390_ENABLE_SIE _IO(KVMIO, 0x06)
560#define KVM_CHECK_EXTENSION _IO(KVMIO, 0x03)
561#define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04)
Ben Cheng655a7c02013-10-16 16:09:24 -0700562#define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x05, struct kvm_cpuid2)
563#define KVM_TRACE_ENABLE __KVM_DEPRECATED_MAIN_W_0x06
564#define KVM_TRACE_PAUSE __KVM_DEPRECATED_MAIN_0x07
565#define KVM_TRACE_DISABLE __KVM_DEPRECATED_MAIN_0x08
Christopher Ferris38062f92014-07-09 15:33:25 -0700566#define KVM_GET_EMULATED_CPUID _IOWR(KVMIO, 0x09, struct kvm_cpuid2)
Ben Cheng655a7c02013-10-16 16:09:24 -0700567#define KVM_CAP_IRQCHIP 0
568#define KVM_CAP_HLT 1
569#define KVM_CAP_MMU_SHADOW_CACHE_CONTROL 2
570#define KVM_CAP_USER_MEMORY 3
Ben Cheng655a7c02013-10-16 16:09:24 -0700571#define KVM_CAP_SET_TSS_ADDR 4
572#define KVM_CAP_VAPIC 6
573#define KVM_CAP_EXT_CPUID 7
574#define KVM_CAP_CLOCKSOURCE 8
Ben Cheng655a7c02013-10-16 16:09:24 -0700575#define KVM_CAP_NR_VCPUS 9
576#define KVM_CAP_NR_MEMSLOTS 10
577#define KVM_CAP_PIT 11
578#define KVM_CAP_NOP_IO_DELAY 12
Ben Cheng655a7c02013-10-16 16:09:24 -0700579#define KVM_CAP_PV_MMU 13
580#define KVM_CAP_MP_STATE 14
581#define KVM_CAP_COALESCED_MMIO 15
582#define KVM_CAP_SYNC_MMU 16
Ben Cheng655a7c02013-10-16 16:09:24 -0700583#define KVM_CAP_IOMMU 18
Ben Cheng655a7c02013-10-16 16:09:24 -0700584#define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21
Ben Cheng655a7c02013-10-16 16:09:24 -0700585#define KVM_CAP_USER_NMI 22
Ben Cheng655a7c02013-10-16 16:09:24 -0700586#ifdef __KVM_HAVE_GUEST_DEBUG
587#define KVM_CAP_SET_GUEST_DEBUG 23
588#endif
Ben Cheng655a7c02013-10-16 16:09:24 -0700589#ifdef __KVM_HAVE_PIT
590#define KVM_CAP_REINJECT_CONTROL 24
591#endif
592#define KVM_CAP_IRQ_ROUTING 25
Ben Cheng655a7c02013-10-16 16:09:24 -0700593#define KVM_CAP_IRQ_INJECT_STATUS 26
Ben Cheng655a7c02013-10-16 16:09:24 -0700594#define KVM_CAP_ASSIGN_DEV_IRQ 29
595#define KVM_CAP_JOIN_MEMORY_REGIONS_WORKS 30
596#ifdef __KVM_HAVE_MCE
Ben Cheng655a7c02013-10-16 16:09:24 -0700597#define KVM_CAP_MCE 31
598#endif
599#define KVM_CAP_IRQFD 32
600#ifdef __KVM_HAVE_PIT
Ben Cheng655a7c02013-10-16 16:09:24 -0700601#define KVM_CAP_PIT2 33
602#endif
603#define KVM_CAP_SET_BOOT_CPU_ID 34
604#ifdef __KVM_HAVE_PIT_STATE2
Ben Cheng655a7c02013-10-16 16:09:24 -0700605#define KVM_CAP_PIT_STATE2 35
606#endif
607#define KVM_CAP_IOEVENTFD 36
608#define KVM_CAP_SET_IDENTITY_MAP_ADDR 37
Ben Cheng655a7c02013-10-16 16:09:24 -0700609#ifdef __KVM_HAVE_XEN_HVM
610#define KVM_CAP_XEN_HVM 38
611#endif
612#define KVM_CAP_ADJUST_CLOCK 39
Ben Cheng655a7c02013-10-16 16:09:24 -0700613#define KVM_CAP_INTERNAL_ERROR_DATA 40
614#ifdef __KVM_HAVE_VCPU_EVENTS
615#define KVM_CAP_VCPU_EVENTS 41
616#endif
Ben Cheng655a7c02013-10-16 16:09:24 -0700617#define KVM_CAP_S390_PSW 42
618#define KVM_CAP_PPC_SEGSTATE 43
619#define KVM_CAP_HYPERV 44
620#define KVM_CAP_HYPERV_VAPIC 45
Ben Cheng655a7c02013-10-16 16:09:24 -0700621#define KVM_CAP_HYPERV_SPIN 46
622#define KVM_CAP_PCI_SEGMENT 47
623#define KVM_CAP_PPC_PAIRED_SINGLES 48
624#define KVM_CAP_INTR_SHADOW 49
Ben Cheng655a7c02013-10-16 16:09:24 -0700625#ifdef __KVM_HAVE_DEBUGREGS
626#define KVM_CAP_DEBUGREGS 50
627#endif
628#define KVM_CAP_X86_ROBUST_SINGLESTEP 51
Ben Cheng655a7c02013-10-16 16:09:24 -0700629#define KVM_CAP_PPC_OSI 52
630#define KVM_CAP_PPC_UNSET_IRQ 53
631#define KVM_CAP_ENABLE_CAP 54
632#ifdef __KVM_HAVE_XSAVE
Ben Cheng655a7c02013-10-16 16:09:24 -0700633#define KVM_CAP_XSAVE 55
634#endif
635#ifdef __KVM_HAVE_XCRS
636#define KVM_CAP_XCRS 56
Ben Cheng655a7c02013-10-16 16:09:24 -0700637#endif
638#define KVM_CAP_PPC_GET_PVINFO 57
639#define KVM_CAP_PPC_IRQ_LEVEL 58
640#define KVM_CAP_ASYNC_PF 59
Ben Cheng655a7c02013-10-16 16:09:24 -0700641#define KVM_CAP_TSC_CONTROL 60
642#define KVM_CAP_GET_TSC_KHZ 61
643#define KVM_CAP_PPC_BOOKE_SREGS 62
644#define KVM_CAP_SPAPR_TCE 63
Ben Cheng655a7c02013-10-16 16:09:24 -0700645#define KVM_CAP_PPC_SMT 64
646#define KVM_CAP_PPC_RMA 65
647#define KVM_CAP_MAX_VCPUS 66
648#define KVM_CAP_PPC_HIOR 67
Ben Cheng655a7c02013-10-16 16:09:24 -0700649#define KVM_CAP_PPC_PAPR 68
650#define KVM_CAP_SW_TLB 69
651#define KVM_CAP_ONE_REG 70
652#define KVM_CAP_S390_GMAP 71
Ben Cheng655a7c02013-10-16 16:09:24 -0700653#define KVM_CAP_TSC_DEADLINE_TIMER 72
654#define KVM_CAP_S390_UCONTROL 73
655#define KVM_CAP_SYNC_REGS 74
656#define KVM_CAP_PCI_2_3 75
Ben Cheng655a7c02013-10-16 16:09:24 -0700657#define KVM_CAP_KVMCLOCK_CTRL 76
658#define KVM_CAP_SIGNAL_MSI 77
659#define KVM_CAP_PPC_GET_SMMU_INFO 78
660#define KVM_CAP_S390_COW 79
Christopher Ferris82d75042015-01-26 10:57:07 -0800661#define KVM_CAP_PPC_ALLOC_HTAB 80
Ben Cheng655a7c02013-10-16 16:09:24 -0700662#define KVM_CAP_READONLY_MEM 81
Ben Cheng655a7c02013-10-16 16:09:24 -0700663#define KVM_CAP_IRQFD_RESAMPLE 82
664#define KVM_CAP_PPC_BOOKE_WATCHDOG 83
665#define KVM_CAP_PPC_HTAB_FD 84
666#define KVM_CAP_S390_CSS_SUPPORT 85
Ben Cheng655a7c02013-10-16 16:09:24 -0700667#define KVM_CAP_PPC_EPR 86
668#define KVM_CAP_ARM_PSCI 87
669#define KVM_CAP_ARM_SET_DEVICE_ADDR 88
670#define KVM_CAP_DEVICE_CTRL 89
Ben Cheng655a7c02013-10-16 16:09:24 -0700671#define KVM_CAP_IRQ_MPIC 90
672#define KVM_CAP_PPC_RTAS 91
673#define KVM_CAP_IRQ_XICS 92
Christopher Ferris38062f92014-07-09 15:33:25 -0700674#define KVM_CAP_ARM_EL1_32BIT 93
675#define KVM_CAP_SPAPR_MULTITCE 94
Christopher Ferris38062f92014-07-09 15:33:25 -0700676#define KVM_CAP_EXT_EMUL_CPUID 95
677#define KVM_CAP_HYPERV_TIME 96
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700678#define KVM_CAP_IOAPIC_POLARITY_IGNORED 97
679#define KVM_CAP_ENABLE_CAP_VM 98
680#define KVM_CAP_S390_IRQCHIP 99
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700681#define KVM_CAP_IOEVENTFD_NO_LENGTH 100
682#define KVM_CAP_VM_ATTRIBUTES 101
683#define KVM_CAP_ARM_PSCI_0_2 102
684#define KVM_CAP_PPC_FIXUP_HCALL 103
Christopher Ferris82d75042015-01-26 10:57:07 -0800685#define KVM_CAP_PPC_ENABLE_HCALL 104
686#define KVM_CAP_CHECK_EXTENSION_VM 105
Christopher Ferris05d08e92016-02-04 13:16:38 -0800687#define KVM_CAP_S390_USER_SIGP 106
688#define KVM_CAP_S390_VECTOR_REGISTERS 107
Christopher Ferris05d08e92016-02-04 13:16:38 -0800689#define KVM_CAP_S390_MEM_OP 108
690#define KVM_CAP_S390_USER_STSI 109
691#define KVM_CAP_S390_SKEYS 110
692#define KVM_CAP_MIPS_FPU 111
Christopher Ferris05d08e92016-02-04 13:16:38 -0800693#define KVM_CAP_MIPS_MSA 112
694#define KVM_CAP_S390_INJECT_IRQ 113
695#define KVM_CAP_S390_IRQ_STATE 114
696#define KVM_CAP_PPC_HWRNG 115
Christopher Ferris05d08e92016-02-04 13:16:38 -0800697#define KVM_CAP_DISABLE_QUIRKS 116
698#define KVM_CAP_X86_SMM 117
699#define KVM_CAP_MULTI_ADDRESS_SPACE 118
700#define KVM_CAP_GUEST_DEBUG_HW_BPS 119
Christopher Ferris05d08e92016-02-04 13:16:38 -0800701#define KVM_CAP_GUEST_DEBUG_HW_WPS 120
702#define KVM_CAP_SPLIT_IRQCHIP 121
703#define KVM_CAP_IOEVENTFD_ANY_LENGTH 122
Christopher Ferris106b3a82016-08-24 12:15:38 -0700704#define KVM_CAP_HYPERV_SYNIC 123
705#define KVM_CAP_S390_RI 124
706#define KVM_CAP_SPAPR_TCE_64 125
Christopher Ferris106b3a82016-08-24 12:15:38 -0700707#define KVM_CAP_ARM_PMU_V3 126
708#define KVM_CAP_VCPU_ATTRIBUTES 127
709#define KVM_CAP_MAX_VCPU_ID 128
Christopher Ferris49f525c2016-12-12 14:55:36 -0800710#define KVM_CAP_X2APIC_API 129
Christopher Ferris49f525c2016-12-12 14:55:36 -0800711#define KVM_CAP_S390_USER_INSTR0 130
712#define KVM_CAP_MSI_DEVID 131
713#define KVM_CAP_PPC_HTM 132
Christopher Ferris525ce912017-07-26 13:12:53 -0700714#define KVM_CAP_SPAPR_RESIZE_HPT 133
715#define KVM_CAP_PPC_MMU_RADIX 134
716#define KVM_CAP_PPC_MMU_HASH_V3 135
717#define KVM_CAP_IMMEDIATE_EXIT 136
718#define KVM_CAP_MIPS_VZ 137
719#define KVM_CAP_MIPS_TE 138
720#define KVM_CAP_MIPS_64BIT 139
721#define KVM_CAP_S390_GS 140
722#define KVM_CAP_S390_AIS 141
723#define KVM_CAP_SPAPR_TCE_VFIO 142
724#define KVM_CAP_X86_GUEST_MWAIT 143
725#define KVM_CAP_ARM_USER_IRQ 144
Christopher Ferris1308ad32017-11-14 17:32:13 -0800726#define KVM_CAP_S390_CMMA_MIGRATION 145
727#define KVM_CAP_PPC_FWNMI 146
728#define KVM_CAP_PPC_SMT_POSSIBLE 147
729#define KVM_CAP_HYPERV_SYNIC2 148
730#define KVM_CAP_HYPERV_VP_INDEX 149
Christopher Ferris05d08e92016-02-04 13:16:38 -0800731#ifdef KVM_CAP_IRQ_ROUTING
Christopher Ferris05d08e92016-02-04 13:16:38 -0800732struct kvm_irq_routing_irqchip {
Tao Baod7db5942015-01-28 10:07:51 -0800733 __u32 irqchip;
734 __u32 pin;
Ben Cheng655a7c02013-10-16 16:09:24 -0700735};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800736struct kvm_irq_routing_msi {
Tao Baod7db5942015-01-28 10:07:51 -0800737 __u32 address_lo;
738 __u32 address_hi;
739 __u32 data;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800740 union {
741 __u32 pad;
742 __u32 devid;
743 };
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700744};
745struct kvm_irq_routing_s390_adapter {
Tao Baod7db5942015-01-28 10:07:51 -0800746 __u64 ind_addr;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800747 __u64 summary_addr;
Tao Baod7db5942015-01-28 10:07:51 -0800748 __u64 ind_offset;
749 __u32 summary_offset;
750 __u32 adapter_id;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800751};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700752struct kvm_irq_routing_hv_sint {
753 __u32 vcpu;
754 __u32 sint;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700755};
Ben Cheng655a7c02013-10-16 16:09:24 -0700756#define KVM_IRQ_ROUTING_IRQCHIP 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700757#define KVM_IRQ_ROUTING_MSI 2
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700758#define KVM_IRQ_ROUTING_S390_ADAPTER 3
Christopher Ferris106b3a82016-08-24 12:15:38 -0700759#define KVM_IRQ_ROUTING_HV_SINT 4
Christopher Ferris05d08e92016-02-04 13:16:38 -0800760struct kvm_irq_routing_entry {
Tao Baod7db5942015-01-28 10:07:51 -0800761 __u32 gsi;
762 __u32 type;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700763 __u32 flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800764 __u32 pad;
Tao Baod7db5942015-01-28 10:07:51 -0800765 union {
766 struct kvm_irq_routing_irqchip irqchip;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700767 struct kvm_irq_routing_msi msi;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800768 struct kvm_irq_routing_s390_adapter adapter;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700769 struct kvm_irq_routing_hv_sint hv_sint;
Tao Baod7db5942015-01-28 10:07:51 -0800770 __u32 pad[8];
771 } u;
Ben Cheng655a7c02013-10-16 16:09:24 -0700772};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800773struct kvm_irq_routing {
Tao Baod7db5942015-01-28 10:07:51 -0800774 __u32 nr;
775 __u32 flags;
776 struct kvm_irq_routing_entry entries[0];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800777};
Ben Cheng655a7c02013-10-16 16:09:24 -0700778#endif
779#ifdef KVM_CAP_MCE
780struct kvm_x86_mce {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800781 __u64 status;
Tao Baod7db5942015-01-28 10:07:51 -0800782 __u64 addr;
783 __u64 misc;
784 __u64 mcg_status;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800785 __u8 bank;
Tao Baod7db5942015-01-28 10:07:51 -0800786 __u8 pad1[7];
787 __u64 pad2[3];
Ben Cheng655a7c02013-10-16 16:09:24 -0700788};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800789#endif
Ben Cheng655a7c02013-10-16 16:09:24 -0700790#ifdef KVM_CAP_XEN_HVM
791struct kvm_xen_hvm_config {
Tao Baod7db5942015-01-28 10:07:51 -0800792 __u32 flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800793 __u32 msr;
Tao Baod7db5942015-01-28 10:07:51 -0800794 __u64 blob_addr_32;
795 __u64 blob_addr_64;
796 __u8 blob_size_32;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800797 __u8 blob_size_64;
Tao Baod7db5942015-01-28 10:07:51 -0800798 __u8 pad2[30];
Ben Cheng655a7c02013-10-16 16:09:24 -0700799};
800#endif
Christopher Ferris05d08e92016-02-04 13:16:38 -0800801#define KVM_IRQFD_FLAG_DEASSIGN (1 << 0)
Ben Cheng655a7c02013-10-16 16:09:24 -0700802#define KVM_IRQFD_FLAG_RESAMPLE (1 << 1)
803struct kvm_irqfd {
Tao Baod7db5942015-01-28 10:07:51 -0800804 __u32 fd;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800805 __u32 gsi;
Tao Baod7db5942015-01-28 10:07:51 -0800806 __u32 flags;
807 __u32 resamplefd;
808 __u8 pad[16];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800809};
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800810#define KVM_CLOCK_TSC_STABLE 2
Ben Cheng655a7c02013-10-16 16:09:24 -0700811struct kvm_clock_data {
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800812 __u64 clock;
Tao Baod7db5942015-01-28 10:07:51 -0800813 __u32 flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800814 __u32 pad[9];
Ben Cheng655a7c02013-10-16 16:09:24 -0700815};
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800816#define KVM_MMU_FSL_BOOKE_NOHV 0
Ben Cheng655a7c02013-10-16 16:09:24 -0700817#define KVM_MMU_FSL_BOOKE_HV 1
Christopher Ferris05d08e92016-02-04 13:16:38 -0800818struct kvm_config_tlb {
Tao Baod7db5942015-01-28 10:07:51 -0800819 __u64 params;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800820 __u64 array;
Tao Baod7db5942015-01-28 10:07:51 -0800821 __u32 mmu_type;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800822 __u32 array_len;
Ben Cheng655a7c02013-10-16 16:09:24 -0700823};
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800824struct kvm_dirty_tlb {
Tao Baod7db5942015-01-28 10:07:51 -0800825 __u64 bitmap;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800826 __u32 num_dirty;
Ben Cheng655a7c02013-10-16 16:09:24 -0700827};
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800828#define KVM_REG_ARCH_MASK 0xff00000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -0700829#define KVM_REG_GENERIC 0x0000000000000000ULL
Christopher Ferris05d08e92016-02-04 13:16:38 -0800830#define KVM_REG_PPC 0x1000000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -0700831#define KVM_REG_X86 0x2000000000000000ULL
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800832#define KVM_REG_IA64 0x3000000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -0700833#define KVM_REG_ARM 0x4000000000000000ULL
Christopher Ferris05d08e92016-02-04 13:16:38 -0800834#define KVM_REG_S390 0x5000000000000000ULL
Christopher Ferris38062f92014-07-09 15:33:25 -0700835#define KVM_REG_ARM64 0x6000000000000000ULL
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800836#define KVM_REG_MIPS 0x7000000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -0700837#define KVM_REG_SIZE_SHIFT 52
Christopher Ferris05d08e92016-02-04 13:16:38 -0800838#define KVM_REG_SIZE_MASK 0x00f0000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -0700839#define KVM_REG_SIZE_U8 0x0000000000000000ULL
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800840#define KVM_REG_SIZE_U16 0x0010000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -0700841#define KVM_REG_SIZE_U32 0x0020000000000000ULL
Christopher Ferris05d08e92016-02-04 13:16:38 -0800842#define KVM_REG_SIZE_U64 0x0030000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -0700843#define KVM_REG_SIZE_U128 0x0040000000000000ULL
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800844#define KVM_REG_SIZE_U256 0x0050000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -0700845#define KVM_REG_SIZE_U512 0x0060000000000000ULL
Christopher Ferris05d08e92016-02-04 13:16:38 -0800846#define KVM_REG_SIZE_U1024 0x0070000000000000ULL
Ben Cheng655a7c02013-10-16 16:09:24 -0700847struct kvm_reg_list {
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800848 __u64 n;
Tao Baod7db5942015-01-28 10:07:51 -0800849 __u64 reg[0];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800850};
Ben Cheng655a7c02013-10-16 16:09:24 -0700851struct kvm_one_reg {
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800852 __u64 id;
Tao Baod7db5942015-01-28 10:07:51 -0800853 __u64 addr;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800854};
Christopher Ferris49f525c2016-12-12 14:55:36 -0800855#define KVM_MSI_VALID_DEVID (1U << 0)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800856struct kvm_msi {
Tao Baod7db5942015-01-28 10:07:51 -0800857 __u32 address_lo;
858 __u32 address_hi;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800859 __u32 data;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800860 __u32 flags;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800861 __u32 devid;
862 __u8 pad[12];
Ben Cheng655a7c02013-10-16 16:09:24 -0700863};
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800864struct kvm_arm_device_addr {
Christopher Ferris49f525c2016-12-12 14:55:36 -0800865 __u64 id;
Tao Baod7db5942015-01-28 10:07:51 -0800866 __u64 addr;
Ben Cheng655a7c02013-10-16 16:09:24 -0700867};
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800868#define KVM_CREATE_DEVICE_TEST 1
Christopher Ferris49f525c2016-12-12 14:55:36 -0800869struct kvm_create_device {
Tao Baod7db5942015-01-28 10:07:51 -0800870 __u32 type;
871 __u32 fd;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800872 __u32 flags;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800873};
Ben Cheng655a7c02013-10-16 16:09:24 -0700874struct kvm_device_attr {
Tao Baod7db5942015-01-28 10:07:51 -0800875 __u32 flags;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800876 __u32 group;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800877 __u64 attr;
Tao Baod7db5942015-01-28 10:07:51 -0800878 __u64 addr;
Ben Cheng655a7c02013-10-16 16:09:24 -0700879};
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800880#define KVM_DEV_VFIO_GROUP 1
Christopher Ferris49f525c2016-12-12 14:55:36 -0800881#define KVM_DEV_VFIO_GROUP_ADD 1
Christopher Ferris38062f92014-07-09 15:33:25 -0700882#define KVM_DEV_VFIO_GROUP_DEL 2
Christopher Ferris525ce912017-07-26 13:12:53 -0700883#define KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE 3
Christopher Ferris82d75042015-01-26 10:57:07 -0800884enum kvm_device_type {
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800885 KVM_DEV_TYPE_FSL_MPIC_20 = 1,
Christopher Ferris49f525c2016-12-12 14:55:36 -0800886#define KVM_DEV_TYPE_FSL_MPIC_20 KVM_DEV_TYPE_FSL_MPIC_20
Tao Baod7db5942015-01-28 10:07:51 -0800887 KVM_DEV_TYPE_FSL_MPIC_42,
Christopher Ferris82d75042015-01-26 10:57:07 -0800888#define KVM_DEV_TYPE_FSL_MPIC_42 KVM_DEV_TYPE_FSL_MPIC_42
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800889 KVM_DEV_TYPE_XICS,
Christopher Ferris49f525c2016-12-12 14:55:36 -0800890#define KVM_DEV_TYPE_XICS KVM_DEV_TYPE_XICS
Tao Baod7db5942015-01-28 10:07:51 -0800891 KVM_DEV_TYPE_VFIO,
Christopher Ferris82d75042015-01-26 10:57:07 -0800892#define KVM_DEV_TYPE_VFIO KVM_DEV_TYPE_VFIO
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800893 KVM_DEV_TYPE_ARM_VGIC_V2,
Christopher Ferris49f525c2016-12-12 14:55:36 -0800894#define KVM_DEV_TYPE_ARM_VGIC_V2 KVM_DEV_TYPE_ARM_VGIC_V2
Tao Baod7db5942015-01-28 10:07:51 -0800895 KVM_DEV_TYPE_FLIC,
Christopher Ferris82d75042015-01-26 10:57:07 -0800896#define KVM_DEV_TYPE_FLIC KVM_DEV_TYPE_FLIC
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800897 KVM_DEV_TYPE_ARM_VGIC_V3,
Christopher Ferris49f525c2016-12-12 14:55:36 -0800898#define KVM_DEV_TYPE_ARM_VGIC_V3 KVM_DEV_TYPE_ARM_VGIC_V3
899 KVM_DEV_TYPE_ARM_VGIC_ITS,
900#define KVM_DEV_TYPE_ARM_VGIC_ITS KVM_DEV_TYPE_ARM_VGIC_ITS
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800901 KVM_DEV_TYPE_MAX,
Christopher Ferris82d75042015-01-26 10:57:07 -0800902};
Christopher Ferris525ce912017-07-26 13:12:53 -0700903struct kvm_vfio_spapr_tce {
904 __s32 groupfd;
905 __s32 tablefd;
906};
Ben Cheng655a7c02013-10-16 16:09:24 -0700907#define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region)
Ben Cheng655a7c02013-10-16 16:09:24 -0700908#define KVM_CREATE_VCPU _IO(KVMIO, 0x41)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800909#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log)
Ben Cheng655a7c02013-10-16 16:09:24 -0700910#define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias)
911#define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44)
Ben Cheng655a7c02013-10-16 16:09:24 -0700912#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800913#define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46, struct kvm_userspace_memory_region)
Ben Cheng655a7c02013-10-16 16:09:24 -0700914#define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47)
915#define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64)
Ben Cheng655a7c02013-10-16 16:09:24 -0700916struct kvm_s390_ucas_mapping {
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800917 __u64 user_addr;
Tao Baod7db5942015-01-28 10:07:51 -0800918 __u64 vcpu_addr;
919 __u64 length;
Ben Cheng655a7c02013-10-16 16:09:24 -0700920};
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800921#define KVM_S390_UCAS_MAP _IOW(KVMIO, 0x50, struct kvm_s390_ucas_mapping)
Ben Cheng655a7c02013-10-16 16:09:24 -0700922#define KVM_S390_UCAS_UNMAP _IOW(KVMIO, 0x51, struct kvm_s390_ucas_mapping)
923#define KVM_S390_VCPU_FAULT _IOW(KVMIO, 0x52, unsigned long)
Ben Cheng655a7c02013-10-16 16:09:24 -0700924#define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800925#define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level)
Ben Cheng655a7c02013-10-16 16:09:24 -0700926#define KVM_GET_IRQCHIP _IOWR(KVMIO, 0x62, struct kvm_irqchip)
927#define KVM_SET_IRQCHIP _IOR(KVMIO, 0x63, struct kvm_irqchip)
Ben Cheng655a7c02013-10-16 16:09:24 -0700928#define KVM_CREATE_PIT _IO(KVMIO, 0x64)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800929#define KVM_GET_PIT _IOWR(KVMIO, 0x65, struct kvm_pit_state)
Ben Cheng655a7c02013-10-16 16:09:24 -0700930#define KVM_SET_PIT _IOR(KVMIO, 0x66, struct kvm_pit_state)
931#define KVM_IRQ_LINE_STATUS _IOWR(KVMIO, 0x67, struct kvm_irq_level)
Tao Baod7db5942015-01-28 10:07:51 -0800932#define KVM_REGISTER_COALESCED_MMIO _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800933#define KVM_UNREGISTER_COALESCED_MMIO _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone)
Tao Baod7db5942015-01-28 10:07:51 -0800934#define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, struct kvm_assigned_pci_dev)
Ben Cheng655a7c02013-10-16 16:09:24 -0700935#define KVM_SET_GSI_ROUTING _IOW(KVMIO, 0x6a, struct kvm_irq_routing)
Ben Cheng655a7c02013-10-16 16:09:24 -0700936#define KVM_ASSIGN_IRQ __KVM_DEPRECATED_VM_R_0x70
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800937#define KVM_ASSIGN_DEV_IRQ _IOW(KVMIO, 0x70, struct kvm_assigned_irq)
Ben Cheng655a7c02013-10-16 16:09:24 -0700938#define KVM_REINJECT_CONTROL _IO(KVMIO, 0x71)
Tao Baod7db5942015-01-28 10:07:51 -0800939#define KVM_DEASSIGN_PCI_DEVICE _IOW(KVMIO, 0x72, struct kvm_assigned_pci_dev)
940#define KVM_ASSIGN_SET_MSIX_NR _IOW(KVMIO, 0x73, struct kvm_assigned_msix_nr)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800941#define KVM_ASSIGN_SET_MSIX_ENTRY _IOW(KVMIO, 0x74, struct kvm_assigned_msix_entry)
Ben Cheng655a7c02013-10-16 16:09:24 -0700942#define KVM_DEASSIGN_DEV_IRQ _IOW(KVMIO, 0x75, struct kvm_assigned_irq)
943#define KVM_IRQFD _IOW(KVMIO, 0x76, struct kvm_irqfd)
Ben Cheng655a7c02013-10-16 16:09:24 -0700944#define KVM_CREATE_PIT2 _IOW(KVMIO, 0x77, struct kvm_pit_config)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800945#define KVM_SET_BOOT_CPU_ID _IO(KVMIO, 0x78)
Ben Cheng655a7c02013-10-16 16:09:24 -0700946#define KVM_IOEVENTFD _IOW(KVMIO, 0x79, struct kvm_ioeventfd)
947#define KVM_XEN_HVM_CONFIG _IOW(KVMIO, 0x7a, struct kvm_xen_hvm_config)
Ben Cheng655a7c02013-10-16 16:09:24 -0700948#define KVM_SET_CLOCK _IOW(KVMIO, 0x7b, struct kvm_clock_data)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800949#define KVM_GET_CLOCK _IOR(KVMIO, 0x7c, struct kvm_clock_data)
Ben Cheng655a7c02013-10-16 16:09:24 -0700950#define KVM_GET_PIT2 _IOR(KVMIO, 0x9f, struct kvm_pit_state2)
951#define KVM_SET_PIT2 _IOW(KVMIO, 0xa0, struct kvm_pit_state2)
Ben Cheng655a7c02013-10-16 16:09:24 -0700952#define KVM_PPC_GET_PVINFO _IOW(KVMIO, 0xa1, struct kvm_ppc_pvinfo)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800953#define KVM_SET_TSC_KHZ _IO(KVMIO, 0xa2)
Ben Cheng655a7c02013-10-16 16:09:24 -0700954#define KVM_GET_TSC_KHZ _IO(KVMIO, 0xa3)
Tao Baod7db5942015-01-28 10:07:51 -0800955#define KVM_ASSIGN_SET_INTX_MASK _IOW(KVMIO, 0xa4, struct kvm_assigned_pci_dev)
Ben Cheng655a7c02013-10-16 16:09:24 -0700956#define KVM_SIGNAL_MSI _IOW(KVMIO, 0xa5, struct kvm_msi)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800957#define KVM_PPC_GET_SMMU_INFO _IOR(KVMIO, 0xa6, struct kvm_ppc_smmu_info)
Ben Cheng655a7c02013-10-16 16:09:24 -0700958#define KVM_PPC_ALLOCATE_HTAB _IOWR(KVMIO, 0xa7, __u32)
959#define KVM_CREATE_SPAPR_TCE _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700960#define KVM_CREATE_SPAPR_TCE_64 _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce_64)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800961#define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma)
Christopher Ferris38062f92014-07-09 15:33:25 -0700962#define KVM_PPC_GET_HTAB_FD _IOW(KVMIO, 0xaa, struct kvm_get_htab_fd)
Ben Cheng655a7c02013-10-16 16:09:24 -0700963#define KVM_ARM_SET_DEVICE_ADDR _IOW(KVMIO, 0xab, struct kvm_arm_device_addr)
964#define KVM_PPC_RTAS_DEFINE_TOKEN _IOW(KVMIO, 0xac, struct kvm_rtas_token_args)
Christopher Ferris525ce912017-07-26 13:12:53 -0700965#define KVM_PPC_RESIZE_HPT_PREPARE _IOR(KVMIO, 0xad, struct kvm_ppc_resize_hpt)
966#define KVM_PPC_RESIZE_HPT_COMMIT _IOR(KVMIO, 0xae, struct kvm_ppc_resize_hpt)
967#define KVM_PPC_CONFIGURE_V3_MMU _IOW(KVMIO, 0xaf, struct kvm_ppc_mmuv3_cfg)
968#define KVM_PPC_GET_RMMU_INFO _IOW(KVMIO, 0xb0, struct kvm_ppc_rmmu_info)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800969#define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device)
Christopher Ferris38062f92014-07-09 15:33:25 -0700970#define KVM_SET_DEVICE_ATTR _IOW(KVMIO, 0xe1, struct kvm_device_attr)
Ben Cheng655a7c02013-10-16 16:09:24 -0700971#define KVM_GET_DEVICE_ATTR _IOW(KVMIO, 0xe2, struct kvm_device_attr)
972#define KVM_HAS_DEVICE_ATTR _IOW(KVMIO, 0xe3, struct kvm_device_attr)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800973#define KVM_RUN _IO(KVMIO, 0x80)
Christopher Ferris38062f92014-07-09 15:33:25 -0700974#define KVM_GET_REGS _IOR(KVMIO, 0x81, struct kvm_regs)
Ben Cheng655a7c02013-10-16 16:09:24 -0700975#define KVM_SET_REGS _IOW(KVMIO, 0x82, struct kvm_regs)
976#define KVM_GET_SREGS _IOR(KVMIO, 0x83, struct kvm_sregs)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800977#define KVM_SET_SREGS _IOW(KVMIO, 0x84, struct kvm_sregs)
Christopher Ferris38062f92014-07-09 15:33:25 -0700978#define KVM_TRANSLATE _IOWR(KVMIO, 0x85, struct kvm_translation)
Ben Cheng655a7c02013-10-16 16:09:24 -0700979#define KVM_INTERRUPT _IOW(KVMIO, 0x86, struct kvm_interrupt)
980#define KVM_DEBUG_GUEST __KVM_DEPRECATED_VCPU_W_0x87
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800981#define KVM_GET_MSRS _IOWR(KVMIO, 0x88, struct kvm_msrs)
Christopher Ferris38062f92014-07-09 15:33:25 -0700982#define KVM_SET_MSRS _IOW(KVMIO, 0x89, struct kvm_msrs)
Ben Cheng655a7c02013-10-16 16:09:24 -0700983#define KVM_SET_CPUID _IOW(KVMIO, 0x8a, struct kvm_cpuid)
984#define KVM_SET_SIGNAL_MASK _IOW(KVMIO, 0x8b, struct kvm_signal_mask)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800985#define KVM_GET_FPU _IOR(KVMIO, 0x8c, struct kvm_fpu)
Christopher Ferris38062f92014-07-09 15:33:25 -0700986#define KVM_SET_FPU _IOW(KVMIO, 0x8d, struct kvm_fpu)
Ben Cheng655a7c02013-10-16 16:09:24 -0700987#define KVM_GET_LAPIC _IOR(KVMIO, 0x8e, struct kvm_lapic_state)
988#define KVM_SET_LAPIC _IOW(KVMIO, 0x8f, struct kvm_lapic_state)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800989#define KVM_SET_CPUID2 _IOW(KVMIO, 0x90, struct kvm_cpuid2)
Christopher Ferris38062f92014-07-09 15:33:25 -0700990#define KVM_GET_CPUID2 _IOWR(KVMIO, 0x91, struct kvm_cpuid2)
Ben Cheng655a7c02013-10-16 16:09:24 -0700991#define KVM_TPR_ACCESS_REPORTING _IOWR(KVMIO, 0x92, struct kvm_tpr_access_ctl)
992#define KVM_SET_VAPIC_ADDR _IOW(KVMIO, 0x93, struct kvm_vapic_addr)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800993#define KVM_S390_INTERRUPT _IOW(KVMIO, 0x94, struct kvm_s390_interrupt)
Tao Baod7db5942015-01-28 10:07:51 -0800994#define KVM_S390_STORE_STATUS_NOADDR (- 1ul)
Tao Baod7db5942015-01-28 10:07:51 -0800995#define KVM_S390_STORE_STATUS_PREFIXED (- 2ul)
Ben Cheng655a7c02013-10-16 16:09:24 -0700996#define KVM_S390_STORE_STATUS _IOW(KVMIO, 0x95, unsigned long)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800997#define KVM_S390_SET_INITIAL_PSW _IOW(KVMIO, 0x96, struct kvm_s390_psw)
Christopher Ferris38062f92014-07-09 15:33:25 -0700998#define KVM_S390_INITIAL_RESET _IO(KVMIO, 0x97)
Ben Cheng655a7c02013-10-16 16:09:24 -0700999#define KVM_GET_MP_STATE _IOR(KVMIO, 0x98, struct kvm_mp_state)
1000#define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001001#define KVM_NMI _IO(KVMIO, 0x9a)
Christopher Ferris38062f92014-07-09 15:33:25 -07001002#define KVM_SET_GUEST_DEBUG _IOW(KVMIO, 0x9b, struct kvm_guest_debug)
Ben Cheng655a7c02013-10-16 16:09:24 -07001003#define KVM_X86_SETUP_MCE _IOW(KVMIO, 0x9c, __u64)
1004#define KVM_X86_GET_MCE_CAP_SUPPORTED _IOR(KVMIO, 0x9d, __u64)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001005#define KVM_X86_SET_MCE _IOW(KVMIO, 0x9e, struct kvm_x86_mce)
Ben Cheng655a7c02013-10-16 16:09:24 -07001006#define KVM_GET_VCPU_EVENTS _IOR(KVMIO, 0x9f, struct kvm_vcpu_events)
Ben Cheng655a7c02013-10-16 16:09:24 -07001007#define KVM_SET_VCPU_EVENTS _IOW(KVMIO, 0xa0, struct kvm_vcpu_events)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001008#define KVM_GET_DEBUGREGS _IOR(KVMIO, 0xa1, struct kvm_debugregs)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001009#define KVM_SET_DEBUGREGS _IOW(KVMIO, 0xa2, struct kvm_debugregs)
Ben Cheng655a7c02013-10-16 16:09:24 -07001010#define KVM_ENABLE_CAP _IOW(KVMIO, 0xa3, struct kvm_enable_cap)
Ben Cheng655a7c02013-10-16 16:09:24 -07001011#define KVM_GET_XSAVE _IOR(KVMIO, 0xa4, struct kvm_xsave)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001012#define KVM_SET_XSAVE _IOW(KVMIO, 0xa5, struct kvm_xsave)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001013#define KVM_GET_XCRS _IOR(KVMIO, 0xa6, struct kvm_xcrs)
Ben Cheng655a7c02013-10-16 16:09:24 -07001014#define KVM_SET_XCRS _IOW(KVMIO, 0xa7, struct kvm_xcrs)
Ben Cheng655a7c02013-10-16 16:09:24 -07001015#define KVM_DIRTY_TLB _IOW(KVMIO, 0xaa, struct kvm_dirty_tlb)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001016#define KVM_GET_ONE_REG _IOW(KVMIO, 0xab, struct kvm_one_reg)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001017#define KVM_SET_ONE_REG _IOW(KVMIO, 0xac, struct kvm_one_reg)
Ben Cheng655a7c02013-10-16 16:09:24 -07001018#define KVM_KVMCLOCK_CTRL _IO(KVMIO, 0xad)
Ben Cheng655a7c02013-10-16 16:09:24 -07001019#define KVM_ARM_VCPU_INIT _IOW(KVMIO, 0xae, struct kvm_vcpu_init)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001020#define KVM_ARM_PREFERRED_TARGET _IOR(KVMIO, 0xaf, struct kvm_vcpu_init)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001021#define KVM_GET_REG_LIST _IOWR(KVMIO, 0xb0, struct kvm_reg_list)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001022#define KVM_S390_MEM_OP _IOW(KVMIO, 0xb1, struct kvm_s390_mem_op)
1023#define KVM_S390_GET_SKEYS _IOW(KVMIO, 0xb2, struct kvm_s390_skeys)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001024#define KVM_S390_SET_SKEYS _IOW(KVMIO, 0xb3, struct kvm_s390_skeys)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001025#define KVM_S390_IRQ _IOW(KVMIO, 0xb4, struct kvm_s390_irq)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001026#define KVM_S390_SET_IRQ_STATE _IOW(KVMIO, 0xb5, struct kvm_s390_irq_state)
1027#define KVM_S390_GET_IRQ_STATE _IOW(KVMIO, 0xb6, struct kvm_s390_irq_state)
Christopher Ferris05d08e92016-02-04 13:16:38 -08001028#define KVM_SMI _IO(KVMIO, 0xb7)
Christopher Ferris1308ad32017-11-14 17:32:13 -08001029#define KVM_S390_GET_CMMA_BITS _IOWR(KVMIO, 0xb8, struct kvm_s390_cmma_log)
1030#define KVM_S390_SET_CMMA_BITS _IOW(KVMIO, 0xb9, struct kvm_s390_cmma_log)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001031#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
Ben Cheng655a7c02013-10-16 16:09:24 -07001032#define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1)
Ben Cheng655a7c02013-10-16 16:09:24 -07001033#define KVM_DEV_ASSIGN_MASK_INTX (1 << 2)
1034struct kvm_assigned_pci_dev {
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001035 __u32 assigned_dev_id;
Tao Baod7db5942015-01-28 10:07:51 -08001036 __u32 busnr;
1037 __u32 devfn;
Tao Baod7db5942015-01-28 10:07:51 -08001038 __u32 flags;
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001039 __u32 segnr;
Tao Baod7db5942015-01-28 10:07:51 -08001040 union {
1041 __u32 reserved[11];
Tao Baod7db5942015-01-28 10:07:51 -08001042 };
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001043};
Ben Cheng655a7c02013-10-16 16:09:24 -07001044#define KVM_DEV_IRQ_HOST_INTX (1 << 0)
Ben Cheng655a7c02013-10-16 16:09:24 -07001045#define KVM_DEV_IRQ_HOST_MSI (1 << 1)
1046#define KVM_DEV_IRQ_HOST_MSIX (1 << 2)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001047#define KVM_DEV_IRQ_GUEST_INTX (1 << 8)
Ben Cheng655a7c02013-10-16 16:09:24 -07001048#define KVM_DEV_IRQ_GUEST_MSI (1 << 9)
Ben Cheng655a7c02013-10-16 16:09:24 -07001049#define KVM_DEV_IRQ_GUEST_MSIX (1 << 10)
1050#define KVM_DEV_IRQ_HOST_MASK 0x00ff
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001051#define KVM_DEV_IRQ_GUEST_MASK 0xff00
Ben Cheng655a7c02013-10-16 16:09:24 -07001052struct kvm_assigned_irq {
Tao Baod7db5942015-01-28 10:07:51 -08001053 __u32 assigned_dev_id;
Tao Baod7db5942015-01-28 10:07:51 -08001054 __u32 host_irq;
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001055 __u32 guest_irq;
Tao Baod7db5942015-01-28 10:07:51 -08001056 __u32 flags;
1057 union {
Tao Baod7db5942015-01-28 10:07:51 -08001058 __u32 reserved[12];
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001059 };
Ben Cheng655a7c02013-10-16 16:09:24 -07001060};
Ben Cheng655a7c02013-10-16 16:09:24 -07001061struct kvm_assigned_msix_nr {
Tao Baod7db5942015-01-28 10:07:51 -08001062 __u32 assigned_dev_id;
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001063 __u16 entry_nr;
Tao Baod7db5942015-01-28 10:07:51 -08001064 __u16 padding;
Ben Cheng655a7c02013-10-16 16:09:24 -07001065};
1066#define KVM_MAX_MSIX_PER_DEV 256
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001067struct kvm_assigned_msix_entry {
Tao Baod7db5942015-01-28 10:07:51 -08001068 __u32 assigned_dev_id;
1069 __u32 gsi;
Tao Baod7db5942015-01-28 10:07:51 -08001070 __u16 entry;
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001071 __u16 padding[3];
Ben Cheng655a7c02013-10-16 16:09:24 -07001072};
Christopher Ferris49f525c2016-12-12 14:55:36 -08001073#define KVM_X2APIC_API_USE_32BIT_IDS (1ULL << 0)
1074#define KVM_X2APIC_API_DISABLE_BROADCAST_QUIRK (1ULL << 1)
Christopher Ferris525ce912017-07-26 13:12:53 -07001075#define KVM_ARM_DEV_EL1_VTIMER (1 << 0)
1076#define KVM_ARM_DEV_EL1_PTIMER (1 << 1)
1077#define KVM_ARM_DEV_PMU (1 << 2)
Christopher Ferris6a9755d2017-01-13 14:09:31 -08001078#endif