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