aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/vmx.c
diff options
context:
space:
mode:
authorWanpeng Li <wanpeng.li@linux.intel.com>2014-12-02 06:14:58 -0500
committerPaolo Bonzini <pbonzini@redhat.com>2014-12-05 07:57:33 -0500
commitf53cd63c2dfcf8f306f4ed31e78840bf9a04bc0b (patch)
tree17fe27a1572ae4e3e0f3eccfbac0978927235f17 /arch/x86/kvm/vmx.c
parent404e0a19e155e2303a081109f3ae5e625ac8030a (diff)
kvm: x86: handle XSAVES vmcs and vmexit
Initialize the XSS exit bitmap. It is zero so there should be no XSAVES or XRSTORS exits. Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com> Reviewed-by: Radim Krčmář <rkrcmar@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r--arch/x86/kvm/vmx.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index dd4fa461454a..88048c72b6b1 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -761,6 +761,7 @@ static u64 construct_eptp(unsigned long root_hpa);
761static void kvm_cpu_vmxon(u64 addr); 761static void kvm_cpu_vmxon(u64 addr);
762static void kvm_cpu_vmxoff(void); 762static void kvm_cpu_vmxoff(void);
763static bool vmx_mpx_supported(void); 763static bool vmx_mpx_supported(void);
764static bool vmx_xsaves_supported(void);
764static int vmx_set_tss_addr(struct kvm *kvm, unsigned int addr); 765static int vmx_set_tss_addr(struct kvm *kvm, unsigned int addr);
765static void vmx_set_segment(struct kvm_vcpu *vcpu, 766static void vmx_set_segment(struct kvm_vcpu *vcpu,
766 struct kvm_segment *var, int seg); 767 struct kvm_segment *var, int seg);
@@ -4337,6 +4338,7 @@ static void ept_set_mmio_spte_mask(void)
4337 kvm_mmu_set_mmio_spte_mask((0x3ull << 62) | 0x6ull); 4338 kvm_mmu_set_mmio_spte_mask((0x3ull << 62) | 0x6ull);
4338} 4339}
4339 4340
4341#define VMX_XSS_EXIT_BITMAP 0
4340/* 4342/*
4341 * Sets up the vmcs for emulated real mode. 4343 * Sets up the vmcs for emulated real mode.
4342 */ 4344 */
@@ -4446,6 +4448,9 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
4446 vmcs_writel(CR0_GUEST_HOST_MASK, ~0UL); 4448 vmcs_writel(CR0_GUEST_HOST_MASK, ~0UL);
4447 set_cr4_guest_host_mask(vmx); 4449 set_cr4_guest_host_mask(vmx);
4448 4450
4451 if (vmx_xsaves_supported())
4452 vmcs_write64(XSS_EXIT_BITMAP, VMX_XSS_EXIT_BITMAP);
4453
4449 return 0; 4454 return 0;
4450} 4455}
4451 4456
@@ -5334,6 +5339,20 @@ static int handle_xsetbv(struct kvm_vcpu *vcpu)
5334 return 1; 5339 return 1;
5335} 5340}
5336 5341
5342static int handle_xsaves(struct kvm_vcpu *vcpu)
5343{
5344 skip_emulated_instruction(vcpu);
5345 WARN(1, "this should never happen\n");
5346 return 1;
5347}
5348
5349static int handle_xrstors(struct kvm_vcpu *vcpu)
5350{
5351 skip_emulated_instruction(vcpu);
5352 WARN(1, "this should never happen\n");
5353 return 1;
5354}
5355
5337static int handle_apic_access(struct kvm_vcpu *vcpu) 5356static int handle_apic_access(struct kvm_vcpu *vcpu)
5338{ 5357{
5339 if (likely(fasteoi)) { 5358 if (likely(fasteoi)) {
@@ -6951,6 +6970,8 @@ static int (*const kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = {
6951 [EXIT_REASON_MONITOR_INSTRUCTION] = handle_monitor, 6970 [EXIT_REASON_MONITOR_INSTRUCTION] = handle_monitor,
6952 [EXIT_REASON_INVEPT] = handle_invept, 6971 [EXIT_REASON_INVEPT] = handle_invept,
6953 [EXIT_REASON_INVVPID] = handle_invvpid, 6972 [EXIT_REASON_INVVPID] = handle_invvpid,
6973 [EXIT_REASON_XSAVES] = handle_xsaves,
6974 [EXIT_REASON_XRSTORS] = handle_xrstors,
6954}; 6975};
6955 6976
6956static const int kvm_vmx_max_exit_handlers = 6977static const int kvm_vmx_max_exit_handlers =