From patchwork Thu Apr 25 07:51:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nakajima, Jun" X-Patchwork-Id: 2487421 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 4BD8A3FC64 for ; Thu, 25 Apr 2013 07:51:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756186Ab3DYHvi (ORCPT ); Thu, 25 Apr 2013 03:51:38 -0400 Received: from mail-vb0-f47.google.com ([209.85.212.47]:39540 "EHLO mail-vb0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755873Ab3DYHvh (ORCPT ); Thu, 25 Apr 2013 03:51:37 -0400 Received: by mail-vb0-f47.google.com with SMTP id x13so2392611vbb.20 for ; Thu, 25 Apr 2013 00:51:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type:x-gm-message-state; bh=bRqZYL8yC/dnvFSe6Ud9JQ/y5Ue4UBdVcJZsPHlOYHs=; b=lfVx1nFC3BQgL/I8SqaF4MSXHorXyclgFIaa35wf4ODK+P7A+fHwhQB1ooor/Vb+he V1GKMP0nLXrVL1YF9r5O0epmlszrcUWfm0mPAWrq27zSGzuOA21VQHsugslDM0vLIQXX 8cb/vMvgb6VebtOP+ISpFtDCasazbWs/yR5T+WRZh7xSfOtM3x5+yHoehcx4l9HUIGsp 9GXkRcT/Dvfr04/rH1Y/uT5evJL3Izi9AqPL7JT/AY6AUOJxftZfcmsYxchJTfIJyZ68 4G46R64X/ZVBTIsNgKt2wsXZspoIQ6KEAd8KRvSBgrbixUghz0D2RL8qO5f39mFQZfpi +ifg== MIME-Version: 1.0 X-Received: by 10.52.25.99 with SMTP id b3mr22423753vdg.99.1366876296650; Thu, 25 Apr 2013 00:51:36 -0700 (PDT) Received: by 10.58.64.196 with HTTP; Thu, 25 Apr 2013 00:51:36 -0700 (PDT) Date: Thu, 25 Apr 2013 00:51:36 -0700 Message-ID: Subject: [PATCH 07/12] Subject: [PATCH 07/10] nEPT: Advertise EPT to L1 From: "Nakajima, Jun" To: "kvm@vger.kernel.org" X-Gm-Message-State: ALoCoQkIKdeG63N1emQ9VzOMRuG3VzplhcM8xi8AEO98ZCseuYXUMkSkJafBMgTF4SlDBVTaIku1 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Advertise the support of EPT to the L1 guest, through the appropriate MSR. This is the last patch of the basic Nested EPT feature, so as to allow bisection through this patch series: The guest will not see EPT support until this last patch, and will not attempt to use the half-applied feature. Signed-off-by: Nadav Har'El Signed-off-by: Jun Nakajima modified: arch/x86/kvm/vmx.c --- arch/x86/kvm/vmx.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) /* @@ -2101,6 +2102,18 @@ static __init void nested_vmx_setup_ctls_msrs(void) nested_vmx_secondary_ctls_low = 0; nested_vmx_secondary_ctls_high &= SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES; + if (enable_ept) { + /* nested EPT: emulate EPT also to L1 */ + nested_vmx_secondary_ctls_high |= SECONDARY_EXEC_ENABLE_EPT; + nested_vmx_ept_caps = VMX_EPT_PAGE_WALK_4_BIT; + nested_vmx_ept_caps |= + VMX_EPT_INVEPT_BIT | VMX_EPT_EXTENT_GLOBAL_BIT | + VMX_EPT_EXTENT_CONTEXT_BIT | + VMX_EPT_EXTENT_INDIVIDUAL_BIT; + nested_vmx_ept_caps &= vmx_capability.ept; + } else + nested_vmx_ept_caps = 0; + } static inline bool vmx_control_verify(u32 control, u32 low, u32 high) @@ -2200,8 +2213,8 @@ static int vmx_get_vmx_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata) nested_vmx_secondary_ctls_high); break; case MSR_IA32_VMX_EPT_VPID_CAP: - /* Currently, no nested ept or nested vpid */ - *pdata = 0; + /* Currently, no nested vpid support */ + *pdata = nested_vmx_ept_caps; break; default: return 0; -- 1.8.2.1.610.g562af5b -- 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 diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 0e99b15..a5e14d1 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -2026,6 +2026,7 @@ static u32 nested_vmx_secondary_ctls_low, nested_vmx_secondary_ctls_high; static u32 nested_vmx_pinbased_ctls_low, nested_vmx_pinbased_ctls_high; static u32 nested_vmx_exit_ctls_low, nested_vmx_exit_ctls_high; static u32 nested_vmx_entry_ctls_low, nested_vmx_entry_ctls_high; +static u32 nested_vmx_ept_caps; static __init void nested_vmx_setup_ctls_msrs(void) {