Skip to content

KVM: EFER.LMSLE cleanup

Jim Mattson kvm lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 13 repliesIn review
  2. v15 patches 6 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3Revert "KVM: SVM: Allow EFER.LMSLE to be set with nested svm"arch/x86/include/asm/msr-index.h arch/x86/kvm/svm/svm.c+1 -30 replies
2/3x86/cpufeatures: Introduce X86_FEATURE_NO_LMSLEarch/x86/include/asm/cpufeatures.h+1 -01 reply
3/3KVM: SVM: Unconditionally enumerate EferLmsleUnsupportedarch/x86/kvm/svm/svm.c+1 -01 reply

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchBorislav Petkov
1/3
2/3A-b
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/3] KVM: EFER.LMSLE cleanup

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]

Signature · 1 line
2.37.3.968.ga6b4b080e4-goog