From: Jim Mattson <jmattson@google.com>
To: Yosry Ahmed <yosry.ahmed@linux.dev>,
Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Jim Mattson <jmattson@google.com>
Subject: [PATCH v2 1/2] KVM: SVM: Allow KVM_SET_NESTED_STATE to clear GIF when SVME==0
Date: Thu, 9 Oct 2025 15:31:33 -0700 [thread overview]
Message-ID: <20251009223153.3344555-2-jmattson@google.com> (raw)
In-Reply-To: <20251009223153.3344555-1-jmattson@google.com>
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@google.com>
---
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
next prev parent reply other threads:[~2025-10-09 22:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-09 22:31 [PATCH v2 0/2] KVM: SVM: GIF and EFER.SVME are independent Jim Mattson
2025-10-09 22:31 ` Jim Mattson [this message]
2025-10-09 23:24 ` [PATCH v2 1/2] KVM: SVM: Allow KVM_SET_NESTED_STATE to clear GIF when SVME==0 Yosry Ahmed
2025-10-09 22:31 ` [PATCH v2 2/2] KVM: SVM: Don't set GIF when clearing EFER.SVME Jim Mattson
2025-10-13 22:33 ` Sean Christopherson
2025-10-14 20:51 ` Jim Mattson
2025-10-14 21:18 ` Sean Christopherson
2025-10-14 21:31 ` Jim Mattson
2025-10-14 22:07 ` Sean Christopherson
2025-10-14 22:58 ` Jim Mattson
2025-10-17 21:56 ` Sean Christopherson
2025-11-11 0:26 ` Yosry Ahmed
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=20251009223153.3344555-2-jmattson@google.com \
--to=jmattson@google.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=yosry.ahmed@linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox