]> xenbits.xensource.com Git - people/pauldu/linux.git/commitdiff
KVM: introduce CONFIG_KVM_COMMON
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 4 Jan 2024 16:15:07 +0000 (11:15 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 8 Jan 2024 13:09:38 +0000 (08:09 -0500)
CONFIG_HAVE_KVM is currently used by some architectures to either
enabled the KVM config proper, or to enable host-side code that is
not part of the KVM module.  However, CONFIG_KVM's "select" statement
in virt/kvm/Kconfig corresponds to a third meaning, namely to
enable common Kconfigs required by all architectures that support
KVM.

These three meanings can be replaced respectively by an
architecture-specific Kconfig, by IS_ENABLED(CONFIG_KVM), or by
a new Kconfig symbol that is in turn selected by the
architecture-specific "config KVM".

Start by introducing such a new Kconfig symbol, CONFIG_KVM_COMMON.
Unlike CONFIG_HAVE_KVM, it is selected by CONFIG_KVM, not by
architecture code, and it brings in all dependencies of common
KVM code.  In particular, INTERVAL_TREE was missing in loongarch
and riscv, so that is another thing that is fixed.

Fixes: 8132d887a702 ("KVM: remove CONFIG_HAVE_KVM_EVENTFD", 2023-12-08)
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Closes: https://lore.kernel.org/all/44907c6b-c5bd-4e4a-a921-e4d3825539d8@infradead.org/
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/arm64/kvm/Kconfig
arch/loongarch/kvm/Kconfig
arch/mips/kvm/Kconfig
arch/powerpc/kvm/Kconfig
arch/riscv/kvm/Kconfig
arch/s390/kvm/Kconfig
arch/x86/kvm/Kconfig
virt/kvm/Kconfig

index b07c60c9737dc24bf0ca41f521c3630e7a23c4b8..6c3c8ca73e7fda8bb29792218bb11d031e7527ff 100644 (file)
@@ -21,9 +21,9 @@ if VIRTUALIZATION
 menuconfig KVM
        bool "Kernel-based Virtual Machine (KVM) support"
        depends on HAVE_KVM
+       select KVM_COMMON
        select KVM_GENERIC_HARDWARE_ENABLING
        select KVM_GENERIC_MMU_NOTIFIER
-       select PREEMPT_NOTIFIERS
        select HAVE_KVM_CPU_RELAX_INTERCEPT
        select KVM_MMIO
        select KVM_GENERIC_DIRTYLOG_READ_PROTECT
@@ -39,7 +39,6 @@ menuconfig KVM
        select HAVE_KVM_VCPU_RUN_PID_CHANGE
        select SCHED_INFO
        select GUEST_PERF_EVENTS if PERF_EVENTS
-       select INTERVAL_TREE
        select XARRAY_MULTI
        help
          Support hosting virtualized guest machines.
index daba4cd5e87d12c9e937463274189810475fb637..61f7e33b1f95731c3c1a207337e30a63ff028ad6 100644 (file)
@@ -23,12 +23,12 @@ config KVM
        depends on HAVE_KVM
        select HAVE_KVM_DIRTY_RING_ACQ_REL
        select HAVE_KVM_VCPU_ASYNC_IOCTL
+       select KVM_COMMON
        select KVM_GENERIC_DIRTYLOG_READ_PROTECT
        select KVM_GENERIC_HARDWARE_ENABLING
        select KVM_GENERIC_MMU_NOTIFIER
        select KVM_MMIO
        select KVM_XFER_TO_GUEST_WORK
-       select PREEMPT_NOTIFIERS
        help
          Support hosting virtualized guest machines using
          hardware virtualization extensions. You will need
index 428141b0b48f5225ff729d0d49b5319278b5acbe..18e7a17d51158ee45901b4fda71f4996eb6d8a9a 100644 (file)
@@ -20,12 +20,11 @@ config KVM
        depends on HAVE_KVM
        depends on MIPS_FP_SUPPORT
        select EXPORT_UASM
-       select PREEMPT_NOTIFIERS
+       select KVM_COMMON
        select KVM_GENERIC_DIRTYLOG_READ_PROTECT
        select HAVE_KVM_VCPU_ASYNC_IOCTL
        select KVM_MMIO
        select KVM_GENERIC_MMU_NOTIFIER
-       select INTERVAL_TREE
        select KVM_GENERIC_HARDWARE_ENABLING
        help
          Support for hosting Guest kernels.
index b47196085a42dfd0803294d3992fe02d08b582b2..074263429faf2e49b516fb1ef1ac3544b902febe 100644 (file)
@@ -19,12 +19,11 @@ if VIRTUALIZATION
 
 config KVM
        bool
-       select PREEMPT_NOTIFIERS
+       select KVM_COMMON
        select HAVE_KVM_VCPU_ASYNC_IOCTL
        select KVM_VFIO
        select IRQ_BYPASS_MANAGER
        select HAVE_KVM_IRQ_BYPASS
-       select INTERVAL_TREE
 
 config KVM_BOOK3S_HANDLER
        bool
index 1fd76aee3b719d6e5ba52f8806d721b85fb3e2bb..d490db94385883eb3e74048c799cea3f6a07e8cf 100644 (file)
@@ -24,12 +24,12 @@ config KVM
        select HAVE_KVM_IRQ_ROUTING
        select HAVE_KVM_MSI
        select HAVE_KVM_VCPU_ASYNC_IOCTL
+       select KVM_COMMON
        select KVM_GENERIC_DIRTYLOG_READ_PROTECT
        select KVM_GENERIC_HARDWARE_ENABLING
        select KVM_MMIO
        select KVM_XFER_TO_GUEST_WORK
        select KVM_GENERIC_MMU_NOTIFIER
-       select PREEMPT_NOTIFIERS
        select SCHED_INFO
        help
          Support hosting virtualized guest machines.
index bb6d903511194d2e9d661dea19a56c1f0668b4a8..72e9b7dcdf7d977a14a1ea7f9d39a06c36e4b97f 100644 (file)
@@ -20,17 +20,16 @@ config KVM
        def_tristate y
        prompt "Kernel-based Virtual Machine (KVM) support"
        depends on HAVE_KVM
-       select PREEMPT_NOTIFIERS
        select HAVE_KVM_CPU_RELAX_INTERCEPT
        select HAVE_KVM_VCPU_ASYNC_IOCTL
        select KVM_ASYNC_PF
        select KVM_ASYNC_PF_SYNC
+       select KVM_COMMON
        select HAVE_KVM_IRQCHIP
        select HAVE_KVM_IRQ_ROUTING
        select HAVE_KVM_INVALID_WAKEUPS
        select HAVE_KVM_NO_POLL
        select KVM_VFIO
-       select INTERVAL_TREE
        select MMU_NOTIFIER
        help
          Support hosting paravirtualized guest machines using the SIE
index b07247b0b958e5c39003ec21fd443aa433520778..cce3dea279206c6b49ad282741d31cb26a4e5da1 100644 (file)
@@ -23,7 +23,7 @@ config KVM
        depends on HAVE_KVM
        depends on HIGH_RES_TIMERS
        depends on X86_LOCAL_APIC
-       select PREEMPT_NOTIFIERS
+       select KVM_COMMON
        select KVM_GENERIC_MMU_NOTIFIER
        select HAVE_KVM_IRQCHIP
        select HAVE_KVM_PFNCACHE
@@ -44,7 +44,6 @@ config KVM
        select KVM_XFER_TO_GUEST_WORK
        select KVM_GENERIC_DIRTYLOG_READ_PROTECT
        select KVM_VFIO
-       select INTERVAL_TREE
        select HAVE_KVM_PM_NOTIFIER if PM
        select KVM_GENERIC_HARDWARE_ENABLING
        help
index 6793211a0b64252f075e12c58db1c5a94e5a7958..ace72be98fb2040a353e5ca258674abf7a41b12c 100644 (file)
@@ -3,7 +3,12 @@
 
 config HAVE_KVM
        bool
+
+config KVM_COMMON
+       bool
        select EVENTFD
+       select INTERVAL_TREE
+       select PREEMPT_NOTIFIERS
 
 config HAVE_KVM_PFNCACHE
        bool