public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] KVM: EFER.LMSLE cleanup
@ 2022-09-20 20:59 Jim Mattson
  2022-09-20 20:59 ` [PATCH v2 1/3] Revert "KVM: SVM: Allow EFER.LMSLE to be set with nested svm" Jim Mattson
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Jim Mattson @ 2022-09-20 20:59 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H . Peter Anvin, Sean Christopherson, Paolo Bonzini, linux-kernel,
	kvm
  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."

To clean things up, revert the hack that allowed a KVM guest to set
EFER.LMSLE, and enumerate CPUID.80000008H:EDX.EferLmsleUnsupported[bit
20] in KVM_GET_SUPPORTED_CPUID on SVM hosts.

Jim Mattson (3):
  Revert "KVM: SVM: Allow EFER.LMSLE to be set with nested svm"
  x86/cpufeatures: Introduce X86_FEATURE_NO_LMSLE
  KVM: SVM: Unconditionally enumerate EferLmsleUnsupported

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

v1 -> v2: Make no attempt to preserve existing behavior [Sean, Borislav]

-- 
2.37.3.968.ga6b4b080e4-goog


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

end of thread, other threads:[~2022-10-07 22:41 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-20 20:59 [PATCH v2 0/3] KVM: EFER.LMSLE cleanup Jim Mattson
2022-09-20 20:59 ` [PATCH v2 1/3] Revert "KVM: SVM: Allow EFER.LMSLE to be set with nested svm" Jim Mattson
2022-09-20 20:59 ` [PATCH v2 2/3] x86/cpufeatures: Introduce X86_FEATURE_NO_LMSLE Jim Mattson
2022-09-21 16:07   ` Borislav Petkov
2022-09-20 20:59 ` [PATCH v2 3/3] KVM: SVM: Unconditionally enumerate EferLmsleUnsupported Jim Mattson
2022-10-07 22:41   ` Sean Christopherson
2022-09-20 21:17 ` [PATCH v2 0/3] KVM: EFER.LMSLE cleanup Borislav Petkov
2022-09-20 21:36   ` Sean Christopherson
2022-09-20 21:36   ` Jim Mattson
2022-09-21  9:28     ` Borislav Petkov
2022-09-21 13:45       ` Jim Mattson
2022-09-21 13:54         ` Borislav Petkov
2022-09-21 15:11           ` Jim Mattson
2022-09-21 16:06             ` Borislav Petkov
2022-09-21 16:23               ` Jim Mattson
2022-09-21 17:11                 ` Borislav Petkov
2022-09-21 17:45                   ` Jim Mattson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox