[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220916045832.461395-1-jmattson@google.com>
Date: Thu, 15 Sep 2022 21:58:27 -0700
From: Jim Mattson <jmattson@...gle.com>
To: Avi Kivity <avi@...hat.com>, Babu Moger <babu.moger@....com>,
Borislav Petkov <bp@...en8.de>,
"Chang S. Bae" <chang.seok.bae@...el.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
Joerg Roedel <joerg.roedel@....com>,
Josh Poimboeuf <jpoimboe@...nel.org>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, Paolo Bonzini <pbonzini@...hat.com>,
Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Sean Christopherson <seanjc@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>,
Wyes Karny <wyes.karny@....com>, x86@...nel.org
Cc: Jim Mattson <jmattson@...gle.com>
Subject: [PATCH 0/5] 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."
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
Powered by blists - more mailing lists