blob: 75680ee48c07500f37d8a83265e1020e575d36cd [file] [log] [blame]
Elliott Hughesabd62612013-11-08 11:45:48 -08001/****************************************************************************
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 _ASM_X86_KVM_H
20#define _ASM_X86_KVM_H
21#include <linux/types.h>
22#include <linux/ioctl.h>
Elliott Hughesabd62612013-11-08 11:45:48 -080023#define DE_VECTOR 0
24#define DB_VECTOR 1
25#define BP_VECTOR 3
26#define OF_VECTOR 4
Elliott Hughesabd62612013-11-08 11:45:48 -080027#define BR_VECTOR 5
28#define UD_VECTOR 6
29#define NM_VECTOR 7
30#define DF_VECTOR 8
Elliott Hughesabd62612013-11-08 11:45:48 -080031#define TS_VECTOR 10
32#define NP_VECTOR 11
33#define SS_VECTOR 12
34#define GP_VECTOR 13
Elliott Hughesabd62612013-11-08 11:45:48 -080035#define PF_VECTOR 14
36#define MF_VECTOR 16
Christopher Ferris82d75042015-01-26 10:57:07 -080037#define AC_VECTOR 17
Elliott Hughesabd62612013-11-08 11:45:48 -080038#define MC_VECTOR 18
Christopher Ferris82d75042015-01-26 10:57:07 -080039#define XM_VECTOR 19
40#define VE_VECTOR 20
41#define __KVM_HAVE_PIT
Elliott Hughesabd62612013-11-08 11:45:48 -080042#define __KVM_HAVE_IOAPIC
43#define __KVM_HAVE_IRQ_LINE
44#define __KVM_HAVE_MSI
45#define __KVM_HAVE_USER_NMI
Elliott Hughesabd62612013-11-08 11:45:48 -080046#define __KVM_HAVE_GUEST_DEBUG
47#define __KVM_HAVE_MSIX
48#define __KVM_HAVE_MCE
49#define __KVM_HAVE_PIT_STATE2
Elliott Hughesabd62612013-11-08 11:45:48 -080050#define __KVM_HAVE_XEN_HVM
51#define __KVM_HAVE_VCPU_EVENTS
52#define __KVM_HAVE_DEBUGREGS
53#define __KVM_HAVE_XSAVE
Elliott Hughesabd62612013-11-08 11:45:48 -080054#define __KVM_HAVE_XCRS
55#define __KVM_HAVE_READONLY_MEM
56#define KVM_NR_INTERRUPTS 256
57struct kvm_memory_alias {
Tao Baod7db5942015-01-28 10:07:51 -080058 __u32 slot;
Tao Baod7db5942015-01-28 10:07:51 -080059 __u32 flags;
60 __u64 guest_phys_addr;
61 __u64 memory_size;
62 __u64 target_phys_addr;
Elliott Hughesabd62612013-11-08 11:45:48 -080063};
64struct kvm_pic_state {
Tao Baod7db5942015-01-28 10:07:51 -080065 __u8 last_irr;
66 __u8 irr;
Tao Baod7db5942015-01-28 10:07:51 -080067 __u8 imr;
68 __u8 isr;
69 __u8 priority_add;
70 __u8 irq_base;
Tao Baod7db5942015-01-28 10:07:51 -080071 __u8 read_reg_select;
72 __u8 poll;
73 __u8 special_mask;
74 __u8 init_state;
Tao Baod7db5942015-01-28 10:07:51 -080075 __u8 auto_eoi;
76 __u8 rotate_on_auto_eoi;
77 __u8 special_fully_nested_mode;
78 __u8 init4;
Tao Baod7db5942015-01-28 10:07:51 -080079 __u8 elcr;
80 __u8 elcr_mask;
Elliott Hughesabd62612013-11-08 11:45:48 -080081};
Elliott Hughesabd62612013-11-08 11:45:48 -080082#define KVM_IOAPIC_NUM_PINS 24
83struct kvm_ioapic_state {
Tao Baod7db5942015-01-28 10:07:51 -080084 __u64 base_address;
85 __u32 ioregsel;
86 __u32 id;
Tao Baod7db5942015-01-28 10:07:51 -080087 __u32 irr;
88 __u32 pad;
89 union {
90 __u64 bits;
Tao Baod7db5942015-01-28 10:07:51 -080091 struct {
92 __u8 vector;
93 __u8 delivery_mode : 3;
94 __u8 dest_mode : 1;
Tao Baod7db5942015-01-28 10:07:51 -080095 __u8 delivery_status : 1;
96 __u8 polarity : 1;
97 __u8 remote_irr : 1;
98 __u8 trig_mode : 1;
Tao Baod7db5942015-01-28 10:07:51 -080099 __u8 mask : 1;
100 __u8 reserve : 7;
101 __u8 reserved[4];
102 __u8 dest_id;
Tao Baod7db5942015-01-28 10:07:51 -0800103 } fields;
104 } redirtbl[KVM_IOAPIC_NUM_PINS];
Elliott Hughesabd62612013-11-08 11:45:48 -0800105};
Elliott Hughesabd62612013-11-08 11:45:48 -0800106#define KVM_IRQCHIP_PIC_MASTER 0
107#define KVM_IRQCHIP_PIC_SLAVE 1
108#define KVM_IRQCHIP_IOAPIC 2
109#define KVM_NR_IRQCHIPS 3
Christopher Ferris05d08e92016-02-04 13:16:38 -0800110#define KVM_RUN_X86_SMM (1 << 0)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800111struct kvm_regs {
Tao Baod7db5942015-01-28 10:07:51 -0800112 __u64 rax, rbx, rcx, rdx;
113 __u64 rsi, rdi, rsp, rbp;
114 __u64 r8, r9, r10, r11;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800115 __u64 r12, r13, r14, r15;
Tao Baod7db5942015-01-28 10:07:51 -0800116 __u64 rip, rflags;
Elliott Hughesabd62612013-11-08 11:45:48 -0800117};
118#define KVM_APIC_REG_SIZE 0x400
Christopher Ferris05d08e92016-02-04 13:16:38 -0800119struct kvm_lapic_state {
Tao Baod7db5942015-01-28 10:07:51 -0800120 char regs[KVM_APIC_REG_SIZE];
Elliott Hughesabd62612013-11-08 11:45:48 -0800121};
122struct kvm_segment {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800123 __u64 base;
Tao Baod7db5942015-01-28 10:07:51 -0800124 __u32 limit;
125 __u16 selector;
126 __u8 type;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800127 __u8 present, dpl, db, s, l, g, avl;
Tao Baod7db5942015-01-28 10:07:51 -0800128 __u8 unusable;
129 __u8 padding;
Elliott Hughesabd62612013-11-08 11:45:48 -0800130};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800131struct kvm_dtable {
Tao Baod7db5942015-01-28 10:07:51 -0800132 __u64 base;
133 __u16 limit;
134 __u16 padding[3];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800135};
Elliott Hughesabd62612013-11-08 11:45:48 -0800136struct kvm_sregs {
Tao Baod7db5942015-01-28 10:07:51 -0800137 struct kvm_segment cs, ds, es, fs, gs, ss;
138 struct kvm_segment tr, ldt;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800139 struct kvm_dtable gdt, idt;
Tao Baod7db5942015-01-28 10:07:51 -0800140 __u64 cr0, cr2, cr3, cr4, cr8;
141 __u64 efer;
142 __u64 apic_base;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800143 __u64 interrupt_bitmap[(KVM_NR_INTERRUPTS + 63) / 64];
Elliott Hughesabd62612013-11-08 11:45:48 -0800144};
145struct kvm_fpu {
Tao Baod7db5942015-01-28 10:07:51 -0800146 __u8 fpr[8][16];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800147 __u16 fcw;
Tao Baod7db5942015-01-28 10:07:51 -0800148 __u16 fsw;
149 __u8 ftwx;
150 __u8 pad1;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800151 __u16 last_opcode;
Tao Baod7db5942015-01-28 10:07:51 -0800152 __u64 last_ip;
153 __u64 last_dp;
154 __u8 xmm[16][16];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800155 __u32 mxcsr;
Tao Baod7db5942015-01-28 10:07:51 -0800156 __u32 pad2;
Elliott Hughesabd62612013-11-08 11:45:48 -0800157};
158struct kvm_msr_entry {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800159 __u32 index;
Tao Baod7db5942015-01-28 10:07:51 -0800160 __u32 reserved;
161 __u64 data;
Elliott Hughesabd62612013-11-08 11:45:48 -0800162};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800163struct kvm_msrs {
Tao Baod7db5942015-01-28 10:07:51 -0800164 __u32 nmsrs;
165 __u32 pad;
166 struct kvm_msr_entry entries[0];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800167};
Elliott Hughesabd62612013-11-08 11:45:48 -0800168struct kvm_msr_list {
Tao Baod7db5942015-01-28 10:07:51 -0800169 __u32 nmsrs;
170 __u32 indices[0];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800171};
Elliott Hughesabd62612013-11-08 11:45:48 -0800172struct kvm_cpuid_entry {
Tao Baod7db5942015-01-28 10:07:51 -0800173 __u32 function;
174 __u32 eax;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800175 __u32 ebx;
Tao Baod7db5942015-01-28 10:07:51 -0800176 __u32 ecx;
177 __u32 edx;
178 __u32 padding;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800179};
Elliott Hughesabd62612013-11-08 11:45:48 -0800180struct kvm_cpuid {
Tao Baod7db5942015-01-28 10:07:51 -0800181 __u32 nent;
182 __u32 padding;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800183 struct kvm_cpuid_entry entries[0];
Elliott Hughesabd62612013-11-08 11:45:48 -0800184};
185struct kvm_cpuid_entry2 {
Tao Baod7db5942015-01-28 10:07:51 -0800186 __u32 function;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800187 __u32 index;
Tao Baod7db5942015-01-28 10:07:51 -0800188 __u32 flags;
189 __u32 eax;
190 __u32 ebx;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800191 __u32 ecx;
Tao Baod7db5942015-01-28 10:07:51 -0800192 __u32 edx;
193 __u32 padding[3];
Elliott Hughesabd62612013-11-08 11:45:48 -0800194};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700195#define KVM_CPUID_FLAG_SIGNIFCANT_INDEX (1 << 0)
196#define KVM_CPUID_FLAG_STATEFUL_FUNC (1 << 1)
197#define KVM_CPUID_FLAG_STATE_READ_NEXT (1 << 2)
Elliott Hughesabd62612013-11-08 11:45:48 -0800198struct kvm_cpuid2 {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800199 __u32 nent;
Tao Baod7db5942015-01-28 10:07:51 -0800200 __u32 padding;
201 struct kvm_cpuid_entry2 entries[0];
Elliott Hughesabd62612013-11-08 11:45:48 -0800202};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800203struct kvm_pit_channel_state {
Tao Baod7db5942015-01-28 10:07:51 -0800204 __u32 count;
205 __u16 latched_count;
206 __u8 count_latched;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800207 __u8 status_latched;
Tao Baod7db5942015-01-28 10:07:51 -0800208 __u8 status;
209 __u8 read_state;
210 __u8 write_state;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800211 __u8 write_latch;
Tao Baod7db5942015-01-28 10:07:51 -0800212 __u8 rw_mode;
213 __u8 mode;
214 __u8 bcd;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800215 __u8 gate;
Tao Baod7db5942015-01-28 10:07:51 -0800216 __s64 count_load_time;
Elliott Hughesabd62612013-11-08 11:45:48 -0800217};
218struct kvm_debug_exit_arch {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800219 __u32 exception;
Tao Baod7db5942015-01-28 10:07:51 -0800220 __u32 pad;
221 __u64 pc;
222 __u64 dr6;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800223 __u64 dr7;
Elliott Hughesabd62612013-11-08 11:45:48 -0800224};
225#define KVM_GUESTDBG_USE_SW_BP 0x00010000
226#define KVM_GUESTDBG_USE_HW_BP 0x00020000
Christopher Ferris05d08e92016-02-04 13:16:38 -0800227#define KVM_GUESTDBG_INJECT_DB 0x00040000
Elliott Hughesabd62612013-11-08 11:45:48 -0800228#define KVM_GUESTDBG_INJECT_BP 0x00080000
229struct kvm_guest_debug_arch {
Tao Baod7db5942015-01-28 10:07:51 -0800230 __u64 debugreg[8];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800231};
Elliott Hughesabd62612013-11-08 11:45:48 -0800232struct kvm_pit_state {
Tao Baod7db5942015-01-28 10:07:51 -0800233 struct kvm_pit_channel_state channels[3];
Elliott Hughesabd62612013-11-08 11:45:48 -0800234};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800235#define KVM_PIT_FLAGS_HPET_LEGACY 0x00000001
Elliott Hughesabd62612013-11-08 11:45:48 -0800236struct kvm_pit_state2 {
Tao Baod7db5942015-01-28 10:07:51 -0800237 struct kvm_pit_channel_state channels[3];
238 __u32 flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800239 __u32 reserved[9];
Elliott Hughesabd62612013-11-08 11:45:48 -0800240};
241struct kvm_reinject_control {
Tao Baod7db5942015-01-28 10:07:51 -0800242 __u8 pit_reinject;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800243 __u8 reserved[31];
Elliott Hughesabd62612013-11-08 11:45:48 -0800244};
245#define KVM_VCPUEVENT_VALID_NMI_PENDING 0x00000001
246#define KVM_VCPUEVENT_VALID_SIPI_VECTOR 0x00000002
Christopher Ferris05d08e92016-02-04 13:16:38 -0800247#define KVM_VCPUEVENT_VALID_SHADOW 0x00000004
248#define KVM_VCPUEVENT_VALID_SMM 0x00000008
Elliott Hughesabd62612013-11-08 11:45:48 -0800249#define KVM_X86_SHADOW_INT_MOV_SS 0x01
250#define KVM_X86_SHADOW_INT_STI 0x02
251struct kvm_vcpu_events {
Tao Baod7db5942015-01-28 10:07:51 -0800252 struct {
Tao Baod7db5942015-01-28 10:07:51 -0800253 __u8 injected;
254 __u8 nr;
255 __u8 has_error_code;
256 __u8 pad;
Tao Baod7db5942015-01-28 10:07:51 -0800257 __u32 error_code;
258 } exception;
259 struct {
260 __u8 injected;
Tao Baod7db5942015-01-28 10:07:51 -0800261 __u8 nr;
262 __u8 soft;
263 __u8 shadow;
264 } interrupt;
Tao Baod7db5942015-01-28 10:07:51 -0800265 struct {
266 __u8 injected;
267 __u8 pending;
268 __u8 masked;
Tao Baod7db5942015-01-28 10:07:51 -0800269 __u8 pad;
270 } nmi;
271 __u32 sipi_vector;
272 __u32 flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800273 struct {
274 __u8 smm;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800275 __u8 pending;
276 __u8 smm_inside_nmi;
277 __u8 latched_init;
278 } smi;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800279 __u32 reserved[9];
Elliott Hughesabd62612013-11-08 11:45:48 -0800280};
281struct kvm_debugregs {
Tao Baod7db5942015-01-28 10:07:51 -0800282 __u64 db[4];
Tao Baod7db5942015-01-28 10:07:51 -0800283 __u64 dr6;
284 __u64 dr7;
285 __u64 flags;
286 __u64 reserved[9];
Elliott Hughesabd62612013-11-08 11:45:48 -0800287};
288struct kvm_xsave {
Tao Baod7db5942015-01-28 10:07:51 -0800289 __u32 region[1024];
Elliott Hughesabd62612013-11-08 11:45:48 -0800290};
291#define KVM_MAX_XCRS 16
292struct kvm_xcr {
Tao Baod7db5942015-01-28 10:07:51 -0800293 __u32 xcr;
294 __u32 reserved;
Tao Baod7db5942015-01-28 10:07:51 -0800295 __u64 value;
Elliott Hughesabd62612013-11-08 11:45:48 -0800296};
297struct kvm_xcrs {
Tao Baod7db5942015-01-28 10:07:51 -0800298 __u32 nr_xcrs;
Tao Baod7db5942015-01-28 10:07:51 -0800299 __u32 flags;
300 struct kvm_xcr xcrs[KVM_MAX_XCRS];
301 __u64 padding[16];
Elliott Hughesabd62612013-11-08 11:45:48 -0800302};
303struct kvm_sync_regs {
304};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800305#define KVM_X86_QUIRK_LINT0_REENABLED (1 << 0)
306#define KVM_X86_QUIRK_CD_NW_CLEARED (1 << 1)
Elliott Hughesabd62612013-11-08 11:45:48 -0800307#endif