Skip to content

Commit

Permalink
KVM: nVMX: Fix EPT switching advertising
Browse files Browse the repository at this point in the history
I can use vmxcap tool to observe "EPTP Switching   yes" even if EPT is not
exposed to L1.

EPT switching is advertised unconditionally since it is emulated, however,
it can be treated as an extended feature for EPT and it should not be
advertised if EPT itself is not exposed. This patch fixes it.

Reviewed-by: David Hildenbrand <david@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Jim Mattson <jmattson@google.com>
Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
  • Loading branch information
Wanpeng Li authored and Radim Krčmář committed Oct 20, 2017
1 parent cc3d967 commit 575b3a2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arch/x86/kvm/vmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2842,8 +2842,9 @@ static void nested_vmx_setup_ctls_msrs(struct vcpu_vmx *vmx)
* Advertise EPTP switching unconditionally
* since we emulate it
*/
vmx->nested.nested_vmx_vmfunc_controls =
VMX_VMFUNC_EPTP_SWITCHING;
if (enable_ept)
vmx->nested.nested_vmx_vmfunc_controls =
VMX_VMFUNC_EPTP_SWITCHING;
}

/*
Expand Down

0 comments on commit 575b3a2

Please sign in to comment.