From: Wanpeng Li Date: Wed, 18 Oct 2017 23:00:34 +0000 (+0800) Subject: KVM: nVMX: Fix EPT switching advertising X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=575b3a2cb439b03fd603ea77c73c76f3ed237596;p=linux.git KVM: nVMX: Fix EPT switching advertising 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 Cc: Paolo Bonzini Cc: Radim Krčmář Cc: Jim Mattson Signed-off-by: Wanpeng Li Signed-off-by: Radim Krčmář --- diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 69d45734091fa..dba0f6ad4e575 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -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; } /*