From patchwork Mon Feb 1 16:48:27 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 76114 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o11GnSwj012065 for ; Mon, 1 Feb 2010 16:49:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753843Ab0BAQtI (ORCPT ); Mon, 1 Feb 2010 11:49:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:25898 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753764Ab0BAQtE (ORCPT ); Mon, 1 Feb 2010 11:49:04 -0500 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o11Gn44T027541 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 1 Feb 2010 11:49:04 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o11Gn31j015716; Mon, 1 Feb 2010 11:49:03 -0500 Received: from amt.cnet (vpn-11-115.rdu.redhat.com [10.11.11.115]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o11Gn1ux024838; Mon, 1 Feb 2010 11:49:02 -0500 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 93C9E68A031; Mon, 1 Feb 2010 14:48:28 -0200 (BRST) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id o11GmRfO003416; Mon, 1 Feb 2010 14:48:27 -0200 Date: Mon, 1 Feb 2010 14:48:27 -0200 From: Marcelo Tosatti To: kvm Cc: Avi Kivity Subject: KVM: VMX: update cr0 read shadow when deactivating cr0.ts passthrough Message-ID: <20100201164827.GA3225@amt.cnet> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-08-17) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 01 Feb 2010 16:49:28 +0000 (UTC) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index c1d864a..334b016 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -805,19 +805,16 @@ static void vmx_fpu_activate(struct kvm_vcpu *vcpu) vmcs_writel(CR0_GUEST_HOST_MASK, ~vcpu->arch.cr0_guest_owned_bits); } +static void vmx_decache_cr0_guest_bits(struct kvm_vcpu *vcpu); + static void vmx_fpu_deactivate(struct kvm_vcpu *vcpu) { - ulong old_ts, old_cr0; - - old_ts = kvm_read_cr0_bits(vcpu, X86_CR0_TS); + vmx_decache_cr0_guest_bits(vcpu); vmcs_set_bits(GUEST_CR0, X86_CR0_TS | X86_CR0_MP); update_exception_bitmap(vcpu); vcpu->arch.cr0_guest_owned_bits = 0; vmcs_writel(CR0_GUEST_HOST_MASK, ~vcpu->arch.cr0_guest_owned_bits); - old_cr0 = vcpu->arch.cr0; - vcpu->arch.cr0 = (vcpu->arch.cr0 & ~X86_CR0_TS) | old_ts; - if (vcpu->arch.cr0 != old_cr0) - vmcs_writel(CR0_READ_SHADOW, vcpu->arch.cr0); + vmcs_writel(CR0_READ_SHADOW, vcpu->arch.cr0); } static unsigned long vmx_get_rflags(struct kvm_vcpu *vcpu)