From patchwork Mon Mar 30 02:38:22 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dong, Eddie" X-Patchwork-Id: 15080 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n2U2dp8V015842 for ; Mon, 30 Mar 2009 02:39:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756526AbZC3Cjt (ORCPT ); Sun, 29 Mar 2009 22:39:49 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756519AbZC3Cjt (ORCPT ); Sun, 29 Mar 2009 22:39:49 -0400 Received: from mga01.intel.com ([192.55.52.88]:23624 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756525AbZC3Cjt (ORCPT ); Sun, 29 Mar 2009 22:39:49 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 29 Mar 2009 19:31:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.38,443,1233561600"; d="scan'208";a="443127484" Received: from pgsmsx603.gar.corp.intel.com ([10.221.43.87]) by fmsmga002.fm.intel.com with ESMTP; 29 Mar 2009 19:35:04 -0700 Received: from pdsmsx602.ccr.corp.intel.com (172.16.12.184) by pgsmsx603.gar.corp.intel.com (10.221.43.87) with Microsoft SMTP Server (TLS) id 8.1.340.0; Mon, 30 Mar 2009 10:38:47 +0800 Received: from pdsmsx503.ccr.corp.intel.com ([172.16.12.95]) by pdsmsx602.ccr.corp.intel.com ([172.16.12.184]) with mapi; Mon, 30 Mar 2009 10:38:23 +0800 From: "Dong, Eddie" To: "Dong, Eddie" , Avi Kivity CC: "kvm@vger.kernel.org" , "Dong, Eddie" Date: Mon, 30 Mar 2009 10:38:22 +0800 Subject: Cleanup to reuse is_long_mode() Thread-Topic: Cleanup to reuse is_long_mode() Thread-Index: AcmwWGazNA3uw50+Q6aDKED1Wo3cTQAgRGUgAAGtbCA= Message-ID: <9832F13BD22FB94A829F798DA4A8280501A3C01E87@pdsmsx503.ccr.corp.intel.com> References: <9832F13BD22FB94A829F798DA4A8280501A21068EF@pdsmsx503.ccr.corp.intel.com> <9832F13BD22FB94A829F798DA4A8280501A2106E6A@pdsmsx503.ccr.corp.intel.com> <49CC9DAB.8090802@redhat.com> <9832F13BD22FB94A829F798DA4A8280501A2107197@pdsmsx503.ccr.corp.intel.com> <49CCE275.9070608@redhat.com> <9832F13BD22FB94A829F798DA4A8280501A21071B0@pdsmsx503.ccr.corp.intel.com> <49CF4C1B.3010404@redhat.com> <9832F13BD22FB94A829F798DA4A8280501A3C01DDE@pdsmsx503.ccr.corp.intel.com> In-Reply-To: <9832F13BD22FB94A829F798DA4A8280501A3C01DDE@pdsmsx503.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Thanks, Eddie commit 6688a1fbc37330f2c4e16d1a78050b64e1ce5dcc Author: root Date: Mon Mar 30 11:31:10 2009 +0800 cleanup to reuse is_long_mode(vcpu) Signed-off-by: Eddie Dong diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index db5021b..affc31d 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -859,7 +859,7 @@ static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) struct vcpu_svm *svm = to_svm(vcpu); #ifdef CONFIG_X86_64 - if (vcpu->arch.shadow_efer & EFER_LME) { + if (is_long_mode(vcpu)) { if (!is_paging(vcpu) && (cr0 & X86_CR0_PG)) { vcpu->arch.shadow_efer |= EFER_LMA; svm->vmcb->save.efer |= EFER_LMA | EFER_LME; diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 9913a1d..b1f1458 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -1543,7 +1543,7 @@ static void vmx_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) enter_rmode(vcpu); #ifdef CONFIG_X86_64 - if (vcpu->arch.shadow_efer & EFER_LME) { + if (is_long_mode(vcpu)) { if (!is_paging(vcpu) && (cr0 & X86_CR0_PG)) enter_lmode(vcpu); if (is_paging(vcpu) && !(cr0 & X86_CR0_PG)) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index bf6683a..961bd2b 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -289,7 +289,7 @@ void kvm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) if (!is_paging(vcpu) && (cr0 & X86_CR0_PG)) { #ifdef CONFIG_X86_64 - if ((vcpu->arch.shadow_efer & EFER_LME)) { + if (is_long_mode(vcpu)) { int cs_db, cs_l; if (!is_pae(vcpu)) {