]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
KVM: x86: Have all vendor neutral sub-configs depend on KVM_X86, not just KVM
authorSean Christopherson <seanjc@google.com>
Tue, 29 Jul 2025 22:54:33 +0000 (15:54 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 27 Aug 2025 08:34:59 +0000 (04:34 -0400)
Make all vendor neutral KVM x86 configs depend on KVM_X86, not just KVM,
i.e. gate them on at least one vendor module being enabled and thus on
kvm.ko actually being built.  Depending on just KVM allows the user to
select the configs even though they won't actually take effect, and more
importantly, makes it all too easy to create unmet dependencies.  E.g.
KVM_GENERIC_PRIVATE_MEM can't be selected by KVM_SW_PROTECTED_VM, because
the KVM_GENERIC_MMU_NOTIFIER dependency is select by KVM_X86.

Hiding all sub-configs when neither KVM_AMD nor KVM_INTEL is selected also
helps communicate to the user that nothing "interesting" is going on, e.g.

  --- Virtualization
  <M>   Kernel-based Virtual Machine (KVM) support
  < >   KVM for Intel (and compatible) processors support
  < >   KVM for AMD processors support

Fixes: ea4290d77bda ("KVM: x86: leave kvm.ko out of the build if no vendor module is requested")
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Fuad Tabba <tabba@google.com>
Message-ID: <20250729225455.670324-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/Kconfig

index 2c86673155c9a097a6af3d313a9f7d1429d8102f..9895fc3cd901426dfabd8076b7dd8dba4c1d22b4 100644 (file)
@@ -74,7 +74,7 @@ config KVM_WERROR
        # FRAME_WARN, i.e. KVM_WERROR=y with KASAN=y requires special tuning.
        # Building KVM with -Werror and KASAN is still doable via enabling
        # the kernel-wide WERROR=y.
-       depends on KVM && ((EXPERT && !KASAN) || WERROR)
+       depends on KVM_X86 && ((EXPERT && !KASAN) || WERROR)
        help
          Add -Werror to the build flags for KVM.
 
@@ -83,7 +83,7 @@ config KVM_WERROR
 config KVM_SW_PROTECTED_VM
        bool "Enable support for KVM software-protected VMs"
        depends on EXPERT
-       depends on KVM && X86_64
+       depends on KVM_X86 && X86_64
        help
          Enable support for KVM software-protected VMs.  Currently, software-
          protected VMs are purely a development and testing vehicle for
@@ -169,7 +169,7 @@ config KVM_AMD_SEV
 config KVM_IOAPIC
        bool "I/O APIC, PIC, and PIT emulation"
        default y
-       depends on KVM
+       depends on KVM_X86
        help
          Provides support for KVM to emulate an I/O APIC, PIC, and PIT, i.e.
          for full in-kernel APIC emulation.
@@ -179,7 +179,7 @@ config KVM_IOAPIC
 config KVM_SMM
        bool "System Management Mode emulation"
        default y
-       depends on KVM
+       depends on KVM_X86
        help
          Provides support for KVM to emulate System Management Mode (SMM)
          in virtual machines.  This can be used by the virtual machine
@@ -189,7 +189,7 @@ config KVM_SMM
 
 config KVM_HYPERV
        bool "Support for Microsoft Hyper-V emulation"
-       depends on KVM
+       depends on KVM_X86
        default y
        help
          Provides KVM support for emulating Microsoft Hyper-V.  This allows KVM
@@ -203,7 +203,7 @@ config KVM_HYPERV
 
 config KVM_XEN
        bool "Support for Xen hypercall interface"
-       depends on KVM
+       depends on KVM_X86
        help
          Provides KVM support for the hosting Xen HVM guests and
          passing Xen hypercalls to userspace.
@@ -213,7 +213,7 @@ config KVM_XEN
 config KVM_PROVE_MMU
        bool "Prove KVM MMU correctness"
        depends on DEBUG_KERNEL
-       depends on KVM
+       depends on KVM_X86
        depends on EXPERT
        help
          Enables runtime assertions in KVM's MMU that are too costly to enable
@@ -228,7 +228,7 @@ config KVM_EXTERNAL_WRITE_TRACKING
 
 config KVM_MAX_NR_VCPUS
        int "Maximum number of vCPUs per KVM guest"
-       depends on KVM
+       depends on KVM_X86
        range 1024 4096
        default 4096 if MAXSMP
        default 1024