From patchwork Wed Apr 1 07:52:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sheng Yang X-Patchwork-Id: 15593 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 n317qbEG009240 for ; Wed, 1 Apr 2009 07:52:38 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758942AbZDAHwi (ORCPT ); Wed, 1 Apr 2009 03:52:38 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756505AbZDAHwh (ORCPT ); Wed, 1 Apr 2009 03:52:37 -0400 Received: from mga14.intel.com ([143.182.124.37]:3871 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754373AbZDAHwg (ORCPT ); Wed, 1 Apr 2009 03:52:36 -0400 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga102.ch.intel.com with ESMTP; 01 Apr 2009 00:52:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.39,305,1235980800"; d="scan'208";a="126486977" Received: from syang10-desktop.sh.intel.com (HELO syang10-desktop) ([10.239.13.189]) by azsmga001.ch.intel.com with ESMTP; 01 Apr 2009 00:52:33 -0700 Received: from yasker by syang10-desktop with local (Exim 4.69) (envelope-from ) id 1LovFR-0004rk-0C; Wed, 01 Apr 2009 15:52:33 +0800 From: Sheng Yang To: Avi Kivity Cc: kvm@vger.kernel.org, Sheng Yang Subject: [PATCH 2/2] KVM: VMX: Fix feature testing Date: Wed, 1 Apr 2009 15:52:32 +0800 Message-Id: <1238572352-18684-2-git-send-email-sheng@linux.intel.com> X-Mailer: git-send-email 1.5.6.3 In-Reply-To: <1238572352-18684-1-git-send-email-sheng@linux.intel.com> References: <1238572352-18684-1-git-send-email-sheng@linux.intel.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The testing of feature is too early now, before vmcs_config complete initialization. Signed-off-by: Sheng Yang --- arch/x86/kvm/vmx.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 1caa1fc..7d7b0d6 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -1208,15 +1208,6 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf) vmx_capability.ept, vmx_capability.vpid); } - if (!cpu_has_vmx_vpid()) - enable_vpid = 0; - - if (!cpu_has_vmx_ept()) - enable_ept = 0; - - if (!cpu_has_vmx_flexpriority()) - flexpriority_enabled = 0; - min = 0; #ifdef CONFIG_X86_64 min |= VM_EXIT_HOST_ADDR_SPACE_SIZE; @@ -1320,6 +1311,15 @@ static __init int hardware_setup(void) if (boot_cpu_has(X86_FEATURE_NX)) kvm_enable_efer_bits(EFER_NX); + if (!cpu_has_vmx_vpid()) + enable_vpid = 0; + + if (!cpu_has_vmx_ept()) + enable_ept = 0; + + if (!cpu_has_vmx_flexpriority()) + flexpriority_enabled = 0; + return alloc_kvm_area(); }