aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWanpeng Li <wanpeng.li@hotmail.com>2017-10-18 19:00:34 -0400
committerRadim Krčmář <rkrcmar@redhat.com>2017-10-20 12:05:01 -0400
commit575b3a2cb439b03fd603ea77c73c76f3ed237596 (patch)
treee74e123e56c94b426b868adf95581aef038eaf6e
parentcc3d967f7e32ceeb9b78dc962126ebcf1a2b24b2 (diff)
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 <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>
-rw-r--r--arch/x86/kvm/vmx.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 69d45734091f..dba0f6ad4e57 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)
2842 * Advertise EPTP switching unconditionally 2842 * Advertise EPTP switching unconditionally
2843 * since we emulate it 2843 * since we emulate it
2844 */ 2844 */
2845 vmx->nested.nested_vmx_vmfunc_controls = 2845 if (enable_ept)
2846 VMX_VMFUNC_EPTP_SWITCHING; 2846 vmx->nested.nested_vmx_vmfunc_controls =
2847 VMX_VMFUNC_EPTP_SWITCHING;
2847 } 2848 }
2848 2849
2849 /* 2850 /*