[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <877dyatubz.fsf@vitty.brq.redhat.com>
Date: Mon, 20 Apr 2020 10:49:52 +0200
From: Vitaly Kuznetsov <vkuznets@...hat.com>
To: Paolo Bonzini <pbonzini@...hat.com>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org
Cc: Sean Christopherson <sean.j.christopherson@...el.com>
Subject: Re: [PATCH 2/3] KVM: eVMCS: check if nesting is enabled
Paolo Bonzini <pbonzini@...hat.com> writes:
> In the next patch nested_get_evmcs_version will be always set in kvm_x86_ops for
> VMX, even if nesting is disabled. Therefore, check whether VMX (aka nesting)
> is available in the function, the caller will not do the check anymore.
>
> Signed-off-by: Paolo Bonzini <pbonzini@...hat.com>
> ---
> arch/x86/kvm/vmx/evmcs.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/vmx/evmcs.c b/arch/x86/kvm/vmx/evmcs.c
> index 73f3e07c1852..48dc77de9337 100644
> --- a/arch/x86/kvm/vmx/evmcs.c
> +++ b/arch/x86/kvm/vmx/evmcs.c
> @@ -4,6 +4,7 @@
> #include <linux/smp.h>
>
> #include "../hyperv.h"
> +#include "../cpuid.h"
> #include "evmcs.h"
> #include "vmcs.h"
> #include "vmx.h"
> @@ -333,7 +334,8 @@ uint16_t nested_get_evmcs_version(struct kvm_vcpu *vcpu)
> * maximum supported version. KVM supports versions from 1 to
> * KVM_EVMCS_VERSION.
> */
> - if (vmx->nested.enlightened_vmcs_enabled)
> + if (kvm_cpu_cap_get(X86_FEATURE_VMX) &&
> + vmx->nested.enlightened_vmcs_enabled)
> return (KVM_EVMCS_VERSION << 8) | 1;
>
> return 0;
Reviewed-by: Vitaly Kuznetsov <vkuznets@...hat.com>
--
Vitaly
Powered by blists - more mailing lists