From patchwork Tue Jun 9 21:30:10 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 29092 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 n59LYus0016047 for ; Tue, 9 Jun 2009 21:34:57 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756740AbZFIVev (ORCPT ); Tue, 9 Jun 2009 17:34:51 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756705AbZFIVev (ORCPT ); Tue, 9 Jun 2009 17:34:51 -0400 Received: from mx2.redhat.com ([66.187.237.31]:42280 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755361AbZFIVeu (ORCPT ); Tue, 9 Jun 2009 17:34:50 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n59LYr0R014183; Tue, 9 Jun 2009 17:34:53 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n59LYq2k001246; Tue, 9 Jun 2009 17:34:52 -0400 Received: from amt.cnet (vpn-10-71.str.redhat.com [10.32.10.71]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n59LYnmG020550; Tue, 9 Jun 2009 17:34:50 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 61DEC274FD3; Tue, 9 Jun 2009 18:34:16 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id n59LYEC5002987; Tue, 9 Jun 2009 18:34:14 -0300 Message-Id: <20090609213312.653450055@amt.cnet> User-Agent: quilt/0.47-1 Date: Tue, 09 Jun 2009 18:30:10 -0300 From: Marcelo Tosatti To: kvm@vger.kernel.org Cc: avi@redhat.com, sheng.yang@intel.com, Marcelo Tosatti Subject: [patch 1/5] KVM: VMX: more MSR_IA32_VMX_EPT_VPID_CAP capability bits References: <20090609213009.436123773@amt.cnet> Content-Disposition: inline; filename=vmx-ept-check-supported-bits X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Required for EPT misconfiguration handler. Signed-off-by: Marcelo Tosatti --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: kvm/arch/x86/include/asm/vmx.h =================================================================== --- kvm.orig/arch/x86/include/asm/vmx.h +++ kvm/arch/x86/include/asm/vmx.h @@ -351,9 +351,16 @@ enum vmcs_field { #define VMX_EPT_EXTENT_INDIVIDUAL_ADDR 0 #define VMX_EPT_EXTENT_CONTEXT 1 #define VMX_EPT_EXTENT_GLOBAL 2 + +#define VMX_EPT_EXECUTE_ONLY_BIT (1ull) +#define VMX_EPT_PAGE_WALK_4_BIT (1ull << 6) +#define VMX_EPTP_UC_BIT (1ull << 8) +#define VMX_EPTP_WB_BIT (1ull << 14) +#define VMX_EPT_2MB_PAGE_BIT (1ull << 16) #define VMX_EPT_EXTENT_INDIVIDUAL_BIT (1ull << 24) #define VMX_EPT_EXTENT_CONTEXT_BIT (1ull << 25) #define VMX_EPT_EXTENT_GLOBAL_BIT (1ull << 26) + #define VMX_EPT_DEFAULT_GAW 3 #define VMX_EPT_MAX_GAW 0x4 #define VMX_EPT_MT_EPTE_SHIFT 3 Index: kvm/arch/x86/kvm/vmx.c =================================================================== --- kvm.orig/arch/x86/kvm/vmx.c +++ kvm/arch/x86/kvm/vmx.c @@ -258,6 +258,26 @@ static inline bool cpu_has_vmx_flexprior cpu_has_vmx_virtualize_apic_accesses(); } +static inline bool cpu_has_vmx_ept_execute_only(void) +{ + return !!(vmx_capability.ept & VMX_EPT_EXECUTE_ONLY_BIT); +} + +static inline bool cpu_has_vmx_eptp_uncacheable(void) +{ + return !!(vmx_capability.ept & VMX_EPTP_UC_BIT); +} + +static inline bool cpu_has_vmx_eptp_writeback(void) +{ + return !!(vmx_capability.ept & VMX_EPTP_WB_BIT); +} + +static inline bool cpu_has_vmx_ept_2m_page(void) +{ + return !!(vmx_capability.ept & VMX_EPT_2MB_PAGE_BIT); +} + static inline int cpu_has_vmx_invept_individual_addr(void) { return !!(vmx_capability.ept & VMX_EPT_EXTENT_INDIVIDUAL_BIT);