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 struct kvm_regs {
133 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
134   __u64 rax, rbx, rcx, rdx;
135   __u64 rsi, rdi, rsp, rbp;
136   __u64 r8, r9, r10, r11;
137   __u64 r12, r13, r14, r15;
138 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
139   __u64 rip, rflags;
140 };
141 #define KVM_APIC_REG_SIZE 0x400
142 struct kvm_lapic_state {
143 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
144   char regs[KVM_APIC_REG_SIZE];
145 };
146 struct kvm_segment {
147   __u64 base;
148 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
149   __u32 limit;
150   __u16 selector;
151   __u8 type;
152   __u8 present, dpl, db, s, l, g, avl;
153 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
154   __u8 unusable;
155   __u8 padding;
156 };
157 struct kvm_dtable {
158 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
159   __u64 base;
160   __u16 limit;
161   __u16 padding[3];
162 };
163 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
164 struct kvm_sregs {
165   struct kvm_segment cs, ds, es, fs, gs, ss;
166   struct kvm_segment tr, ldt;
167   struct kvm_dtable gdt, idt;
168 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
169   __u64 cr0, cr2, cr3, cr4, cr8;
170   __u64 efer;
171   __u64 apic_base;
172   __u64 interrupt_bitmap[(KVM_NR_INTERRUPTS + 63) / 64];
173 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
174 };
175 struct kvm_fpu {
176   __u8 fpr[8][16];
177   __u16 fcw;
178 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
179   __u16 fsw;
180   __u8 ftwx;
181   __u8 pad1;
182   __u16 last_opcode;
183 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
184   __u64 last_ip;
185   __u64 last_dp;
186   __u8 xmm[16][16];
187   __u32 mxcsr;
188 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
189   __u32 pad2;
190 };
191 struct kvm_msr_entry {
192   __u32 index;
193 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
194   __u32 reserved;
195   __u64 data;
196 };
197 struct kvm_msrs {
198 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
199   __u32 nmsrs;
200   __u32 pad;
201   struct kvm_msr_entry entries[0];
202 };
203 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
204 struct kvm_msr_list {
205   __u32 nmsrs;
206   __u32 indices[0];
207 };
208 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
209 struct kvm_cpuid_entry {
210   __u32 function;
211   __u32 eax;
212   __u32 ebx;
213 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
214   __u32 ecx;
215   __u32 edx;
216   __u32 padding;
217 };
218 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
219 struct kvm_cpuid {
220   __u32 nent;
221   __u32 padding;
222   struct kvm_cpuid_entry entries[0];
223 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
224 };
225 struct kvm_cpuid_entry2 {
226   __u32 function;
227   __u32 index;
228 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
229   __u32 flags;
230   __u32 eax;
231   __u32 ebx;
232   __u32 ecx;
233 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
234   __u32 edx;
235   __u32 padding[3];
236 };
237 #define KVM_CPUID_FLAG_SIGNIFCANT_INDEX BIT(0)
238 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
239 #define KVM_CPUID_FLAG_STATEFUL_FUNC BIT(1)
240 #define KVM_CPUID_FLAG_STATE_READ_NEXT BIT(2)
241 struct kvm_cpuid2 {
242   __u32 nent;
243 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
244   __u32 padding;
245   struct kvm_cpuid_entry2 entries[0];
246 };
247 struct kvm_pit_channel_state {
248 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
249   __u32 count;
250   __u16 latched_count;
251   __u8 count_latched;
252   __u8 status_latched;
253 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
254   __u8 status;
255   __u8 read_state;
256   __u8 write_state;
257   __u8 write_latch;
258 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
259   __u8 rw_mode;
260   __u8 mode;
261   __u8 bcd;
262   __u8 gate;
263 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
264   __s64 count_load_time;
265 };
266 struct kvm_debug_exit_arch {
267   __u32 exception;
268 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
269   __u32 pad;
270   __u64 pc;
271   __u64 dr6;
272   __u64 dr7;
273 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
274 };
275 #define KVM_GUESTDBG_USE_SW_BP 0x00010000
276 #define KVM_GUESTDBG_USE_HW_BP 0x00020000
277 #define KVM_GUESTDBG_INJECT_DB 0x00040000
278 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
279 #define KVM_GUESTDBG_INJECT_BP 0x00080000
280 struct kvm_guest_debug_arch {
281   __u64 debugreg[8];
282 };
283 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
284 struct kvm_pit_state {
285   struct kvm_pit_channel_state channels[3];
286 };
287 #define KVM_PIT_FLAGS_HPET_LEGACY 0x00000001
288 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
289 struct kvm_pit_state2 {
290   struct kvm_pit_channel_state channels[3];
291   __u32 flags;
292   __u32 reserved[9];
293 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
294 };
295 struct kvm_reinject_control {
296   __u8 pit_reinject;
297   __u8 reserved[31];
298 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
299 };
300 #define KVM_VCPUEVENT_VALID_NMI_PENDING 0x00000001
301 #define KVM_VCPUEVENT_VALID_SIPI_VECTOR 0x00000002
302 #define KVM_VCPUEVENT_VALID_SHADOW 0x00000004
303 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
304 #define KVM_X86_SHADOW_INT_MOV_SS 0x01
305 #define KVM_X86_SHADOW_INT_STI 0x02
306 struct kvm_vcpu_events {
307   struct {
308 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
309     __u8 injected;
310     __u8 nr;
311     __u8 has_error_code;
312     __u8 pad;
313 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
314     __u32 error_code;
315   } exception;
316   struct {
317     __u8 injected;
318 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
319     __u8 nr;
320     __u8 soft;
321     __u8 shadow;
322   } interrupt;
323 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
324   struct {
325     __u8 injected;
326     __u8 pending;
327     __u8 masked;
328 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
329     __u8 pad;
330   } nmi;
331   __u32 sipi_vector;
332   __u32 flags;
333 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
334   __u32 reserved[10];
335 };
336 struct kvm_debugregs {
337   __u64 db[4];
338 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
339   __u64 dr6;
340   __u64 dr7;
341   __u64 flags;
342   __u64 reserved[9];
343 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
344 };
345 struct kvm_xsave {
346   __u32 region[1024];
347 };
348 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
349 #define KVM_MAX_XCRS 16
350 struct kvm_xcr {
351   __u32 xcr;
352   __u32 reserved;
353 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
354   __u64 value;
355 };
356 struct kvm_xcrs {
357   __u32 nr_xcrs;
358 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
359   __u32 flags;
360   struct kvm_xcr xcrs[KVM_MAX_XCRS];
361   __u64 padding[16];
362 };
363 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
364 struct kvm_sync_regs {
365 };
366 #endif
367