diff options
| author | Yosry Ahmed <yosry@kernel.org> | 2026-07-13 18:10:16 +0000 |
|---|---|---|
| committer | Sean Christopherson <seanjc@google.com> | 2026-07-22 13:41:54 -0700 |
| commit | 6ccc19d4c1eb97a994180af8afcab58422cb409d (patch) | |
| tree | c18aa20505c8db185f4a8f10abb3f5380430d770 | |
| parent | 0ca49fbd2883cd53d32d85b50feef17fa04d0fbf (diff) | |
| download | linux-next-6ccc19d4c1eb97a994180af8afcab58422cb409d.tar.gz linux-next-6ccc19d4c1eb97a994180af8afcab58422cb409d.zip | |
KVM: x86: Move enabling EFER.SVME and EFER.LMSLE to generic EFER setup
Move SVM-specific EFER bit enablement to generic x86 code, with the rest
of EFER bit enablement. Unifying the code for EFER bit enablement allows
for a later change to re-initialize EFER bits on module init.
No functional change intended.
Cc: stable@vger.kernel.org
Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Yosry Ahmed <yosry@kernel.org>
Link: https://patch.msgid.link/20260713181020.2735367-2-yosry@kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
| -rw-r--r-- | arch/x86/kvm/svm/svm.c | 4 | ||||
| -rw-r--r-- | arch/x86/kvm/x86.c | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index d3807f4abb49..1b7e613fde7b 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -5636,10 +5636,6 @@ static __init int svm_hardware_setup(void) if (nested) { pr_info("Nested Virtualization enabled\n"); - 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) return r; diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index d9cff1f8dff3..a4216b858194 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -6918,6 +6918,12 @@ static void kvm_setup_efer_caps(void) if (kvm_cpu_cap_has(X86_FEATURE_AUTOIBRS)) kvm_enable_efer_bits(EFER_AUTOIBRS); + + if (kvm_cpu_cap_has(X86_FEATURE_SVM)) { + kvm_enable_efer_bits(EFER_SVME); + if (!boot_cpu_has(X86_FEATURE_EFER_LMSLE_MBZ)) + kvm_enable_efer_bits(EFER_LMSLE); + } } static void kvm_nested_ops_update(const struct kvm_x86_nested_ops *nested_ops) |
