From patchwork Fri Sep 7 07:36:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ren, Yongjie" X-Patchwork-Id: 1420521 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id F17C33FC85 for ; Fri, 7 Sep 2012 07:37:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756953Ab2IGHhE (ORCPT ); Fri, 7 Sep 2012 03:37:04 -0400 Received: from mga01.intel.com ([192.55.52.88]:40134 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756308Ab2IGHhC convert rfc822-to-8bit (ORCPT ); Fri, 7 Sep 2012 03:37:02 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 07 Sep 2012 00:37:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,384,1344236400"; d="scan'208";a="219223443" Received: from fmsmsx103.amr.corp.intel.com ([10.19.9.34]) by fmsmga001.fm.intel.com with ESMTP; 07 Sep 2012 00:37:02 -0700 Received: from fmsmsx101.amr.corp.intel.com (10.19.9.52) by FMSMSX103.amr.corp.intel.com (10.19.9.34) with Microsoft SMTP Server (TLS) id 14.1.355.2; Fri, 7 Sep 2012 00:37:01 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX101.amr.corp.intel.com (10.19.9.52) with Microsoft SMTP Server (TLS) id 14.1.355.2; Fri, 7 Sep 2012 00:37:01 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.239]) by SHSMSX102.ccr.corp.intel.com ([169.254.2.92]) with mapi id 14.01.0355.002; Fri, 7 Sep 2012 15:37:00 +0800 From: "Ren, Yongjie" To: "'kvm@vger.kernel.org'" CC: Avi Kivity Subject: [PATCH v2] KVM: x86: Check INVPCID feature bit in EBX of leaf 7 Thread-Topic: [PATCH v2] KVM: x86: Check INVPCID feature bit in EBX of leaf 7 Thread-Index: Ac2My44i6yZmaPZ5TK2fGVs/ESqMYQ== Date: Fri, 7 Sep 2012 07:36:59 +0000 Message-ID: <1B4B44D9196EFF41AE41FDA404FC0A101937B1@SHSMSX101.ccr.corp.intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Checks and operations on the INVPCID feature bit should use EBX of CPUID leaf 7 instead of ECX. Changes from v1: - fixed patch format issue. Signed-off-by: Junjie Mao Signed-off-by: Yongjie Ren --- arch/x86/kvm/vmx.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 248c2b4..40eacea 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -6552,7 +6552,7 @@ static void vmx_cpuid_update(struct kvm_vcpu *vcpu) /* Exposing INVPCID only when PCID is exposed */ best = kvm_find_cpuid_entry(vcpu, 0x7, 0); if (vmx_invpcid_supported() && - best && (best->ecx & bit(X86_FEATURE_INVPCID)) && + best && (best->ebx & bit(X86_FEATURE_INVPCID)) && guest_cpuid_has_pcid(vcpu)) { exec_control |= SECONDARY_EXEC_ENABLE_INVPCID; vmcs_write32(SECONDARY_VM_EXEC_CONTROL, @@ -6562,7 +6562,7 @@ static void vmx_cpuid_update(struct kvm_vcpu *vcpu) vmcs_write32(SECONDARY_VM_EXEC_CONTROL, exec_control); if (best) - best->ecx &= ~bit(X86_FEATURE_INVPCID); + best->ebx &= ~bit(X86_FEATURE_INVPCID); } }