[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <afzbx3uqqag6s4zfvpnlg7cjcev25zixkidor4xhuu7fudtdh2@tki2ahvkrttt>
Date: Thu, 9 Oct 2025 23:24:32 +0000
From: Yosry Ahmed <yosry.ahmed@...ux.dev>
To: Jim Mattson <jmattson@...gle.com>
Cc: Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/2] KVM: SVM: Allow KVM_SET_NESTED_STATE to clear GIF
when SVME==0
On Thu, Oct 09, 2025 at 03:31:33PM -0700, Jim Mattson wrote:
> GIF==0 together with EFER.SVME==0 is a valid architectural
> state. Don't return -EINVAL for KVM_SET_NESTED_STATE when this
> combination is specified.
>
> Fixes: cc440cdad5b7 ("KVM: nSVM: implement KVM_GET_NESTED_STATE and KVM_SET_NESTED_STATE")
> Signed-off-by: Jim Mattson <jmattson@...gle.com>
Reviewed-by: Yosry Ahmed <yosry.ahmed@...ux.dev>
> ---
> arch/x86/kvm/svm/nested.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
> index a6443feab252..db0d4f2b128c 100644
> --- a/arch/x86/kvm/svm/nested.c
> +++ b/arch/x86/kvm/svm/nested.c
> @@ -1798,8 +1798,8 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu,
> * EFER.SVME, but EFER.SVME still has to be 1 for VMRUN to succeed.
> */
> if (!(vcpu->arch.efer & EFER_SVME)) {
> - /* GIF=1 and no guest mode are required if SVME=0. */
> - if (kvm_state->flags != KVM_STATE_NESTED_GIF_SET)
> + /* GUEST_MODE must be clear when SVME==0 */
> + if (kvm_state->flags & KVM_STATE_NESTED_GUEST_MODE)
> return -EINVAL;
> }
>
> --
> 2.51.0.740.g6adb054d12-goog
>
Powered by blists - more mailing lists