diff options
Diffstat (limited to 'arch/x86/include/asm/kvm_host.h')
-rw-r--r-- | arch/x86/include/asm/kvm_host.h | 61 |
1 files changed, 47 insertions, 14 deletions
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 730843d1d2fb..f0faf58044ff 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <asm/pvclock-abi.h> | 22 | #include <asm/pvclock-abi.h> |
23 | #include <asm/desc.h> | 23 | #include <asm/desc.h> |
24 | #include <asm/mtrr.h> | 24 | #include <asm/mtrr.h> |
25 | #include <asm/msr-index.h> | ||
25 | 26 | ||
26 | #define KVM_MAX_VCPUS 16 | 27 | #define KVM_MAX_VCPUS 16 |
27 | #define KVM_MEMORY_SLOTS 32 | 28 | #define KVM_MEMORY_SLOTS 32 |
@@ -134,11 +135,18 @@ enum { | |||
134 | 135 | ||
135 | #define KVM_NR_MEM_OBJS 40 | 136 | #define KVM_NR_MEM_OBJS 40 |
136 | 137 | ||
137 | struct kvm_guest_debug { | 138 | #define KVM_NR_DB_REGS 4 |
138 | int enabled; | 139 | |
139 | unsigned long bp[4]; | 140 | #define DR6_BD (1 << 13) |
140 | int singlestep; | 141 | #define DR6_BS (1 << 14) |
141 | }; | 142 | #define DR6_FIXED_1 0xffff0ff0 |
143 | #define DR6_VOLATILE 0x0000e00f | ||
144 | |||
145 | #define DR7_BP_EN_MASK 0x000000ff | ||
146 | #define DR7_GE (1 << 9) | ||
147 | #define DR7_GD (1 << 13) | ||
148 | #define DR7_FIXED_1 0x00000400 | ||
149 | #define DR7_VOLATILE 0xffff23ff | ||
142 | 150 | ||
143 | /* | 151 | /* |
144 | * We don't want allocation failures within the mmu code, so we preallocate | 152 | * We don't want allocation failures within the mmu code, so we preallocate |
@@ -162,7 +170,8 @@ struct kvm_pte_chain { | |||
162 | * bits 0:3 - total guest paging levels (2-4, or zero for real mode) | 170 | * bits 0:3 - total guest paging levels (2-4, or zero for real mode) |
163 | * bits 4:7 - page table level for this shadow (1-4) | 171 | * bits 4:7 - page table level for this shadow (1-4) |
164 | * bits 8:9 - page table quadrant for 2-level guests | 172 | * bits 8:9 - page table quadrant for 2-level guests |
165 | * bit 16 - "metaphysical" - gfn is not a real page (huge page/real mode) | 173 | * bit 16 - direct mapping of virtual to physical mapping at gfn |
174 | * used for real mode and two-dimensional paging | ||
166 | * bits 17:19 - common access permissions for all ptes in this shadow page | 175 | * bits 17:19 - common access permissions for all ptes in this shadow page |
167 | */ | 176 | */ |
168 | union kvm_mmu_page_role { | 177 | union kvm_mmu_page_role { |
@@ -172,9 +181,10 @@ union kvm_mmu_page_role { | |||
172 | unsigned level:4; | 181 | unsigned level:4; |
173 | unsigned quadrant:2; | 182 | unsigned quadrant:2; |
174 | unsigned pad_for_nice_hex_output:6; | 183 | unsigned pad_for_nice_hex_output:6; |
175 | unsigned metaphysical:1; | 184 | unsigned direct:1; |
176 | unsigned access:3; | 185 | unsigned access:3; |
177 | unsigned invalid:1; | 186 | unsigned invalid:1; |
187 | unsigned cr4_pge:1; | ||
178 | }; | 188 | }; |
179 | }; | 189 | }; |
180 | 190 | ||
@@ -218,6 +228,18 @@ struct kvm_pv_mmu_op_buffer { | |||
218 | char buf[512] __aligned(sizeof(long)); | 228 | char buf[512] __aligned(sizeof(long)); |
219 | }; | 229 | }; |
220 | 230 | ||
231 | struct kvm_pio_request { | ||
232 | unsigned long count; | ||
233 | int cur_count; | ||
234 | gva_t guest_gva; | ||
235 | int in; | ||
236 | int port; | ||
237 | int size; | ||
238 | int string; | ||
239 | int down; | ||
240 | int rep; | ||
241 | }; | ||
242 | |||
221 | /* | 243 | /* |
222 | * x86 supports 3 paging modes (4-level 64-bit, 3-level 64-bit, and 2-level | 244 | * x86 supports 3 paging modes (4-level 64-bit, 3-level 64-bit, and 2-level |
223 | * 32-bit). The kvm_mmu structure abstracts the details of the current mmu | 245 | * 32-bit). The kvm_mmu structure abstracts the details of the current mmu |
@@ -236,6 +258,7 @@ struct kvm_mmu { | |||
236 | hpa_t root_hpa; | 258 | hpa_t root_hpa; |
237 | int root_level; | 259 | int root_level; |
238 | int shadow_root_level; | 260 | int shadow_root_level; |
261 | union kvm_mmu_page_role base_role; | ||
239 | 262 | ||
240 | u64 *pae_root; | 263 | u64 *pae_root; |
241 | }; | 264 | }; |
@@ -258,6 +281,7 @@ struct kvm_vcpu_arch { | |||
258 | unsigned long cr3; | 281 | unsigned long cr3; |
259 | unsigned long cr4; | 282 | unsigned long cr4; |
260 | unsigned long cr8; | 283 | unsigned long cr8; |
284 | u32 hflags; | ||
261 | u64 pdptrs[4]; /* pae */ | 285 | u64 pdptrs[4]; /* pae */ |
262 | u64 shadow_efer; | 286 | u64 shadow_efer; |
263 | u64 apic_base; | 287 | u64 apic_base; |
@@ -338,6 +362,15 @@ struct kvm_vcpu_arch { | |||
338 | 362 | ||
339 | struct mtrr_state_type mtrr_state; | 363 | struct mtrr_state_type mtrr_state; |
340 | u32 pat; | 364 | u32 pat; |
365 | |||
366 | int switch_db_regs; | ||
367 | unsigned long host_db[KVM_NR_DB_REGS]; | ||
368 | unsigned long host_dr6; | ||
369 | unsigned long host_dr7; | ||
370 | unsigned long db[KVM_NR_DB_REGS]; | ||
371 | unsigned long dr6; | ||
372 | unsigned long dr7; | ||
373 | unsigned long eff_db[KVM_NR_DB_REGS]; | ||
341 | }; | 374 | }; |
342 | 375 | ||
343 | struct kvm_mem_alias { | 376 | struct kvm_mem_alias { |
@@ -378,6 +411,7 @@ struct kvm_arch{ | |||
378 | 411 | ||
379 | unsigned long irq_sources_bitmap; | 412 | unsigned long irq_sources_bitmap; |
380 | unsigned long irq_states[KVM_IOAPIC_NUM_PINS]; | 413 | unsigned long irq_states[KVM_IOAPIC_NUM_PINS]; |
414 | u64 vm_init_tsc; | ||
381 | }; | 415 | }; |
382 | 416 | ||
383 | struct kvm_vm_stat { | 417 | struct kvm_vm_stat { |
@@ -446,8 +480,7 @@ struct kvm_x86_ops { | |||
446 | void (*vcpu_put)(struct kvm_vcpu *vcpu); | 480 | void (*vcpu_put)(struct kvm_vcpu *vcpu); |
447 | 481 | ||
448 | int (*set_guest_debug)(struct kvm_vcpu *vcpu, | 482 | int (*set_guest_debug)(struct kvm_vcpu *vcpu, |
449 | struct kvm_debug_guest *dbg); | 483 | struct kvm_guest_debug *dbg); |
450 | void (*guest_debug_pre)(struct kvm_vcpu *vcpu); | ||
451 | int (*get_msr)(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata); | 484 | int (*get_msr)(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata); |
452 | int (*set_msr)(struct kvm_vcpu *vcpu, u32 msr_index, u64 data); | 485 | int (*set_msr)(struct kvm_vcpu *vcpu, u32 msr_index, u64 data); |
453 | u64 (*get_segment_base)(struct kvm_vcpu *vcpu, int seg); | 486 | u64 (*get_segment_base)(struct kvm_vcpu *vcpu, int seg); |
@@ -583,16 +616,12 @@ void kvm_queue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code); | |||
583 | void kvm_inject_page_fault(struct kvm_vcpu *vcpu, unsigned long cr2, | 616 | void kvm_inject_page_fault(struct kvm_vcpu *vcpu, unsigned long cr2, |
584 | u32 error_code); | 617 | u32 error_code); |
585 | 618 | ||
586 | void kvm_pic_set_irq(void *opaque, int irq, int level); | 619 | int kvm_pic_set_irq(void *opaque, int irq, int level); |
587 | 620 | ||
588 | void kvm_inject_nmi(struct kvm_vcpu *vcpu); | 621 | void kvm_inject_nmi(struct kvm_vcpu *vcpu); |
589 | 622 | ||
590 | void fx_init(struct kvm_vcpu *vcpu); | 623 | void fx_init(struct kvm_vcpu *vcpu); |
591 | 624 | ||
592 | int emulator_read_std(unsigned long addr, | ||
593 | void *val, | ||
594 | unsigned int bytes, | ||
595 | struct kvm_vcpu *vcpu); | ||
596 | int emulator_write_emulated(unsigned long addr, | 625 | int emulator_write_emulated(unsigned long addr, |
597 | const void *val, | 626 | const void *val, |
598 | unsigned int bytes, | 627 | unsigned int bytes, |
@@ -737,6 +766,10 @@ enum { | |||
737 | TASK_SWITCH_GATE = 3, | 766 | TASK_SWITCH_GATE = 3, |
738 | }; | 767 | }; |
739 | 768 | ||
769 | #define HF_GIF_MASK (1 << 0) | ||
770 | #define HF_HIF_MASK (1 << 1) | ||
771 | #define HF_VINTR_MASK (1 << 2) | ||
772 | |||
740 | /* | 773 | /* |
741 | * Hardware virtualization extension instructions may fault if a | 774 | * Hardware virtualization extension instructions may fault if a |
742 | * reboot turns off virtualization while processes are running. | 775 | * reboot turns off virtualization while processes are running. |