blob: 77d35fcebda8ad98f928fc3491262f23f8e29ff2 [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>
Christopher Ferris525ce912017-07-26 13:12:53 -070023#define KVM_PIO_PAGE_OFFSET 1
24#define KVM_COALESCED_MMIO_PAGE_OFFSET 2
Christopher Ferris05667cd2021-02-16 16:01:34 -080025#define KVM_DIRTY_LOG_PAGE_OFFSET 64
Elliott Hughesabd62612013-11-08 11:45:48 -080026#define DE_VECTOR 0
27#define DB_VECTOR 1
28#define BP_VECTOR 3
29#define OF_VECTOR 4
Elliott Hughesabd62612013-11-08 11:45:48 -080030#define BR_VECTOR 5
31#define UD_VECTOR 6
32#define NM_VECTOR 7
33#define DF_VECTOR 8
Elliott Hughesabd62612013-11-08 11:45:48 -080034#define TS_VECTOR 10
35#define NP_VECTOR 11
36#define SS_VECTOR 12
37#define GP_VECTOR 13
Elliott Hughesabd62612013-11-08 11:45:48 -080038#define PF_VECTOR 14
39#define MF_VECTOR 16
Christopher Ferris82d75042015-01-26 10:57:07 -080040#define AC_VECTOR 17
Elliott Hughesabd62612013-11-08 11:45:48 -080041#define MC_VECTOR 18
Christopher Ferris82d75042015-01-26 10:57:07 -080042#define XM_VECTOR 19
43#define VE_VECTOR 20
44#define __KVM_HAVE_PIT
Elliott Hughesabd62612013-11-08 11:45:48 -080045#define __KVM_HAVE_IOAPIC
46#define __KVM_HAVE_IRQ_LINE
47#define __KVM_HAVE_MSI
48#define __KVM_HAVE_USER_NMI
Elliott Hughesabd62612013-11-08 11:45:48 -080049#define __KVM_HAVE_GUEST_DEBUG
50#define __KVM_HAVE_MSIX
51#define __KVM_HAVE_MCE
52#define __KVM_HAVE_PIT_STATE2
Elliott Hughesabd62612013-11-08 11:45:48 -080053#define __KVM_HAVE_XEN_HVM
54#define __KVM_HAVE_VCPU_EVENTS
55#define __KVM_HAVE_DEBUGREGS
56#define __KVM_HAVE_XSAVE
Elliott Hughesabd62612013-11-08 11:45:48 -080057#define __KVM_HAVE_XCRS
58#define __KVM_HAVE_READONLY_MEM
59#define KVM_NR_INTERRUPTS 256
Elliott Hughesabd62612013-11-08 11:45:48 -080060struct kvm_pic_state {
Tao Baod7db5942015-01-28 10:07:51 -080061 __u8 last_irr;
62 __u8 irr;
Tao Baod7db5942015-01-28 10:07:51 -080063 __u8 imr;
64 __u8 isr;
65 __u8 priority_add;
66 __u8 irq_base;
Tao Baod7db5942015-01-28 10:07:51 -080067 __u8 read_reg_select;
68 __u8 poll;
69 __u8 special_mask;
70 __u8 init_state;
Tao Baod7db5942015-01-28 10:07:51 -080071 __u8 auto_eoi;
72 __u8 rotate_on_auto_eoi;
73 __u8 special_fully_nested_mode;
74 __u8 init4;
Tao Baod7db5942015-01-28 10:07:51 -080075 __u8 elcr;
76 __u8 elcr_mask;
Elliott Hughesabd62612013-11-08 11:45:48 -080077};
Elliott Hughesabd62612013-11-08 11:45:48 -080078#define KVM_IOAPIC_NUM_PINS 24
79struct kvm_ioapic_state {
Tao Baod7db5942015-01-28 10:07:51 -080080 __u64 base_address;
81 __u32 ioregsel;
82 __u32 id;
Tao Baod7db5942015-01-28 10:07:51 -080083 __u32 irr;
84 __u32 pad;
85 union {
86 __u64 bits;
Tao Baod7db5942015-01-28 10:07:51 -080087 struct {
88 __u8 vector;
89 __u8 delivery_mode : 3;
90 __u8 dest_mode : 1;
Tao Baod7db5942015-01-28 10:07:51 -080091 __u8 delivery_status : 1;
92 __u8 polarity : 1;
93 __u8 remote_irr : 1;
94 __u8 trig_mode : 1;
Tao Baod7db5942015-01-28 10:07:51 -080095 __u8 mask : 1;
96 __u8 reserve : 7;
97 __u8 reserved[4];
98 __u8 dest_id;
Tao Baod7db5942015-01-28 10:07:51 -080099 } fields;
100 } redirtbl[KVM_IOAPIC_NUM_PINS];
Elliott Hughesabd62612013-11-08 11:45:48 -0800101};
Elliott Hughesabd62612013-11-08 11:45:48 -0800102#define KVM_IRQCHIP_PIC_MASTER 0
103#define KVM_IRQCHIP_PIC_SLAVE 1
104#define KVM_IRQCHIP_IOAPIC 2
105#define KVM_NR_IRQCHIPS 3
Christopher Ferris05d08e92016-02-04 13:16:38 -0800106#define KVM_RUN_X86_SMM (1 << 0)
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700107#define KVM_RUN_X86_BUS_LOCK (1 << 1)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800108struct kvm_regs {
Tao Baod7db5942015-01-28 10:07:51 -0800109 __u64 rax, rbx, rcx, rdx;
110 __u64 rsi, rdi, rsp, rbp;
111 __u64 r8, r9, r10, r11;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800112 __u64 r12, r13, r14, r15;
Tao Baod7db5942015-01-28 10:07:51 -0800113 __u64 rip, rflags;
Elliott Hughesabd62612013-11-08 11:45:48 -0800114};
115#define KVM_APIC_REG_SIZE 0x400
Christopher Ferris05d08e92016-02-04 13:16:38 -0800116struct kvm_lapic_state {
Tao Baod7db5942015-01-28 10:07:51 -0800117 char regs[KVM_APIC_REG_SIZE];
Elliott Hughesabd62612013-11-08 11:45:48 -0800118};
119struct kvm_segment {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800120 __u64 base;
Tao Baod7db5942015-01-28 10:07:51 -0800121 __u32 limit;
122 __u16 selector;
123 __u8 type;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800124 __u8 present, dpl, db, s, l, g, avl;
Tao Baod7db5942015-01-28 10:07:51 -0800125 __u8 unusable;
126 __u8 padding;
Elliott Hughesabd62612013-11-08 11:45:48 -0800127};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800128struct kvm_dtable {
Tao Baod7db5942015-01-28 10:07:51 -0800129 __u64 base;
130 __u16 limit;
131 __u16 padding[3];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800132};
Elliott Hughesabd62612013-11-08 11:45:48 -0800133struct kvm_sregs {
Tao Baod7db5942015-01-28 10:07:51 -0800134 struct kvm_segment cs, ds, es, fs, gs, ss;
135 struct kvm_segment tr, ldt;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800136 struct kvm_dtable gdt, idt;
Tao Baod7db5942015-01-28 10:07:51 -0800137 __u64 cr0, cr2, cr3, cr4, cr8;
138 __u64 efer;
139 __u64 apic_base;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800140 __u64 interrupt_bitmap[(KVM_NR_INTERRUPTS + 63) / 64];
Elliott Hughesabd62612013-11-08 11:45:48 -0800141};
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000142struct kvm_sregs2 {
143 struct kvm_segment cs, ds, es, fs, gs, ss;
144 struct kvm_segment tr, ldt;
145 struct kvm_dtable gdt, idt;
146 __u64 cr0, cr2, cr3, cr4, cr8;
147 __u64 efer;
148 __u64 apic_base;
149 __u64 flags;
150 __u64 pdptrs[4];
151};
152#define KVM_SREGS2_FLAGS_PDPTRS_VALID 1
Elliott Hughesabd62612013-11-08 11:45:48 -0800153struct kvm_fpu {
Tao Baod7db5942015-01-28 10:07:51 -0800154 __u8 fpr[8][16];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800155 __u16 fcw;
Tao Baod7db5942015-01-28 10:07:51 -0800156 __u16 fsw;
157 __u8 ftwx;
158 __u8 pad1;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800159 __u16 last_opcode;
Tao Baod7db5942015-01-28 10:07:51 -0800160 __u64 last_ip;
161 __u64 last_dp;
162 __u8 xmm[16][16];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800163 __u32 mxcsr;
Tao Baod7db5942015-01-28 10:07:51 -0800164 __u32 pad2;
Elliott Hughesabd62612013-11-08 11:45:48 -0800165};
166struct kvm_msr_entry {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800167 __u32 index;
Tao Baod7db5942015-01-28 10:07:51 -0800168 __u32 reserved;
169 __u64 data;
Elliott Hughesabd62612013-11-08 11:45:48 -0800170};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800171struct kvm_msrs {
Tao Baod7db5942015-01-28 10:07:51 -0800172 __u32 nmsrs;
173 __u32 pad;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700174 struct kvm_msr_entry entries[];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800175};
Elliott Hughesabd62612013-11-08 11:45:48 -0800176struct kvm_msr_list {
Tao Baod7db5942015-01-28 10:07:51 -0800177 __u32 nmsrs;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700178 __u32 indices[];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800179};
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800180#define KVM_MSR_FILTER_MAX_BITMAP_SIZE 0x600
181struct kvm_msr_filter_range {
182#define KVM_MSR_FILTER_READ (1 << 0)
183#define KVM_MSR_FILTER_WRITE (1 << 1)
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800184#define KVM_MSR_FILTER_RANGE_VALID_MASK (KVM_MSR_FILTER_READ | KVM_MSR_FILTER_WRITE)
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800185 __u32 flags;
186 __u32 nmsrs;
187 __u32 base;
188 __u8 * bitmap;
189};
190#define KVM_MSR_FILTER_MAX_RANGES 16
191struct kvm_msr_filter {
192#define KVM_MSR_FILTER_DEFAULT_ALLOW (0 << 0)
193#define KVM_MSR_FILTER_DEFAULT_DENY (1 << 0)
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800194#define KVM_MSR_FILTER_VALID_MASK (KVM_MSR_FILTER_DEFAULT_DENY)
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800195 __u32 flags;
196 struct kvm_msr_filter_range ranges[KVM_MSR_FILTER_MAX_RANGES];
197};
Elliott Hughesabd62612013-11-08 11:45:48 -0800198struct kvm_cpuid_entry {
Tao Baod7db5942015-01-28 10:07:51 -0800199 __u32 function;
200 __u32 eax;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800201 __u32 ebx;
Tao Baod7db5942015-01-28 10:07:51 -0800202 __u32 ecx;
203 __u32 edx;
204 __u32 padding;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800205};
Elliott Hughesabd62612013-11-08 11:45:48 -0800206struct kvm_cpuid {
Tao Baod7db5942015-01-28 10:07:51 -0800207 __u32 nent;
208 __u32 padding;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700209 struct kvm_cpuid_entry entries[];
Elliott Hughesabd62612013-11-08 11:45:48 -0800210};
211struct kvm_cpuid_entry2 {
Tao Baod7db5942015-01-28 10:07:51 -0800212 __u32 function;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800213 __u32 index;
Tao Baod7db5942015-01-28 10:07:51 -0800214 __u32 flags;
215 __u32 eax;
216 __u32 ebx;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800217 __u32 ecx;
Tao Baod7db5942015-01-28 10:07:51 -0800218 __u32 edx;
219 __u32 padding[3];
Elliott Hughesabd62612013-11-08 11:45:48 -0800220};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700221#define KVM_CPUID_FLAG_SIGNIFCANT_INDEX (1 << 0)
222#define KVM_CPUID_FLAG_STATEFUL_FUNC (1 << 1)
223#define KVM_CPUID_FLAG_STATE_READ_NEXT (1 << 2)
Elliott Hughesabd62612013-11-08 11:45:48 -0800224struct kvm_cpuid2 {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800225 __u32 nent;
Tao Baod7db5942015-01-28 10:07:51 -0800226 __u32 padding;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700227 struct kvm_cpuid_entry2 entries[];
Elliott Hughesabd62612013-11-08 11:45:48 -0800228};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800229struct kvm_pit_channel_state {
Tao Baod7db5942015-01-28 10:07:51 -0800230 __u32 count;
231 __u16 latched_count;
232 __u8 count_latched;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800233 __u8 status_latched;
Tao Baod7db5942015-01-28 10:07:51 -0800234 __u8 status;
235 __u8 read_state;
236 __u8 write_state;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800237 __u8 write_latch;
Tao Baod7db5942015-01-28 10:07:51 -0800238 __u8 rw_mode;
239 __u8 mode;
240 __u8 bcd;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800241 __u8 gate;
Tao Baod7db5942015-01-28 10:07:51 -0800242 __s64 count_load_time;
Elliott Hughesabd62612013-11-08 11:45:48 -0800243};
244struct kvm_debug_exit_arch {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800245 __u32 exception;
Tao Baod7db5942015-01-28 10:07:51 -0800246 __u32 pad;
247 __u64 pc;
248 __u64 dr6;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800249 __u64 dr7;
Elliott Hughesabd62612013-11-08 11:45:48 -0800250};
251#define KVM_GUESTDBG_USE_SW_BP 0x00010000
252#define KVM_GUESTDBG_USE_HW_BP 0x00020000
Christopher Ferris05d08e92016-02-04 13:16:38 -0800253#define KVM_GUESTDBG_INJECT_DB 0x00040000
Elliott Hughesabd62612013-11-08 11:45:48 -0800254#define KVM_GUESTDBG_INJECT_BP 0x00080000
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700255#define KVM_GUESTDBG_BLOCKIRQ 0x00100000
Elliott Hughesabd62612013-11-08 11:45:48 -0800256struct kvm_guest_debug_arch {
Tao Baod7db5942015-01-28 10:07:51 -0800257 __u64 debugreg[8];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800258};
Elliott Hughesabd62612013-11-08 11:45:48 -0800259struct kvm_pit_state {
Tao Baod7db5942015-01-28 10:07:51 -0800260 struct kvm_pit_channel_state channels[3];
Elliott Hughesabd62612013-11-08 11:45:48 -0800261};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800262#define KVM_PIT_FLAGS_HPET_LEGACY 0x00000001
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700263#define KVM_PIT_FLAGS_SPEAKER_DATA_ON 0x00000002
Elliott Hughesabd62612013-11-08 11:45:48 -0800264struct kvm_pit_state2 {
Tao Baod7db5942015-01-28 10:07:51 -0800265 struct kvm_pit_channel_state channels[3];
266 __u32 flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800267 __u32 reserved[9];
Elliott Hughesabd62612013-11-08 11:45:48 -0800268};
269struct kvm_reinject_control {
Tao Baod7db5942015-01-28 10:07:51 -0800270 __u8 pit_reinject;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800271 __u8 reserved[31];
Elliott Hughesabd62612013-11-08 11:45:48 -0800272};
273#define KVM_VCPUEVENT_VALID_NMI_PENDING 0x00000001
274#define KVM_VCPUEVENT_VALID_SIPI_VECTOR 0x00000002
Christopher Ferris05d08e92016-02-04 13:16:38 -0800275#define KVM_VCPUEVENT_VALID_SHADOW 0x00000004
276#define KVM_VCPUEVENT_VALID_SMM 0x00000008
Christopher Ferris86a48372019-01-10 14:14:59 -0800277#define KVM_VCPUEVENT_VALID_PAYLOAD 0x00000010
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700278#define KVM_VCPUEVENT_VALID_TRIPLE_FAULT 0x00000020
Elliott Hughesabd62612013-11-08 11:45:48 -0800279#define KVM_X86_SHADOW_INT_MOV_SS 0x01
280#define KVM_X86_SHADOW_INT_STI 0x02
281struct kvm_vcpu_events {
Tao Baod7db5942015-01-28 10:07:51 -0800282 struct {
Tao Baod7db5942015-01-28 10:07:51 -0800283 __u8 injected;
284 __u8 nr;
285 __u8 has_error_code;
Christopher Ferris86a48372019-01-10 14:14:59 -0800286 __u8 pending;
Tao Baod7db5942015-01-28 10:07:51 -0800287 __u32 error_code;
288 } exception;
289 struct {
290 __u8 injected;
Tao Baod7db5942015-01-28 10:07:51 -0800291 __u8 nr;
292 __u8 soft;
293 __u8 shadow;
294 } interrupt;
Tao Baod7db5942015-01-28 10:07:51 -0800295 struct {
296 __u8 injected;
297 __u8 pending;
298 __u8 masked;
Tao Baod7db5942015-01-28 10:07:51 -0800299 __u8 pad;
300 } nmi;
301 __u32 sipi_vector;
302 __u32 flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800303 struct {
304 __u8 smm;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800305 __u8 pending;
306 __u8 smm_inside_nmi;
307 __u8 latched_init;
308 } smi;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700309 struct {
310 __u8 pending;
311 } triple_fault;
312 __u8 reserved[26];
Christopher Ferris86a48372019-01-10 14:14:59 -0800313 __u8 exception_has_payload;
314 __u64 exception_payload;
Elliott Hughesabd62612013-11-08 11:45:48 -0800315};
316struct kvm_debugregs {
Tao Baod7db5942015-01-28 10:07:51 -0800317 __u64 db[4];
Tao Baod7db5942015-01-28 10:07:51 -0800318 __u64 dr6;
319 __u64 dr7;
320 __u64 flags;
321 __u64 reserved[9];
Elliott Hughesabd62612013-11-08 11:45:48 -0800322};
323struct kvm_xsave {
Tao Baod7db5942015-01-28 10:07:51 -0800324 __u32 region[1024];
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700325 __u32 extra[];
Elliott Hughesabd62612013-11-08 11:45:48 -0800326};
327#define KVM_MAX_XCRS 16
328struct kvm_xcr {
Tao Baod7db5942015-01-28 10:07:51 -0800329 __u32 xcr;
330 __u32 reserved;
Tao Baod7db5942015-01-28 10:07:51 -0800331 __u64 value;
Elliott Hughesabd62612013-11-08 11:45:48 -0800332};
333struct kvm_xcrs {
Tao Baod7db5942015-01-28 10:07:51 -0800334 __u32 nr_xcrs;
Tao Baod7db5942015-01-28 10:07:51 -0800335 __u32 flags;
336 struct kvm_xcr xcrs[KVM_MAX_XCRS];
337 __u64 padding[16];
Elliott Hughesabd62612013-11-08 11:45:48 -0800338};
Christopher Ferris76a1d452018-06-27 14:12:29 -0700339#define KVM_SYNC_X86_REGS (1UL << 0)
340#define KVM_SYNC_X86_SREGS (1UL << 1)
341#define KVM_SYNC_X86_EVENTS (1UL << 2)
342#define KVM_SYNC_X86_VALID_FIELDS (KVM_SYNC_X86_REGS | KVM_SYNC_X86_SREGS | KVM_SYNC_X86_EVENTS)
Elliott Hughesabd62612013-11-08 11:45:48 -0800343struct kvm_sync_regs {
Christopher Ferris76a1d452018-06-27 14:12:29 -0700344 struct kvm_regs regs;
345 struct kvm_sregs sregs;
346 struct kvm_vcpu_events events;
Elliott Hughesabd62612013-11-08 11:45:48 -0800347};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800348#define KVM_X86_QUIRK_LINT0_REENABLED (1 << 0)
349#define KVM_X86_QUIRK_CD_NW_CLEARED (1 << 1)
Christopher Ferris9ce28842018-10-25 12:11:39 -0700350#define KVM_X86_QUIRK_LAPIC_MMIO_HOLE (1 << 2)
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700351#define KVM_X86_QUIRK_OUT_7E_INC_RIP (1 << 3)
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700352#define KVM_X86_QUIRK_MISC_ENABLE_NO_MWAIT (1 << 4)
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700353#define KVM_X86_QUIRK_FIX_HYPERCALL_INSN (1 << 5)
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700354#define KVM_X86_QUIRK_MWAIT_NEVER_UD_FAULTS (1 << 6)
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700355#define KVM_STATE_NESTED_FORMAT_VMX 0
356#define KVM_STATE_NESTED_FORMAT_SVM 1
Christopher Ferris9ce28842018-10-25 12:11:39 -0700357#define KVM_STATE_NESTED_GUEST_MODE 0x00000001
358#define KVM_STATE_NESTED_RUN_PENDING 0x00000002
Christopher Ferris86a48372019-01-10 14:14:59 -0800359#define KVM_STATE_NESTED_EVMCS 0x00000004
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700360#define KVM_STATE_NESTED_MTF_PENDING 0x00000008
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700361#define KVM_STATE_NESTED_GIF_SET 0x00000100
Christopher Ferris9ce28842018-10-25 12:11:39 -0700362#define KVM_STATE_NESTED_SMM_GUEST_MODE 0x00000001
363#define KVM_STATE_NESTED_SMM_VMXON 0x00000002
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700364#define KVM_STATE_NESTED_VMX_VMCS_SIZE 0x1000
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700365#define KVM_STATE_NESTED_SVM_VMCB_SIZE 0x1000
366#define KVM_STATE_VMX_PREEMPTION_TIMER_DEADLINE 0x00000001
Christopher Ferris1ed55342022-03-22 16:06:25 -0700367#define KVM_X86_XCOMP_GUEST_SUPP 0
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700368struct kvm_vmx_nested_state_data {
369 __u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
370 __u8 shadow_vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
371};
372struct kvm_vmx_nested_state_hdr {
Christopher Ferris9ce28842018-10-25 12:11:39 -0700373 __u64 vmxon_pa;
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700374 __u64 vmcs12_pa;
Christopher Ferris9ce28842018-10-25 12:11:39 -0700375 struct {
376 __u16 flags;
377 } smm;
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000378 __u16 pad;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700379 __u32 flags;
380 __u64 preemption_timer_deadline;
381};
382struct kvm_svm_nested_state_data {
383 __u8 vmcb12[KVM_STATE_NESTED_SVM_VMCB_SIZE];
384};
385struct kvm_svm_nested_state_hdr {
386 __u64 vmcb_pa;
Christopher Ferris9ce28842018-10-25 12:11:39 -0700387};
388struct kvm_nested_state {
389 __u16 flags;
390 __u16 format;
391 __u32 size;
392 union {
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700393 struct kvm_vmx_nested_state_hdr vmx;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700394 struct kvm_svm_nested_state_hdr svm;
Christopher Ferris9ce28842018-10-25 12:11:39 -0700395 __u8 pad[120];
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700396 } hdr;
397 union {
398 struct kvm_vmx_nested_state_data vmx[0];
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700399 struct kvm_svm_nested_state_data svm[0];
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700400 } data;
Christopher Ferris9ce28842018-10-25 12:11:39 -0700401};
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700402struct kvm_pmu_event_filter {
403 __u32 action;
404 __u32 nevents;
405 __u32 fixed_counter_bitmap;
406 __u32 flags;
407 __u32 pad[4];
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700408 __u64 events[];
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700409};
410#define KVM_PMU_EVENT_ALLOW 0
411#define KVM_PMU_EVENT_DENY 1
Christopher Ferrisa4792612022-01-10 13:51:15 -0800412#define KVM_VCPU_TSC_CTRL 0
413#define KVM_VCPU_TSC_OFFSET 0
Elliott Hughesabd62612013-11-08 11:45:48 -0800414#endif