All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Liran Alon <liran.alon@oracle.com>, kvm@vger.kernel.org
Cc: pbonzini@redhat.com, rkrcmar@redhat.com,
	Joao Martins <joao.m.martins@oracle.com>
Subject: Re: [PATCH] KVM: nVMX: Allow restore nested-state to enable eVMCS when vCPU in SMM
Date: Tue, 25 Jun 2019 15:11:43 +0200	[thread overview]
Message-ID: <878stpern4.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20190625112642.113460-1-liran.alon@oracle.com>

Liran Alon <liran.alon@oracle.com> writes:

> As comment in code specifies, SMM temporarily disables VMX so we cannot
> be in guest mode, nor can VMLAUNCH/VMRESUME be pending.
>
> However, code currently assumes that these are the only flags that can be
> set on kvm_state->flags. This is not true as KVM_STATE_NESTED_EVMCS
> can also be set on this field to signal that eVMCS should be enabled.
>
> Therefore, fix code to check for guest-mode and pending VMLAUNCH/VMRESUME
> explicitly.
>
> Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
> Signed-off-by: Liran Alon <liran.alon@oracle.com>
> ---
>  arch/x86/kvm/vmx/nested.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index 5c470db311f7..27ff04874f67 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -5373,7 +5373,10 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
>  	 * nor can VMLAUNCH/VMRESUME be pending.  Outside SMM, SMM flags
>  	 * must be zero.
>  	 */
> -	if (is_smm(vcpu) ? kvm_state->flags : kvm_state->hdr.vmx.smm.flags)
> +	if (is_smm(vcpu) ?
> +		(kvm_state->flags &
> +		 (KVM_STATE_NESTED_GUEST_MODE | KVM_STATE_NESTED_RUN_PENDING))
> +		: kvm_state->hdr.vmx.smm.flags)
>  		return -EINVAL;
>  
>  	if ((kvm_state->hdr.vmx.smm.flags & KVM_STATE_NESTED_SMM_GUEST_MODE) &&

Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>

-- 
Vitaly

  reply	other threads:[~2019-06-25 13:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-25 11:26 [PATCH] KVM: nVMX: Allow restore nested-state to enable eVMCS when vCPU in SMM Liran Alon
2019-06-25 13:11 ` Vitaly Kuznetsov [this message]
2019-07-01 23:16   ` Liran Alon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878stpern4.fsf@vitty.brq.redhat.com \
    --to=vkuznets@redhat.com \
    --cc=joao.m.martins@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=liran.alon@oracle.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.