diff options
-rw-r--r-- | arch/x86/kvm/vmx.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index d11be3fb7c80..fc1964d5e97c 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -803,12 +803,20 @@ static void vmx_fpu_activate(struct kvm_vcpu *vcpu) | |||
803 | if (kvm_read_cr0_bits(vcpu, X86_CR0_TS)) | 803 | if (kvm_read_cr0_bits(vcpu, X86_CR0_TS)) |
804 | vmcs_set_bits(GUEST_CR0, X86_CR0_TS); | 804 | vmcs_set_bits(GUEST_CR0, X86_CR0_TS); |
805 | update_exception_bitmap(vcpu); | 805 | update_exception_bitmap(vcpu); |
806 | vcpu->arch.cr0_guest_owned_bits = X86_CR0_TS; | ||
807 | vmcs_writel(CR0_GUEST_HOST_MASK, ~vcpu->arch.cr0_guest_owned_bits); | ||
806 | } | 808 | } |
807 | 809 | ||
810 | static void vmx_decache_cr0_guest_bits(struct kvm_vcpu *vcpu); | ||
811 | |||
808 | static void vmx_fpu_deactivate(struct kvm_vcpu *vcpu) | 812 | static void vmx_fpu_deactivate(struct kvm_vcpu *vcpu) |
809 | { | 813 | { |
814 | vmx_decache_cr0_guest_bits(vcpu); | ||
810 | vmcs_set_bits(GUEST_CR0, X86_CR0_TS); | 815 | vmcs_set_bits(GUEST_CR0, X86_CR0_TS); |
811 | update_exception_bitmap(vcpu); | 816 | update_exception_bitmap(vcpu); |
817 | vcpu->arch.cr0_guest_owned_bits = 0; | ||
818 | vmcs_writel(CR0_GUEST_HOST_MASK, ~vcpu->arch.cr0_guest_owned_bits); | ||
819 | vmcs_writel(CR0_READ_SHADOW, vcpu->arch.cr0); | ||
812 | } | 820 | } |
813 | 821 | ||
814 | static unsigned long vmx_get_rflags(struct kvm_vcpu *vcpu) | 822 | static unsigned long vmx_get_rflags(struct kvm_vcpu *vcpu) |
@@ -2996,8 +3004,7 @@ static int handle_cr(struct kvm_vcpu *vcpu) | |||
2996 | }; | 3004 | }; |
2997 | break; | 3005 | break; |
2998 | case 2: /* clts */ | 3006 | case 2: /* clts */ |
2999 | vcpu->arch.cr0 &= ~X86_CR0_TS; | 3007 | vmx_set_cr0(vcpu, kvm_read_cr0_bits(vcpu, ~X86_CR0_TS)); |
3000 | vmcs_writel(CR0_READ_SHADOW, kvm_read_cr0(vcpu)); | ||
3001 | trace_kvm_cr_write(0, kvm_read_cr0(vcpu)); | 3008 | trace_kvm_cr_write(0, kvm_read_cr0(vcpu)); |
3002 | skip_emulated_instruction(vcpu); | 3009 | skip_emulated_instruction(vcpu); |
3003 | return 1; | 3010 | return 1; |