From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751612AbdJOCbS (ORCPT ); Sat, 14 Oct 2017 22:31:18 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:47974 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751165AbdJOCbQ (ORCPT ); Sat, 14 Oct 2017 22:31:16 -0400 X-Google-Smtp-Source: AOwi7QDviv+z1aVcdSDk6I0Ps9qLIhlAFe9UIJMoI31HlHER7H/rmOUe/dUFvwLN5SjGJ/BewBkd3A== From: Wanpeng Li X-Google-Original-From: Wanpeng Li To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Wanpeng Li Subject: [PATCH 1/2] KVM: VMX: Don't advertise EPT switching if EPT itself is not exposed Date: Sat, 14 Oct 2017 19:31:09 -0700 Message-Id: <1508034669-4736-1-git-send-email-wanpeng.li@hotmail.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wanpeng Li EPT switching is advertised unconditionally since it is emulated, however, it can be treated as an extended feature for EPT, it should be not advertised if EPT itself is not exposed. This patch fixes it. Cc: Paolo Bonzini Cc: Radim Krčmář Signed-off-by: Wanpeng Li --- arch/x86/kvm/vmx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index c460b0b..3644540 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; } /* -- 2.7.4