From: Nikunj A Dadhania <nikunj@amd.com>
To: Jim Mattson <jmattson@google.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>,
Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Pawan Gupta <pawan.kumar.gupta@linux.intel.com>,
"Tom Lendacky" <thomas.lendacky@amd.com>,
Jim Mattson <jmattson@google.com>,
"Perry Yuan" <perry.yuan@amd.com>,
Sohil Mehta <sohil.mehta@intel.com>,
"Xin Li (Intel)" <xin@zytor.com>,
Joerg Roedel <joerg.roedel@amd.com>, Avi Kivity <avi@redhat.com>,
<linux-kernel@vger.kernel.org>, <kvm@vger.kernel.org>,
Yosry Ahmed <yosry.ahmed@linux.dev>
Subject: Re: [PATCH v2 2/2] KVM: SVM: Disallow EFER.LMSLE when not supported by hardware
Date: Tue, 7 Oct 2025 08:02:26 +0000 [thread overview]
Message-ID: <85o6qjqgvh.fsf@amd.com> (raw)
In-Reply-To: <20251001001529.1119031-3-jmattson@google.com>
Jim Mattson <jmattson@google.com> writes:
> Modern AMD CPUs do not support segment limit checks in 64-bit mode
> (i.e. EFER.LMSLE must be zero). Do not allow a guest to set EFER.LMSLE
> on a CPU that requires the bit to be zero.
>
> For backwards compatibility, allow EFER.LMSLE to be set on CPUs that
> support segment limit checks in 64-bit mode, even though KVM's
> implementation of the feature is incomplete (e.g. KVM's emulator does
> not enforce segment limits in 64-bit mode).
>
> Fixes: eec4b140c924 ("KVM: SVM: Allow EFER.LMSLE to be set with nested svm")
>
> Signed-off-by: Jim Mattson <jmattson@google.com>
Reviewed-by: Nikunj A Dadhania <nikunj@amd.com>
> ---
> arch/x86/kvm/svm/svm.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index 1bfebe40854f..78d0fc85d0bd 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -5351,7 +5351,9 @@ static __init int svm_hardware_setup(void)
>
> if (nested) {
> pr_info("Nested Virtualization enabled\n");
> - kvm_enable_efer_bits(EFER_SVME | EFER_LMSLE);
> + kvm_enable_efer_bits(EFER_SVME);
> + if (!boot_cpu_has(X86_FEATURE_EFER_LMSLE_MBZ))
> + kvm_enable_efer_bits(EFER_LMSLE);
>
> r = nested_svm_init_msrpm_merge_offsets();
> if (r)
> --
> 2.51.0.618.g983fd99d29-goog
next prev parent reply other threads:[~2025-10-07 8:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-01 0:14 [PATCH v2 0/2] KVM: SVM: Handle EferLmsleUnsupported Jim Mattson
2025-10-01 0:14 ` [PATCH v2 1/2] KVM: x86: Advertise EferLmsleUnsupported to userspace Jim Mattson
2025-10-01 15:17 ` Yosry Ahmed
2025-10-07 7:59 ` Nikunj A Dadhania
2025-10-14 22:49 ` Sean Christopherson
2025-10-01 0:14 ` [PATCH v2 2/2] KVM: SVM: Disallow EFER.LMSLE when not supported by hardware Jim Mattson
2025-10-01 15:18 ` Yosry Ahmed
2025-10-01 15:25 ` Yosry Ahmed
2025-10-07 8:02 ` Nikunj A Dadhania [this message]
2025-10-20 16:33 ` [PATCH v2 0/2] KVM: SVM: Handle EferLmsleUnsupported Sean Christopherson
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=85o6qjqgvh.fsf@amd.com \
--to=nikunj@amd.com \
--cc=avi@redhat.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=joerg.roedel@amd.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pawan.kumar.gupta@linux.intel.com \
--cc=pbonzini@redhat.com \
--cc=perry.yuan@amd.com \
--cc=seanjc@google.com \
--cc=sohil.mehta@intel.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=x86@kernel.org \
--cc=xin@zytor.com \
--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 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.