From: Bandan Das <bsd@redhat.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com, rkrcmar@redhat.com, linux-kernel@vger.kernel.org
Subject: [PATCH 2/4] nvmx: mark ept single context invalidation as supported
Date: Wed, 20 Jul 2016 18:25:34 -0400 [thread overview]
Message-ID: <1469053536-11130-3-git-send-email-bsd@redhat.com> (raw)
In-Reply-To: <1469053536-11130-1-git-send-email-bsd@redhat.com>
Commit 4b855078601f ("KVM: nVMX: Don't advertise single
context invalidation for invept") removed advertising
single context invalidation since the spec does not mandate it.
However, some hypervisors (such as ESX) require it to be present
before willing to use ept in a nested environment. Advertise it
and fallback to the global case.
Signed-off-by: Bandan Das <bsd@redhat.com>
---
arch/x86/kvm/vmx.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 9fd0681..6291143 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2718,12 +2718,8 @@ static void nested_vmx_setup_ctls_msrs(struct vcpu_vmx *vmx)
VMX_EPTP_WB_BIT | VMX_EPT_2MB_PAGE_BIT |
VMX_EPT_INVEPT_BIT;
vmx->nested.nested_vmx_ept_caps &= vmx_capability.ept;
- /*
- * For nested guests, we don't do anything specific
- * for single context invalidation. Hence, only advertise
- * support for global context invalidation.
- */
- vmx->nested.nested_vmx_ept_caps |= VMX_EPT_EXTENT_GLOBAL_BIT;
+ vmx->nested.nested_vmx_ept_caps |= VMX_EPT_EXTENT_GLOBAL_BIT |
+ VMX_EPT_EXTENT_CONTEXT_BIT;
} else
vmx->nested.nested_vmx_ept_caps = 0;
@@ -7455,12 +7451,16 @@ static int handle_invept(struct kvm_vcpu *vcpu)
switch (type) {
case VMX_EPT_EXTENT_GLOBAL:
+ /*
+ * TODO: track mappings and invalidate
+ * single context requests appropriately
+ */
+ case VMX_EPT_EXTENT_CONTEXT:
kvm_mmu_sync_roots(vcpu);
kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
nested_vmx_succeed(vcpu);
break;
default:
- /* Trap single context invalidation invept calls */
WARN_ON(1);
break;
}
--
2.5.5
next prev parent reply other threads:[~2016-07-20 22:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-20 22:25 [PATCH 0/4] vmx: miscellaneous cleanups Bandan Das
2016-07-20 22:25 ` [PATCH 1/4] nvmx: use warn_on for buggy cases when emulating invept/invvpid Bandan Das
2016-07-21 9:13 ` Paolo Bonzini
2016-07-21 19:18 ` Bandan Das
2016-07-20 22:25 ` Bandan Das [this message]
2016-07-20 22:25 ` [PATCH 3/4] mmu: don't pass *kvm to spte_write_protect Bandan Das
2016-07-21 9:15 ` Paolo Bonzini
2016-07-21 19:21 ` Bandan Das
2016-07-20 22:25 ` [PATCH 4/4] nvmx: check for shadow vmcs check on entry Bandan Das
2016-07-21 9:16 ` Paolo Bonzini
2016-07-21 19:20 ` Bandan Das
2016-07-22 8:40 ` Paolo Bonzini
2016-07-22 15:51 ` Bandan Das
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=1469053536-11130-3-git-send-email-bsd@redhat.com \
--to=bsd@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.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).