Skip to content

Commit 45e1181

Browse files
whitebrandybonzini
authored andcommitted
nvmx: mark ept single context invalidation as supported
Commit 4b85507 ("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> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 03331b4 commit 45e1181

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

arch/x86/kvm/vmx.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2809,12 +2809,8 @@ static void nested_vmx_setup_ctls_msrs(struct vcpu_vmx *vmx)
28092809
vmx->nested.nested_vmx_ept_caps |=
28102810
VMX_EPT_EXECUTE_ONLY_BIT;
28112811
vmx->nested.nested_vmx_ept_caps &= vmx_capability.ept;
2812-
/*
2813-
* For nested guests, we don't do anything specific
2814-
* for single context invalidation. Hence, only advertise
2815-
* support for global context invalidation.
2816-
*/
2817-
vmx->nested.nested_vmx_ept_caps |= VMX_EPT_EXTENT_GLOBAL_BIT;
2812+
vmx->nested.nested_vmx_ept_caps |= VMX_EPT_EXTENT_GLOBAL_BIT |
2813+
VMX_EPT_EXTENT_CONTEXT_BIT;
28182814
} else
28192815
vmx->nested.nested_vmx_ept_caps = 0;
28202816

@@ -7608,12 +7604,16 @@ static int handle_invept(struct kvm_vcpu *vcpu)
76087604

76097605
switch (type) {
76107606
case VMX_EPT_EXTENT_GLOBAL:
7607+
/*
7608+
* TODO: track mappings and invalidate
7609+
* single context requests appropriately
7610+
*/
7611+
case VMX_EPT_EXTENT_CONTEXT:
76117612
kvm_mmu_sync_roots(vcpu);
76127613
kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
76137614
nested_vmx_succeed(vcpu);
76147615
break;
76157616
default:
7616-
/* Trap single context invalidation invept calls */
76177617
BUG_ON(1);
76187618
break;
76197619
}

0 commit comments

Comments
 (0)