All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] KVM: EFER.LMSLE cleanup
@ 2022-09-16  4:58 Jim Mattson
  2022-09-16  4:58 ` [PATCH 1/5] x86/cpufeatures: Introduce X86_FEATURE_NO_LMSLE Jim Mattson
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Jim Mattson @ 2022-09-16  4:58 UTC (permalink / raw)
  To: Avi Kivity, Babu Moger, Borislav Petkov, Chang S. Bae,
	Dave Hansen, H. Peter Anvin, Ingo Molnar, Joerg Roedel,
	Josh Poimboeuf, kvm, linux-kernel, Paolo Bonzini, Pawan Gupta,
	Peter Zijlstra, Sean Christopherson, Thomas Gleixner, Wyes Karny,
	x86
  Cc: Jim Mattson

KVM has never properly virtualized EFER.LMSLE. However, when the
"nested" module parameter is set, KVM lets the guest set EFER.LMSLE.
Ostensibly, this is so that SLES11 Xen 4.0 will boot as a nested
hypervisor.

KVM passes EFER.LMSLE to the hardware through the VMCB, so
the setting works most of the time, but the KVM instruction emulator
completely ignores the bit, so incorrect guest behavior is almost
certainly assured.

With Zen3, AMD has abandoned EFER.LMSLE. KVM still allows it, though, as
long as "nested" is set. However, since the hardware doesn't support it,
the next VMRUN after the emulated WRMSR will fail with "invalid VMCB."

My preference would be to simply scrub all references to LMSLE from the
Linux kernel, but I don't want to break any guests that rely in it (on
hardware that supports it).

So, here's a series to clean things up.

I have not been successful in getting new macros into cpufeatures.h in
the past, but I'm going to try again, because I am a glutton for
punishment.

Jim Mattson (5):
  x86/cpufeatures: Introduce X86_FEATURE_NO_LMSLE
  KVM: svm: Disallow EFER.LMSLE on hardware that doesn't support it
  KVM: x86: Report host's X86_FEATURE_NO_LMSLE in
    KVM_GET_SUPPORTED_CPUID
  KVM: x86: Enforce X86_FEATURE_NO_LMSLE in guest cpuid
  KVM: svm: Set X86_FEATURE_NO_LMSLE when !nested

 arch/x86/include/asm/cpufeatures.h | 1 +
 arch/x86/kvm/cpuid.c               | 2 +-
 arch/x86/kvm/svm/svm.c             | 6 +++++-
 arch/x86/kvm/x86.c                 | 3 +++
 4 files changed, 10 insertions(+), 2 deletions(-)

-- 
2.37.3.968.ga6b4b080e4-goog


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-09-19 18:10 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-16  4:58 [PATCH 0/5] KVM: EFER.LMSLE cleanup Jim Mattson
2022-09-16  4:58 ` [PATCH 1/5] x86/cpufeatures: Introduce X86_FEATURE_NO_LMSLE Jim Mattson
2022-09-16  4:58 ` [PATCH 2/5] KVM: svm: Disallow EFER.LMSLE on hardware that doesn't support it Jim Mattson
2022-09-16 20:14   ` Sean Christopherson
2022-09-16 21:00     ` Jim Mattson
2022-09-16 22:09       ` Borislav Petkov
2022-09-16 22:33         ` Sean Christopherson
2022-09-18 19:04           ` Borislav Petkov
2022-09-19 18:09             ` Jim Mattson
2022-09-16  4:58 ` [PATCH 3/5] KVM: x86: Report host's X86_FEATURE_NO_LMSLE in KVM_GET_SUPPORTED_CPUID Jim Mattson
2022-09-16  4:58 ` [PATCH 4/5] KVM: x86: Enforce X86_FEATURE_NO_LMSLE in guest cpuid Jim Mattson
2022-09-16  4:58 ` [PATCH 5/5] KVM: svm: Set X86_FEATURE_NO_LMSLE when !nested Jim Mattson

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.