5 * KVM x86 specific structures and definitions
9 #include <linux/types.h>
10 #include <linux/ioctl.h>
12 /* Select x86 specific features in <linux/kvm.h> */
13 #define __KVM_HAVE_PIT
14 #define __KVM_HAVE_IOAPIC
15 #define __KVM_HAVE_DEVICE_ASSIGNMENT
16 #define __KVM_HAVE_MSI
17 #define __KVM_HAVE_USER_NMI
18 #define __KVM_HAVE_GUEST_DEBUG
19 #define __KVM_HAVE_MSIX
21 /* Architectural interrupt line count. */
22 #define KVM_NR_INTERRUPTS 256
24 struct kvm_memory_alias {
25 __u32 slot; /* this has a different namespace than memory slots */
27 __u64 guest_phys_addr;
29 __u64 target_phys_addr;
32 /* for KVM_GET_IRQCHIP and KVM_SET_IRQCHIP */
33 struct kvm_pic_state {
34 __u8 last_irr; /* edge detection */
35 __u8 irr; /* interrupt request register */
36 __u8 imr; /* interrupt mask register */
37 __u8 isr; /* interrupt service register */
38 __u8 priority_add; /* highest irq priority */
45 __u8 rotate_on_auto_eoi;
46 __u8 special_fully_nested_mode;
47 __u8 init4; /* true if 4 byte init */
48 __u8 elcr; /* PIIX edge/trigger selection */
52 #define KVM_IOAPIC_NUM_PINS 24
53 struct kvm_ioapic_state {
65 __u8 delivery_status:1;
74 } redirtbl[KVM_IOAPIC_NUM_PINS];
77 #define KVM_IRQCHIP_PIC_MASTER 0
78 #define KVM_IRQCHIP_PIC_SLAVE 1
79 #define KVM_IRQCHIP_IOAPIC 2
81 /* for KVM_GET_REGS and KVM_SET_REGS */
83 /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */
84 __u64 rax, rbx, rcx, rdx;
85 __u64 rsi, rdi, rsp, rbp;
86 __u64 r8, r9, r10, r11;
87 __u64 r12, r13, r14, r15;
91 /* for KVM_GET_LAPIC and KVM_SET_LAPIC */
92 #define KVM_APIC_REG_SIZE 0x400
93 struct kvm_lapic_state {
94 char regs[KVM_APIC_REG_SIZE];
102 __u8 present, dpl, db, s, l, g, avl;
114 /* for KVM_GET_SREGS and KVM_SET_SREGS */
116 /* out (KVM_GET_SREGS) / in (KVM_SET_SREGS) */
117 struct kvm_segment cs, ds, es, fs, gs, ss;
118 struct kvm_segment tr, ldt;
119 struct kvm_dtable gdt, idt;
120 __u64 cr0, cr2, cr3, cr4, cr8;
123 __u64 interrupt_bitmap[(KVM_NR_INTERRUPTS + 63) / 64];
126 /* for KVM_GET_FPU and KVM_SET_FPU */
131 __u8 ftwx; /* in fxsave format */
141 struct kvm_msr_entry {
147 /* for KVM_GET_MSRS and KVM_SET_MSRS */
149 __u32 nmsrs; /* number of msrs in entries */
152 struct kvm_msr_entry entries[0];
155 /* for KVM_GET_MSR_INDEX_LIST */
156 struct kvm_msr_list {
157 __u32 nmsrs; /* number of msrs in entries */
162 struct kvm_cpuid_entry {
171 /* for KVM_SET_CPUID */
175 struct kvm_cpuid_entry entries[0];
178 struct kvm_cpuid_entry2 {
189 #define KVM_CPUID_FLAG_SIGNIFCANT_INDEX 1
190 #define KVM_CPUID_FLAG_STATEFUL_FUNC 2
191 #define KVM_CPUID_FLAG_STATE_READ_NEXT 4
193 /* for KVM_SET_CPUID2 */
197 struct kvm_cpuid_entry2 entries[0];
200 /* for KVM_GET_PIT and KVM_SET_PIT */
201 struct kvm_pit_channel_state {
202 __u32 count; /* can be 65536 */
214 __s64 count_load_time;
217 struct kvm_debug_exit_arch {
225 #define KVM_GUESTDBG_USE_SW_BP 0x00010000
226 #define KVM_GUESTDBG_USE_HW_BP 0x00020000
227 #define KVM_GUESTDBG_INJECT_DB 0x00040000
228 #define KVM_GUESTDBG_INJECT_BP 0x00080000
230 /* for KVM_SET_GUEST_DEBUG */
231 struct kvm_guest_debug_arch {
235 struct kvm_pit_state {
236 struct kvm_pit_channel_state channels[3];
239 struct kvm_reinject_control {
243 #endif /* _ASM_X86_KVM_H */