kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: kvm@vger.kernel.org
Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>,
	Jun Nakajima <jun.nakajima@intel.com>,
	Yang Zhang <yang.z.zhang@intel.com>,
	pbonzini@redhat.com
Subject: [PATCH v7 13/15] nEPT: Advertise EPT to L1
Date: Tue, 6 Aug 2013 12:02:19 +0300	[thread overview]
Message-ID: <20130806090219.GI8218@redhat.com> (raw)
In-Reply-To: <1375690040-5764-14-git-send-email-gleb@redhat.com>

From: Nadav Har'El <nyh@il.ibm.com>

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.

Reviewed-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Signed-off-by: Nadav Har'El <nyh@il.ibm.com>
Signed-off-by: Jun Nakajima <jun.nakajima@intel.com>
Signed-off-by: Xinhao Xu <xinhao.xu@intel.com>
Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
Fix white space error.

 arch/x86/kvm/vmx.c |   20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 51c06c2..e23fdf2 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2250,6 +2250,22 @@ static __init void nested_vmx_setup_ctls_msrs(void)
 		SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |
 		SECONDARY_EXEC_WBINVD_EXITING;
 
+	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;
+		nested_vmx_ept_caps &= vmx_capability.ept;
+		/*
+		 * Since invept is completely emulated we support both global
+		 * and context invalidation independent of what host cpu
+		 * supports
+		 */
+		nested_vmx_ept_caps |= VMX_EPT_EXTENT_GLOBAL_BIT |
+			VMX_EPT_EXTENT_CONTEXT_BIT;
+	} else
+		nested_vmx_ept_caps = 0;
+
 	/* miscellaneous data */
 	rdmsr(MSR_IA32_VMX_MISC, nested_vmx_misc_low, nested_vmx_misc_high);
 	nested_vmx_misc_low &= VMX_MISC_PREEMPTION_TIMER_RATE_MASK |
@@ -2358,8 +2374,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.7.10.4

--
			Gleb.

  parent reply	other threads:[~2013-08-06  9:02 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-05  8:07 [PATCH v7 00/15] Nested EPT Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 01/15] nEPT: Support LOAD_IA32_EFER entry/exit controls for L1 Gleb Natapov
2013-08-05 11:27   ` Arthur Chunqi Li
2013-08-05 11:40     ` Gleb Natapov
2013-08-06  7:47       ` Jan Kiszka
2013-08-06  7:51         ` Gleb Natapov
2013-08-06  7:55           ` Jan Kiszka
2013-08-06  8:00             ` Gleb Natapov
2013-08-06  8:18               ` Jan Kiszka
2013-08-06  8:24                 ` Gleb Natapov
2013-08-05 11:48     ` Paolo Bonzini
2013-08-05 12:05       ` Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 02/15] nEPT: Fix cr3 handling in nested exit and entry Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 03/15] nEPT: Fix wrong test in kvm_set_cr3 Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 04/15] nEPT: Move common code to paging_tmpl.h Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 05/15] nEPT: make guest's A/D bits depends on guest's paging mode Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 06/15] nEPT: Support shadow paging for guest paging without A/D bits Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 07/15] nEPT: Add EPT tables support to paging_tmpl.h Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 08/15] nEPT: Redefine EPT-specific link_shadow_page() Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 09/15] nEPT: correctly check if remote tlb flush is needed for shadowed EPT tables Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 10/15] nEPT: Add nEPT violation/misconfigration support Gleb Natapov
2013-08-06  8:01   ` Jan Kiszka
2013-08-06  9:00   ` Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 11/15] nEPT: MMU context for nested EPT Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 12/15] nEPT: Nested INVEPT Gleb Natapov
2013-08-05  8:53   ` Xiao Guangrong
2013-08-05  8:07 ` [PATCH v7 13/15] nEPT: Advertise EPT to L1 Gleb Natapov
2013-08-06  8:20   ` Jan Kiszka
2013-08-06  9:02   ` Gleb Natapov [this message]
2013-08-05  8:07 ` [PATCH v7 14/15] nEPT: Some additional comments Gleb Natapov
2013-08-05  8:07 ` [PATCH v7 15/15] nEPT: Miscelleneous cleanups Gleb Natapov
2013-08-07 14:07 ` [PATCH v7 00/15] Nested EPT Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130806090219.GI8218@redhat.com \
    --to=gleb@redhat.com \
    --cc=jun.nakajima@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=xiaoguangrong@linux.vnet.ibm.com \
    --cc=yang.z.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).