Greg Kroah-Hartman | 6f52b16 | 2017-11-01 15:08:43 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
H. Peter Anvin | 1965aae | 2008-10-22 22:26:29 -0700 | [diff] [blame] | 2 | #ifndef _ASM_X86_KVM_H |
| 3 | #define _ASM_X86_KVM_H |
Jerone Young | f6a40e3 | 2007-11-19 17:06:31 -0600 | [diff] [blame] | 4 | |
| 5 | /* |
| 6 | * KVM x86 specific structures and definitions |
| 7 | * |
| 8 | */ |
| 9 | |
Jaswinder Singh Rajput | cef3767 | 2009-01-30 22:46:08 +0530 | [diff] [blame] | 10 | #include <linux/types.h> |
Jerone Young | f6a40e3 | 2007-11-19 17:06:31 -0600 | [diff] [blame] | 11 | #include <linux/ioctl.h> |
| 12 | |
Paolo Bonzini | 4b4357e | 2017-03-31 13:53:23 +0200 | [diff] [blame] | 13 | #define KVM_PIO_PAGE_OFFSET 1 |
| 14 | #define KVM_COALESCED_MMIO_PAGE_OFFSET 2 |
| 15 | |
Xiao Guangrong | 26bf264 | 2012-09-17 16:31:13 +0800 | [diff] [blame] | 16 | #define DE_VECTOR 0 |
| 17 | #define DB_VECTOR 1 |
| 18 | #define BP_VECTOR 3 |
| 19 | #define OF_VECTOR 4 |
| 20 | #define BR_VECTOR 5 |
| 21 | #define UD_VECTOR 6 |
| 22 | #define NM_VECTOR 7 |
| 23 | #define DF_VECTOR 8 |
| 24 | #define TS_VECTOR 10 |
| 25 | #define NP_VECTOR 11 |
| 26 | #define SS_VECTOR 12 |
| 27 | #define GP_VECTOR 13 |
| 28 | #define PF_VECTOR 14 |
| 29 | #define MF_VECTOR 16 |
Nadav Amit | c9cdd08 | 2014-07-21 14:37:24 +0300 | [diff] [blame] | 30 | #define AC_VECTOR 17 |
Xiao Guangrong | 26bf264 | 2012-09-17 16:31:13 +0800 | [diff] [blame] | 31 | #define MC_VECTOR 18 |
Nadav Amit | c9cdd08 | 2014-07-21 14:37:24 +0300 | [diff] [blame] | 32 | #define XM_VECTOR 19 |
| 33 | #define VE_VECTOR 20 |
Xiao Guangrong | 26bf264 | 2012-09-17 16:31:13 +0800 | [diff] [blame] | 34 | |
Avi Kivity | 7a0eb19 | 2009-01-19 14:57:52 +0200 | [diff] [blame] | 35 | /* Select x86 specific features in <linux/kvm.h> */ |
| 36 | #define __KVM_HAVE_PIT |
| 37 | #define __KVM_HAVE_IOAPIC |
Christoffer Dall | a1e4ccb | 2012-06-15 15:07:13 -0400 | [diff] [blame] | 38 | #define __KVM_HAVE_IRQ_LINE |
Avi Kivity | 7a0eb19 | 2009-01-19 14:57:52 +0200 | [diff] [blame] | 39 | #define __KVM_HAVE_MSI |
| 40 | #define __KVM_HAVE_USER_NMI |
Avi Kivity | 91b2ae7 | 2009-01-19 14:57:52 +0200 | [diff] [blame] | 41 | #define __KVM_HAVE_GUEST_DEBUG |
Sheng Yang | d510d6c | 2009-02-25 17:22:28 +0800 | [diff] [blame] | 42 | #define __KVM_HAVE_MSIX |
Huang Ying | 890ca9a | 2009-05-11 16:48:15 +0800 | [diff] [blame] | 43 | #define __KVM_HAVE_MCE |
Beth Kon | e9f4275 | 2009-07-07 11:50:38 -0400 | [diff] [blame] | 44 | #define __KVM_HAVE_PIT_STATE2 |
Ed Swierk | ffde22a | 2009-10-15 15:21:43 -0700 | [diff] [blame] | 45 | #define __KVM_HAVE_XEN_HVM |
Jan Kiszka | 3cfc309 | 2009-11-12 01:04:25 +0100 | [diff] [blame] | 46 | #define __KVM_HAVE_VCPU_EVENTS |
Jan Kiszka | a1efbe7 | 2010-02-15 10:45:43 +0100 | [diff] [blame] | 47 | #define __KVM_HAVE_DEBUGREGS |
Sheng Yang | 2d5b5a6 | 2010-06-13 17:29:39 +0800 | [diff] [blame] | 48 | #define __KVM_HAVE_XSAVE |
| 49 | #define __KVM_HAVE_XCRS |
Xiao Guangrong | 4d8b81a | 2012-08-21 11:02:51 +0800 | [diff] [blame] | 50 | #define __KVM_HAVE_READONLY_MEM |
Avi Kivity | 7a0eb19 | 2009-01-19 14:57:52 +0200 | [diff] [blame] | 51 | |
Jerone Young | 244d57e | 2007-11-19 17:06:36 -0600 | [diff] [blame] | 52 | /* Architectural interrupt line count. */ |
| 53 | #define KVM_NR_INTERRUPTS 256 |
| 54 | |
Jerone Young | f6a40e3 | 2007-11-19 17:06:31 -0600 | [diff] [blame] | 55 | struct kvm_memory_alias { |
| 56 | __u32 slot; /* this has a different namespace than memory slots */ |
| 57 | __u32 flags; |
| 58 | __u64 guest_phys_addr; |
| 59 | __u64 memory_size; |
| 60 | __u64 target_phys_addr; |
| 61 | }; |
| 62 | |
Jerone Young | da1386a | 2007-11-19 17:06:32 -0600 | [diff] [blame] | 63 | /* for KVM_GET_IRQCHIP and KVM_SET_IRQCHIP */ |
| 64 | struct kvm_pic_state { |
| 65 | __u8 last_irr; /* edge detection */ |
| 66 | __u8 irr; /* interrupt request register */ |
| 67 | __u8 imr; /* interrupt mask register */ |
| 68 | __u8 isr; /* interrupt service register */ |
| 69 | __u8 priority_add; /* highest irq priority */ |
| 70 | __u8 irq_base; |
| 71 | __u8 read_reg_select; |
| 72 | __u8 poll; |
| 73 | __u8 special_mask; |
| 74 | __u8 init_state; |
| 75 | __u8 auto_eoi; |
| 76 | __u8 rotate_on_auto_eoi; |
| 77 | __u8 special_fully_nested_mode; |
| 78 | __u8 init4; /* true if 4 byte init */ |
| 79 | __u8 elcr; /* PIIX edge/trigger selection */ |
| 80 | __u8 elcr_mask; |
| 81 | }; |
| 82 | |
| 83 | #define KVM_IOAPIC_NUM_PINS 24 |
| 84 | struct kvm_ioapic_state { |
| 85 | __u64 base_address; |
| 86 | __u32 ioregsel; |
| 87 | __u32 id; |
| 88 | __u32 irr; |
| 89 | __u32 pad; |
| 90 | union { |
| 91 | __u64 bits; |
| 92 | struct { |
| 93 | __u8 vector; |
| 94 | __u8 delivery_mode:3; |
| 95 | __u8 dest_mode:1; |
| 96 | __u8 delivery_status:1; |
| 97 | __u8 polarity:1; |
| 98 | __u8 remote_irr:1; |
| 99 | __u8 trig_mode:1; |
| 100 | __u8 mask:1; |
| 101 | __u8 reserve:7; |
| 102 | __u8 reserved[4]; |
| 103 | __u8 dest_id; |
| 104 | } fields; |
| 105 | } redirtbl[KVM_IOAPIC_NUM_PINS]; |
| 106 | }; |
| 107 | |
| 108 | #define KVM_IRQCHIP_PIC_MASTER 0 |
| 109 | #define KVM_IRQCHIP_PIC_SLAVE 1 |
| 110 | #define KVM_IRQCHIP_IOAPIC 2 |
Gleb Natapov | 3e71f88 | 2009-08-24 11:54:21 +0300 | [diff] [blame] | 111 | #define KVM_NR_IRQCHIPS 3 |
Jerone Young | da1386a | 2007-11-19 17:06:32 -0600 | [diff] [blame] | 112 | |
Paolo Bonzini | f077825 | 2015-04-01 15:06:40 +0200 | [diff] [blame] | 113 | #define KVM_RUN_X86_SMM (1 << 0) |
| 114 | |
Jerone Young | 19d30b1 | 2007-11-19 17:06:33 -0600 | [diff] [blame] | 115 | /* for KVM_GET_REGS and KVM_SET_REGS */ |
| 116 | struct kvm_regs { |
| 117 | /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */ |
| 118 | __u64 rax, rbx, rcx, rdx; |
| 119 | __u64 rsi, rdi, rsp, rbp; |
| 120 | __u64 r8, r9, r10, r11; |
| 121 | __u64 r12, r13, r14, r15; |
| 122 | __u64 rip, rflags; |
| 123 | }; |
| 124 | |
Jerone Young | d9ecf92 | 2007-11-19 17:06:34 -0600 | [diff] [blame] | 125 | /* for KVM_GET_LAPIC and KVM_SET_LAPIC */ |
| 126 | #define KVM_APIC_REG_SIZE 0x400 |
| 127 | struct kvm_lapic_state { |
| 128 | char regs[KVM_APIC_REG_SIZE]; |
| 129 | }; |
| 130 | |
Jerone Young | 3a56b20 | 2007-11-19 17:06:35 -0600 | [diff] [blame] | 131 | struct kvm_segment { |
| 132 | __u64 base; |
| 133 | __u32 limit; |
| 134 | __u16 selector; |
| 135 | __u8 type; |
| 136 | __u8 present, dpl, db, s, l, g, avl; |
| 137 | __u8 unusable; |
| 138 | __u8 padding; |
| 139 | }; |
| 140 | |
| 141 | struct kvm_dtable { |
| 142 | __u64 base; |
| 143 | __u16 limit; |
| 144 | __u16 padding[3]; |
| 145 | }; |
| 146 | |
| 147 | |
Jerone Young | 244d57e | 2007-11-19 17:06:36 -0600 | [diff] [blame] | 148 | /* for KVM_GET_SREGS and KVM_SET_SREGS */ |
| 149 | struct kvm_sregs { |
| 150 | /* out (KVM_GET_SREGS) / in (KVM_SET_SREGS) */ |
| 151 | struct kvm_segment cs, ds, es, fs, gs, ss; |
| 152 | struct kvm_segment tr, ldt; |
| 153 | struct kvm_dtable gdt, idt; |
| 154 | __u64 cr0, cr2, cr3, cr4, cr8; |
| 155 | __u64 efer; |
| 156 | __u64 apic_base; |
| 157 | __u64 interrupt_bitmap[(KVM_NR_INTERRUPTS + 63) / 64]; |
| 158 | }; |
| 159 | |
Christian Ehrhardt | 6f723c7 | 2008-01-08 08:04:50 +0100 | [diff] [blame] | 160 | /* for KVM_GET_FPU and KVM_SET_FPU */ |
| 161 | struct kvm_fpu { |
| 162 | __u8 fpr[8][16]; |
| 163 | __u16 fcw; |
| 164 | __u16 fsw; |
| 165 | __u8 ftwx; /* in fxsave format */ |
| 166 | __u8 pad1; |
| 167 | __u16 last_opcode; |
| 168 | __u64 last_ip; |
| 169 | __u64 last_dp; |
| 170 | __u8 xmm[16][16]; |
| 171 | __u32 mxcsr; |
| 172 | __u32 pad2; |
| 173 | }; |
| 174 | |
Jerone Young | 244d57e | 2007-11-19 17:06:36 -0600 | [diff] [blame] | 175 | struct kvm_msr_entry { |
| 176 | __u32 index; |
| 177 | __u32 reserved; |
| 178 | __u64 data; |
| 179 | }; |
| 180 | |
| 181 | /* for KVM_GET_MSRS and KVM_SET_MSRS */ |
| 182 | struct kvm_msrs { |
| 183 | __u32 nmsrs; /* number of msrs in entries */ |
| 184 | __u32 pad; |
| 185 | |
| 186 | struct kvm_msr_entry entries[0]; |
| 187 | }; |
| 188 | |
| 189 | /* for KVM_GET_MSR_INDEX_LIST */ |
| 190 | struct kvm_msr_list { |
| 191 | __u32 nmsrs; /* number of msrs in entries */ |
| 192 | __u32 indices[0]; |
| 193 | }; |
| 194 | |
| 195 | |
Jerone Young | a162dd5 | 2007-11-19 17:06:37 -0600 | [diff] [blame] | 196 | struct kvm_cpuid_entry { |
| 197 | __u32 function; |
| 198 | __u32 eax; |
| 199 | __u32 ebx; |
| 200 | __u32 ecx; |
| 201 | __u32 edx; |
| 202 | __u32 padding; |
| 203 | }; |
| 204 | |
| 205 | /* for KVM_SET_CPUID */ |
| 206 | struct kvm_cpuid { |
| 207 | __u32 nent; |
| 208 | __u32 padding; |
| 209 | struct kvm_cpuid_entry entries[0]; |
| 210 | }; |
| 211 | |
Dan Kenigsberg | 0771671 | 2007-11-21 17:10:04 +0200 | [diff] [blame] | 212 | struct kvm_cpuid_entry2 { |
| 213 | __u32 function; |
| 214 | __u32 index; |
| 215 | __u32 flags; |
| 216 | __u32 eax; |
| 217 | __u32 ebx; |
| 218 | __u32 ecx; |
| 219 | __u32 edx; |
| 220 | __u32 padding[3]; |
| 221 | }; |
| 222 | |
Borislav Petkov | 3dbe345 | 2016-05-05 10:18:23 +0200 | [diff] [blame] | 223 | #define KVM_CPUID_FLAG_SIGNIFCANT_INDEX (1 << 0) |
| 224 | #define KVM_CPUID_FLAG_STATEFUL_FUNC (1 << 1) |
| 225 | #define KVM_CPUID_FLAG_STATE_READ_NEXT (1 << 2) |
Dan Kenigsberg | 0771671 | 2007-11-21 17:10:04 +0200 | [diff] [blame] | 226 | |
| 227 | /* for KVM_SET_CPUID2 */ |
| 228 | struct kvm_cpuid2 { |
| 229 | __u32 nent; |
| 230 | __u32 padding; |
| 231 | struct kvm_cpuid_entry2 entries[0]; |
| 232 | }; |
Jerone Young | a162dd5 | 2007-11-19 17:06:37 -0600 | [diff] [blame] | 233 | |
Sheng Yang | e0f63cb | 2008-03-04 00:50:59 +0800 | [diff] [blame] | 234 | /* for KVM_GET_PIT and KVM_SET_PIT */ |
| 235 | struct kvm_pit_channel_state { |
| 236 | __u32 count; /* can be 65536 */ |
| 237 | __u16 latched_count; |
| 238 | __u8 count_latched; |
| 239 | __u8 status_latched; |
| 240 | __u8 status; |
| 241 | __u8 read_state; |
| 242 | __u8 write_state; |
| 243 | __u8 write_latch; |
| 244 | __u8 rw_mode; |
| 245 | __u8 mode; |
| 246 | __u8 bcd; |
| 247 | __u8 gate; |
| 248 | __s64 count_load_time; |
| 249 | }; |
| 250 | |
Jan Kiszka | d0bfb94 | 2008-12-15 13:52:10 +0100 | [diff] [blame] | 251 | struct kvm_debug_exit_arch { |
| 252 | __u32 exception; |
| 253 | __u32 pad; |
| 254 | __u64 pc; |
| 255 | __u64 dr6; |
| 256 | __u64 dr7; |
| 257 | }; |
| 258 | |
| 259 | #define KVM_GUESTDBG_USE_SW_BP 0x00010000 |
| 260 | #define KVM_GUESTDBG_USE_HW_BP 0x00020000 |
| 261 | #define KVM_GUESTDBG_INJECT_DB 0x00040000 |
| 262 | #define KVM_GUESTDBG_INJECT_BP 0x00080000 |
| 263 | |
| 264 | /* for KVM_SET_GUEST_DEBUG */ |
| 265 | struct kvm_guest_debug_arch { |
| 266 | __u64 debugreg[8]; |
| 267 | }; |
| 268 | |
Sheng Yang | e0f63cb | 2008-03-04 00:50:59 +0800 | [diff] [blame] | 269 | struct kvm_pit_state { |
| 270 | struct kvm_pit_channel_state channels[3]; |
| 271 | }; |
Marcelo Tosatti | 52d939a | 2008-12-30 15:55:06 -0200 | [diff] [blame] | 272 | |
Beth Kon | e9f4275 | 2009-07-07 11:50:38 -0400 | [diff] [blame] | 273 | #define KVM_PIT_FLAGS_HPET_LEGACY 0x00000001 |
| 274 | |
| 275 | struct kvm_pit_state2 { |
| 276 | struct kvm_pit_channel_state channels[3]; |
| 277 | __u32 flags; |
| 278 | __u32 reserved[9]; |
| 279 | }; |
| 280 | |
Marcelo Tosatti | 52d939a | 2008-12-30 15:55:06 -0200 | [diff] [blame] | 281 | struct kvm_reinject_control { |
| 282 | __u8 pit_reinject; |
| 283 | __u8 reserved[31]; |
| 284 | }; |
Jan Kiszka | 3cfc309 | 2009-11-12 01:04:25 +0100 | [diff] [blame] | 285 | |
Jan Kiszka | dab4b91 | 2009-12-06 18:24:15 +0100 | [diff] [blame] | 286 | /* When set in flags, include corresponding fields on KVM_SET_VCPU_EVENTS */ |
| 287 | #define KVM_VCPUEVENT_VALID_NMI_PENDING 0x00000001 |
| 288 | #define KVM_VCPUEVENT_VALID_SIPI_VECTOR 0x00000002 |
Jan Kiszka | 48005f6 | 2010-02-19 19:38:07 +0100 | [diff] [blame] | 289 | #define KVM_VCPUEVENT_VALID_SHADOW 0x00000004 |
Paolo Bonzini | f077825 | 2015-04-01 15:06:40 +0200 | [diff] [blame] | 290 | #define KVM_VCPUEVENT_VALID_SMM 0x00000008 |
Jan Kiszka | 48005f6 | 2010-02-19 19:38:07 +0100 | [diff] [blame] | 291 | |
| 292 | /* Interrupt shadow states */ |
| 293 | #define KVM_X86_SHADOW_INT_MOV_SS 0x01 |
| 294 | #define KVM_X86_SHADOW_INT_STI 0x02 |
Jan Kiszka | dab4b91 | 2009-12-06 18:24:15 +0100 | [diff] [blame] | 295 | |
Jan Kiszka | 3cfc309 | 2009-11-12 01:04:25 +0100 | [diff] [blame] | 296 | /* for KVM_GET/SET_VCPU_EVENTS */ |
| 297 | struct kvm_vcpu_events { |
| 298 | struct { |
| 299 | __u8 injected; |
| 300 | __u8 nr; |
| 301 | __u8 has_error_code; |
| 302 | __u8 pad; |
| 303 | __u32 error_code; |
| 304 | } exception; |
| 305 | struct { |
| 306 | __u8 injected; |
| 307 | __u8 nr; |
| 308 | __u8 soft; |
Jan Kiszka | 48005f6 | 2010-02-19 19:38:07 +0100 | [diff] [blame] | 309 | __u8 shadow; |
Jan Kiszka | 3cfc309 | 2009-11-12 01:04:25 +0100 | [diff] [blame] | 310 | } interrupt; |
| 311 | struct { |
| 312 | __u8 injected; |
| 313 | __u8 pending; |
| 314 | __u8 masked; |
| 315 | __u8 pad; |
| 316 | } nmi; |
| 317 | __u32 sipi_vector; |
| 318 | __u32 flags; |
Paolo Bonzini | f077825 | 2015-04-01 15:06:40 +0200 | [diff] [blame] | 319 | struct { |
| 320 | __u8 smm; |
| 321 | __u8 pending; |
| 322 | __u8 smm_inside_nmi; |
| 323 | __u8 latched_init; |
| 324 | } smi; |
| 325 | __u32 reserved[9]; |
Jan Kiszka | 3cfc309 | 2009-11-12 01:04:25 +0100 | [diff] [blame] | 326 | }; |
| 327 | |
Jan Kiszka | a1efbe7 | 2010-02-15 10:45:43 +0100 | [diff] [blame] | 328 | /* for KVM_GET/SET_DEBUGREGS */ |
| 329 | struct kvm_debugregs { |
| 330 | __u64 db[4]; |
| 331 | __u64 dr6; |
| 332 | __u64 dr7; |
| 333 | __u64 flags; |
| 334 | __u64 reserved[9]; |
| 335 | }; |
| 336 | |
Sheng Yang | 2d5b5a6 | 2010-06-13 17:29:39 +0800 | [diff] [blame] | 337 | /* for KVM_CAP_XSAVE */ |
| 338 | struct kvm_xsave { |
| 339 | __u32 region[1024]; |
| 340 | }; |
| 341 | |
| 342 | #define KVM_MAX_XCRS 16 |
| 343 | |
| 344 | struct kvm_xcr { |
| 345 | __u32 xcr; |
| 346 | __u32 reserved; |
| 347 | __u64 value; |
| 348 | }; |
| 349 | |
| 350 | struct kvm_xcrs { |
| 351 | __u32 nr_xcrs; |
| 352 | __u32 flags; |
| 353 | struct kvm_xcr xcrs[KVM_MAX_XCRS]; |
| 354 | __u64 padding[16]; |
| 355 | }; |
| 356 | |
Ken Hofsass | 01643c5 | 2018-01-31 16:03:36 -0800 | [diff] [blame] | 357 | #define KVM_SYNC_X86_REGS (1UL << 0) |
| 358 | #define KVM_SYNC_X86_SREGS (1UL << 1) |
| 359 | #define KVM_SYNC_X86_EVENTS (1UL << 2) |
| 360 | |
| 361 | #define KVM_SYNC_X86_VALID_FIELDS \ |
| 362 | (KVM_SYNC_X86_REGS| \ |
| 363 | KVM_SYNC_X86_SREGS| \ |
| 364 | KVM_SYNC_X86_EVENTS) |
| 365 | |
| 366 | /* kvm_sync_regs struct included by kvm_run struct */ |
Christian Borntraeger | b9e5dc8 | 2012-01-11 11:20:30 +0100 | [diff] [blame] | 367 | struct kvm_sync_regs { |
Ken Hofsass | 01643c5 | 2018-01-31 16:03:36 -0800 | [diff] [blame] | 368 | /* Members of this structure are potentially malicious. |
| 369 | * Care must be taken by code reading, esp. interpreting, |
| 370 | * data fields from them inside KVM to prevent TOCTOU and |
| 371 | * double-fetch types of vulnerabilities. |
| 372 | */ |
| 373 | struct kvm_regs regs; |
| 374 | struct kvm_sregs sregs; |
| 375 | struct kvm_vcpu_events events; |
Christian Borntraeger | b9e5dc8 | 2012-01-11 11:20:30 +0100 | [diff] [blame] | 376 | }; |
| 377 | |
Paolo Bonzini | 0da029e | 2015-07-23 08:24:42 +0200 | [diff] [blame] | 378 | #define KVM_X86_QUIRK_LINT0_REENABLED (1 << 0) |
| 379 | #define KVM_X86_QUIRK_CD_NW_CLEARED (1 << 1) |
Vitaly Kuznetsov | d176620 | 2018-08-02 17:08:16 +0200 | [diff] [blame] | 380 | #define KVM_X86_QUIRK_LAPIC_MMIO_HOLE (1 << 2) |
Nadav Amit | 90de4a1 | 2015-04-13 01:53:41 +0300 | [diff] [blame] | 381 | |
Jim Mattson | 8fcc4b5 | 2018-07-10 11:27:20 +0200 | [diff] [blame] | 382 | #define KVM_STATE_NESTED_GUEST_MODE 0x00000001 |
| 383 | #define KVM_STATE_NESTED_RUN_PENDING 0x00000002 |
Vitaly Kuznetsov | 8cab650 | 2018-10-16 18:50:09 +0200 | [diff] [blame^] | 384 | #define KVM_STATE_NESTED_EVMCS 0x00000004 |
Jim Mattson | 8fcc4b5 | 2018-07-10 11:27:20 +0200 | [diff] [blame] | 385 | |
| 386 | #define KVM_STATE_NESTED_SMM_GUEST_MODE 0x00000001 |
| 387 | #define KVM_STATE_NESTED_SMM_VMXON 0x00000002 |
| 388 | |
| 389 | struct kvm_vmx_nested_state { |
| 390 | __u64 vmxon_pa; |
| 391 | __u64 vmcs_pa; |
| 392 | |
| 393 | struct { |
| 394 | __u16 flags; |
| 395 | } smm; |
| 396 | }; |
| 397 | |
| 398 | /* for KVM_CAP_NESTED_STATE */ |
| 399 | struct kvm_nested_state { |
| 400 | /* KVM_STATE_* flags */ |
| 401 | __u16 flags; |
| 402 | |
| 403 | /* 0 for VMX, 1 for SVM. */ |
| 404 | __u16 format; |
| 405 | |
| 406 | /* 128 for SVM, 128 + VMCS size for VMX. */ |
| 407 | __u32 size; |
| 408 | |
| 409 | union { |
| 410 | /* VMXON, VMCS */ |
| 411 | struct kvm_vmx_nested_state vmx; |
| 412 | |
| 413 | /* Pad the header to 128 bytes. */ |
| 414 | __u8 pad[120]; |
| 415 | }; |
| 416 | |
| 417 | __u8 data[0]; |
| 418 | }; |
| 419 | |
H. Peter Anvin | 1965aae | 2008-10-22 22:26:29 -0700 | [diff] [blame] | 420 | #endif /* _ASM_X86_KVM_H */ |