aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorBandan Das <bsd@redhat.com>2014-04-19 18:17:44 -0400
committerMarcelo Tosatti <mtosatti@redhat.com>2014-04-22 17:41:28 -0400
commit4b855078601fc422dbac3059f2215e776f49780f (patch)
treeebfe3a80b4a4d7f734aed8e82d64096be895571c /arch/x86/kvm
parentfd2a445a94d2ab6b39fb623dc02fee48d01a565a (diff)
KVM: nVMX: Don't advertise single context invalidation for invept
For single context invalidation, we fall through to global invalidation in handle_invept() except for one case - when the operand supplied by L1 is different from what we have in vmcs12. However, typically hypervisors will only call invept for the currently loaded eptp, so the condition will never be true. Signed-off-by: Bandan Das <bsd@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/vmx.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 8fb56e4cdf91..f00a6e9021b0 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2353,12 +2353,11 @@ static __init void nested_vmx_setup_ctls_msrs(void)
2353 VMX_EPT_INVEPT_BIT; 2353 VMX_EPT_INVEPT_BIT;
2354 nested_vmx_ept_caps &= vmx_capability.ept; 2354 nested_vmx_ept_caps &= vmx_capability.ept;
2355 /* 2355 /*
2356 * Since invept is completely emulated we support both global 2356 * For nested guests, we don't do anything specific
2357 * and context invalidation independent of what host cpu 2357 * for single context invalidation. Hence, only advertise
2358 * supports 2358 * support for global context invalidation.
2359 */ 2359 */
2360 nested_vmx_ept_caps |= VMX_EPT_EXTENT_GLOBAL_BIT | 2360 nested_vmx_ept_caps |= VMX_EPT_EXTENT_GLOBAL_BIT;
2361 VMX_EPT_EXTENT_CONTEXT_BIT;
2362 } else 2361 } else
2363 nested_vmx_ept_caps = 0; 2362 nested_vmx_ept_caps = 0;
2364 2363
@@ -6441,7 +6440,6 @@ static int handle_invept(struct kvm_vcpu *vcpu)
6441 struct { 6440 struct {
6442 u64 eptp, gpa; 6441 u64 eptp, gpa;
6443 } operand; 6442 } operand;
6444 u64 eptp_mask = ((1ull << 51) - 1) & PAGE_MASK;
6445 6443
6446 if (!(nested_vmx_secondary_ctls_high & SECONDARY_EXEC_ENABLE_EPT) || 6444 if (!(nested_vmx_secondary_ctls_high & SECONDARY_EXEC_ENABLE_EPT) ||
6447 !(nested_vmx_ept_caps & VMX_EPT_INVEPT_BIT)) { 6445 !(nested_vmx_ept_caps & VMX_EPT_INVEPT_BIT)) {
@@ -6481,16 +6479,13 @@ static int handle_invept(struct kvm_vcpu *vcpu)
6481 } 6479 }
6482 6480
6483 switch (type) { 6481 switch (type) {
6484 case VMX_EPT_EXTENT_CONTEXT:
6485 if ((operand.eptp & eptp_mask) !=
6486 (nested_ept_get_cr3(vcpu) & eptp_mask))
6487 break;
6488 case VMX_EPT_EXTENT_GLOBAL: 6482 case VMX_EPT_EXTENT_GLOBAL:
6489 kvm_mmu_sync_roots(vcpu); 6483 kvm_mmu_sync_roots(vcpu);
6490 kvm_mmu_flush_tlb(vcpu); 6484 kvm_mmu_flush_tlb(vcpu);
6491 nested_vmx_succeed(vcpu); 6485 nested_vmx_succeed(vcpu);
6492 break; 6486 break;
6493 default: 6487 default:
6488 /* Trap single context invalidation invept calls */
6494 BUG_ON(1); 6489 BUG_ON(1);
6495 break; 6490 break;
6496 } 6491 }