1 /****************************************************************************
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>
23 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
24 #define DE_VECTOR 0
25 #define DB_VECTOR 1
26 #define BP_VECTOR 3
27 #define OF_VECTOR 4
28 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
29 #define BR_VECTOR 5
30 #define UD_VECTOR 6
31 #define NM_VECTOR 7
32 #define DF_VECTOR 8
33 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
34 #define TS_VECTOR 10
35 #define NP_VECTOR 11
36 #define SS_VECTOR 12
37 #define GP_VECTOR 13
38 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
39 #define PF_VECTOR 14
40 #define MF_VECTOR 16
41 #define AC_VECTOR 17
42 #define MC_VECTOR 18
43 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
44 #define XM_VECTOR 19
45 #define VE_VECTOR 20
46 #define __KVM_HAVE_PIT
47 #define __KVM_HAVE_IOAPIC
48 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
49 #define __KVM_HAVE_IRQ_LINE
50 #define __KVM_HAVE_MSI
51 #define __KVM_HAVE_USER_NMI
52 #define __KVM_HAVE_GUEST_DEBUG
53 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
54 #define __KVM_HAVE_MSIX
55 #define __KVM_HAVE_MCE
56 #define __KVM_HAVE_PIT_STATE2
57 #define __KVM_HAVE_XEN_HVM
58 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
59 #define __KVM_HAVE_VCPU_EVENTS
60 #define __KVM_HAVE_DEBUGREGS
61 #define __KVM_HAVE_XSAVE
62 #define __KVM_HAVE_XCRS
63 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
64 #define __KVM_HAVE_READONLY_MEM
65 #define KVM_NR_INTERRUPTS 256
66 struct kvm_memory_alias {
67   __u32 slot;
68 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
69   __u32 flags;
70   __u64 guest_phys_addr;
71   __u64 memory_size;
72   __u64 target_phys_addr;
73 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
74 };
75 struct kvm_pic_state {
76   __u8 last_irr;
77   __u8 irr;
78 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
79   __u8 imr;
80   __u8 isr;
81   __u8 priority_add;
82   __u8 irq_base;
83 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
84   __u8 read_reg_select;
85   __u8 poll;
86   __u8 special_mask;
87   __u8 init_state;
88 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
89   __u8 auto_eoi;
90   __u8 rotate_on_auto_eoi;
91   __u8 special_fully_nested_mode;
92   __u8 init4;
93 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
94   __u8 elcr;
95   __u8 elcr_mask;
96 };
97 #define KVM_IOAPIC_NUM_PINS 24
98 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
99 struct kvm_ioapic_state {
100   __u64 base_address;
101   __u32 ioregsel;
102   __u32 id;
103 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
104   __u32 irr;
105   __u32 pad;
106   union {
107     __u64 bits;
108 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
109     struct {
110       __u8 vector;
111       __u8 delivery_mode : 3;
112       __u8 dest_mode : 1;
113 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
114       __u8 delivery_status : 1;
115       __u8 polarity : 1;
116       __u8 remote_irr : 1;
117       __u8 trig_mode : 1;
118 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
119       __u8 mask : 1;
120       __u8 reserve : 7;
121       __u8 reserved[4];
122       __u8 dest_id;
123 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
124     } fields;
125   } redirtbl[KVM_IOAPIC_NUM_PINS];
126 };
127 #define KVM_IRQCHIP_PIC_MASTER 0
128 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
129 #define KVM_IRQCHIP_PIC_SLAVE 1
130 #define KVM_IRQCHIP_IOAPIC 2
131 #define KVM_NR_IRQCHIPS 3
132 #define KVM_RUN_X86_SMM (1 << 0)
133 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
134 struct kvm_regs {
135   __u64 rax, rbx, rcx, rdx;
136   __u64 rsi, rdi, rsp, rbp;
137   __u64 r8, r9, r10, r11;
138 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
139   __u64 r12, r13, r14, r15;
140   __u64 rip, rflags;
141 };
142 #define KVM_APIC_REG_SIZE 0x400
143 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
144 struct kvm_lapic_state {
145   char regs[KVM_APIC_REG_SIZE];
146 };
147 struct kvm_segment {
148 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
149   __u64 base;
150   __u32 limit;
151   __u16 selector;
152   __u8 type;
153 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
154   __u8 present, dpl, db, s, l, g, avl;
155   __u8 unusable;
156   __u8 padding;
157 };
158 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
159 struct kvm_dtable {
160   __u64 base;
161   __u16 limit;
162   __u16 padding[3];
163 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
164 };
165 struct kvm_sregs {
166   struct kvm_segment cs, ds, es, fs, gs, ss;
167   struct kvm_segment tr, ldt;
168 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
169   struct kvm_dtable gdt, idt;
170   __u64 cr0, cr2, cr3, cr4, cr8;
171   __u64 efer;
172   __u64 apic_base;
173 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
174   __u64 interrupt_bitmap[(KVM_NR_INTERRUPTS + 63) / 64];
175 };
176 struct kvm_fpu {
177   __u8 fpr[8][16];
178 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
179   __u16 fcw;
180   __u16 fsw;
181   __u8 ftwx;
182   __u8 pad1;
183 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
184   __u16 last_opcode;
185   __u64 last_ip;
186   __u64 last_dp;
187   __u8 xmm[16][16];
188 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
189   __u32 mxcsr;
190   __u32 pad2;
191 };
192 struct kvm_msr_entry {
193 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
194   __u32 index;
195   __u32 reserved;
196   __u64 data;
197 };
198 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
199 struct kvm_msrs {
200   __u32 nmsrs;
201   __u32 pad;
202   struct kvm_msr_entry entries[0];
203 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
204 };
205 struct kvm_msr_list {
206   __u32 nmsrs;
207   __u32 indices[0];
208 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
209 };
210 struct kvm_cpuid_entry {
211   __u32 function;
212   __u32 eax;
213 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
214   __u32 ebx;
215   __u32 ecx;
216   __u32 edx;
217   __u32 padding;
218 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
219 };
220 struct kvm_cpuid {
221   __u32 nent;
222   __u32 padding;
223 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
224   struct kvm_cpuid_entry entries[0];
225 };
226 struct kvm_cpuid_entry2 {
227   __u32 function;
228 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
229   __u32 index;
230   __u32 flags;
231   __u32 eax;
232   __u32 ebx;
233 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
234   __u32 ecx;
235   __u32 edx;
236   __u32 padding[3];
237 };
238 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
239 #define KVM_CPUID_FLAG_SIGNIFCANT_INDEX BIT(0)
240 #define KVM_CPUID_FLAG_STATEFUL_FUNC BIT(1)
241 #define KVM_CPUID_FLAG_STATE_READ_NEXT BIT(2)
242 struct kvm_cpuid2 {
243 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
244   __u32 nent;
245   __u32 padding;
246   struct kvm_cpuid_entry2 entries[0];
247 };
248 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
249 struct kvm_pit_channel_state {
250   __u32 count;
251   __u16 latched_count;
252   __u8 count_latched;
253 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
254   __u8 status_latched;
255   __u8 status;
256   __u8 read_state;
257   __u8 write_state;
258 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
259   __u8 write_latch;
260   __u8 rw_mode;
261   __u8 mode;
262   __u8 bcd;
263 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
264   __u8 gate;
265   __s64 count_load_time;
266 };
267 struct kvm_debug_exit_arch {
268 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
269   __u32 exception;
270   __u32 pad;
271   __u64 pc;
272   __u64 dr6;
273 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
274   __u64 dr7;
275 };
276 #define KVM_GUESTDBG_USE_SW_BP 0x00010000
277 #define KVM_GUESTDBG_USE_HW_BP 0x00020000
278 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
279 #define KVM_GUESTDBG_INJECT_DB 0x00040000
280 #define KVM_GUESTDBG_INJECT_BP 0x00080000
281 struct kvm_guest_debug_arch {
282   __u64 debugreg[8];
283 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
284 };
285 struct kvm_pit_state {
286   struct kvm_pit_channel_state channels[3];
287 };
288 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
289 #define KVM_PIT_FLAGS_HPET_LEGACY 0x00000001
290 struct kvm_pit_state2 {
291   struct kvm_pit_channel_state channels[3];
292   __u32 flags;
293 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
294   __u32 reserved[9];
295 };
296 struct kvm_reinject_control {
297   __u8 pit_reinject;
298 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
299   __u8 reserved[31];
300 };
301 #define KVM_VCPUEVENT_VALID_NMI_PENDING 0x00000001
302 #define KVM_VCPUEVENT_VALID_SIPI_VECTOR 0x00000002
303 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
304 #define KVM_VCPUEVENT_VALID_SHADOW 0x00000004
305 #define KVM_VCPUEVENT_VALID_SMM 0x00000008
306 #define KVM_X86_SHADOW_INT_MOV_SS 0x01
307 #define KVM_X86_SHADOW_INT_STI 0x02
308 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
309 struct kvm_vcpu_events {
310   struct {
311     __u8 injected;
312     __u8 nr;
313 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
314     __u8 has_error_code;
315     __u8 pad;
316     __u32 error_code;
317   } exception;
318 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
319   struct {
320     __u8 injected;
321     __u8 nr;
322     __u8 soft;
323 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
324     __u8 shadow;
325   } interrupt;
326   struct {
327     __u8 injected;
328 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
329     __u8 pending;
330     __u8 masked;
331     __u8 pad;
332   } nmi;
333 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
334   __u32 sipi_vector;
335   __u32 flags;
336   struct {
337     __u8 smm;
338 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
339     __u8 pending;
340     __u8 smm_inside_nmi;
341     __u8 latched_init;
342   } smi;
343 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
344   __u32 reserved[9];
345 };
346 struct kvm_debugregs {
347   __u64 db[4];
348 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
349   __u64 dr6;
350   __u64 dr7;
351   __u64 flags;
352   __u64 reserved[9];
353 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
354 };
355 struct kvm_xsave {
356   __u32 region[1024];
357 };
358 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
359 #define KVM_MAX_XCRS 16
360 struct kvm_xcr {
361   __u32 xcr;
362   __u32 reserved;
363 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
364   __u64 value;
365 };
366 struct kvm_xcrs {
367   __u32 nr_xcrs;
368 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
369   __u32 flags;
370   struct kvm_xcr xcrs[KVM_MAX_XCRS];
371   __u64 padding[16];
372 };
373 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
374 struct kvm_sync_regs {
375 };
376 #define KVM_X86_QUIRK_LINT0_REENABLED (1 << 0)
377 #define KVM_X86_QUIRK_CD_NW_CLEARED (1 << 1)
378 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
379 #endif
380