* [PATCH 0/4] Replace CONFIG_HAVE_KVM with more appropriate symbols.
@ 2024-01-04 20:59 Paolo Bonzini
2024-01-04 20:59 ` [PATCH 1/4] KVM: introduce CONFIG_KVM_COMMON Paolo Bonzini
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Paolo Bonzini @ 2024-01-04 20:59 UTC (permalink / raw)
To: linux-kernel, kvm
Cc: ajones, Thomas Bogendoerfer, Alex Williamson, x86, kbingham
CONFIG_HAVE_KVM is currently used with three meanings:
- some architectures use it to enabled the KVM config proper, depending
on CPU capabilities (MIPS)
- some architectures use it to enable host-side code that is not part of
the KVM module (x86)
- to enable common Kconfigs required by all architectures that support
KVM, currently CONFIG_EVENTFD
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".
This is what each of the first three patches does. After this,
CONFIG_HAVE_KVM is unused and can be removed.
This fixes architectures (PPC and RISC-V) that do not have CONFIG_HAVE_KVM=y
and therefore fail to select CONFIG_EVENTFD. Patch 1 can be quickly
applied to 6.8 to fix this build failure, while the rest can be delayed
to the early -rc period or 6.9 if desired.
Paolo
Paolo Bonzini (4):
KVM: introduce CONFIG_KVM_COMMON
MIPS: introduce Kconfig for MIPS VZ
x86, vfio, gdb: replace CONFIG_HAVE_KVM with IS_ENABLED(CONFIG_KVM)
treewide: remove CONFIG_HAVE_KVM
arch/arm64/Kconfig | 1 -
arch/arm64/kvm/Kconfig | 2 +-
arch/loongarch/Kconfig | 1 -
arch/loongarch/kvm/Kconfig | 2 +-
arch/mips/Kconfig | 18 +++++++++---------
arch/mips/kvm/Kconfig | 3 ++-
arch/powerpc/kvm/Kconfig | 1 +
arch/riscv/kvm/Kconfig | 1 +
arch/s390/Kconfig | 1 -
arch/s390/kvm/Kconfig | 2 +-
arch/x86/Kconfig | 1 -
arch/x86/include/asm/hardirq.h | 2 +-
arch/x86/include/asm/idtentry.h | 2 +-
arch/x86/include/asm/irq.h | 2 +-
arch/x86/include/asm/irq_vectors.h | 2 +-
arch/x86/kernel/idt.c | 2 +-
arch/x86/kernel/irq.c | 4 ++--
arch/x86/kvm/Kconfig | 3 +--
drivers/vfio/vfio.h | 2 +-
drivers/vfio/vfio_main.c | 4 ++--
scripts/gdb/linux/constants.py.in | 6 +++++-
scripts/gdb/linux/interrupts.py | 2 +-
tools/arch/x86/include/asm/irq_vectors.h | 2 +-
virt/kvm/Kconfig | 2 +-
24 files changed, 35 insertions(+), 33 deletions(-)
--
2.39.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/4] KVM: introduce CONFIG_KVM_COMMON
2024-01-04 20:59 [PATCH 0/4] Replace CONFIG_HAVE_KVM with more appropriate symbols Paolo Bonzini
@ 2024-01-04 20:59 ` Paolo Bonzini
2024-01-05 9:37 ` Andrew Jones
2024-01-05 19:13 ` Sean Christopherson
2024-01-04 20:59 ` [PATCH 2/4] MIPS: introduce Kconfig for MIPS VZ Paolo Bonzini
` (2 subsequent siblings)
3 siblings, 2 replies; 9+ messages in thread
From: Paolo Bonzini @ 2024-01-04 20:59 UTC (permalink / raw)
To: linux-kernel, kvm; +Cc: ajones
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, the "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.
Fixes: 8132d887a702 ("KVM: remove CONFIG_HAVE_KVM_EVENTFD", 2023-12-08)
Cc: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
arch/arm64/kvm/Kconfig | 1 +
arch/loongarch/kvm/Kconfig | 1 +
arch/mips/kvm/Kconfig | 1 +
arch/powerpc/kvm/Kconfig | 1 +
arch/riscv/kvm/Kconfig | 1 +
arch/s390/kvm/Kconfig | 1 +
arch/x86/kvm/Kconfig | 1 +
virt/kvm/Kconfig | 3 +++
8 files changed, 10 insertions(+)
diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig
index b07c60c9737d..ad5ce0454f17 100644
--- a/arch/arm64/kvm/Kconfig
+++ b/arch/arm64/kvm/Kconfig
@@ -21,6 +21,7 @@ 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
diff --git a/arch/loongarch/kvm/Kconfig b/arch/loongarch/kvm/Kconfig
index daba4cd5e87d..3b284b7e63ad 100644
--- a/arch/loongarch/kvm/Kconfig
+++ b/arch/loongarch/kvm/Kconfig
@@ -23,6 +23,7 @@ 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
diff --git a/arch/mips/kvm/Kconfig b/arch/mips/kvm/Kconfig
index 428141b0b48f..2eb119e78b6e 100644
--- a/arch/mips/kvm/Kconfig
+++ b/arch/mips/kvm/Kconfig
@@ -21,6 +21,7 @@ config 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
diff --git a/arch/powerpc/kvm/Kconfig b/arch/powerpc/kvm/Kconfig
index b47196085a42..5da535e20b6a 100644
--- a/arch/powerpc/kvm/Kconfig
+++ b/arch/powerpc/kvm/Kconfig
@@ -20,6 +20,7 @@ if VIRTUALIZATION
config KVM
bool
select PREEMPT_NOTIFIERS
+ select KVM_COMMON
select HAVE_KVM_VCPU_ASYNC_IOCTL
select KVM_VFIO
select IRQ_BYPASS_MANAGER
diff --git a/arch/riscv/kvm/Kconfig b/arch/riscv/kvm/Kconfig
index 1fd76aee3b71..55f81377d260 100644
--- a/arch/riscv/kvm/Kconfig
+++ b/arch/riscv/kvm/Kconfig
@@ -24,6 +24,7 @@ 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
diff --git a/arch/s390/kvm/Kconfig b/arch/s390/kvm/Kconfig
index bb6d90351119..f89bedbe63bd 100644
--- a/arch/s390/kvm/Kconfig
+++ b/arch/s390/kvm/Kconfig
@@ -25,6 +25,7 @@ config KVM
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
diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
index b07247b0b958..c8e62a371d24 100644
--- a/arch/x86/kvm/Kconfig
+++ b/arch/x86/kvm/Kconfig
@@ -24,6 +24,7 @@ config 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
diff --git a/virt/kvm/Kconfig b/virt/kvm/Kconfig
index 6793211a0b64..cce5c03ecc92 100644
--- a/virt/kvm/Kconfig
+++ b/virt/kvm/Kconfig
@@ -3,6 +3,9 @@
config HAVE_KVM
bool
+
+config KVM_COMMON
+ bool
select EVENTFD
config HAVE_KVM_PFNCACHE
--
2.39.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/4] MIPS: introduce Kconfig for MIPS VZ
2024-01-04 20:59 [PATCH 0/4] Replace CONFIG_HAVE_KVM with more appropriate symbols Paolo Bonzini
2024-01-04 20:59 ` [PATCH 1/4] KVM: introduce CONFIG_KVM_COMMON Paolo Bonzini
@ 2024-01-04 20:59 ` Paolo Bonzini
2024-01-04 20:59 ` [PATCH 3/4] x86, vfio, gdb: replace CONFIG_HAVE_KVM with IS_ENABLED(CONFIG_KVM) Paolo Bonzini
2024-01-04 20:59 ` [PATCH 4/4] treewide: remove CONFIG_HAVE_KVM Paolo Bonzini
3 siblings, 0 replies; 9+ messages in thread
From: Paolo Bonzini @ 2024-01-04 20:59 UTC (permalink / raw)
To: linux-kernel, kvm; +Cc: ajones, Thomas Bogendoerfer
Since MIPS/KVM only supports hardware virtualization using MIPS VZ,
do not enable KVM blindly. Use a new Kconfig symbol CPU_SUPPORTS_VZ
and do not enable it for R2 processors.
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
arch/mips/Kconfig | 9 +++++++++
arch/mips/kvm/Kconfig | 2 +-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 797ae590ebdb..3eb3239013d9 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1250,6 +1250,7 @@ config CPU_LOONGSON64
select CPU_SUPPORTS_HIGHMEM
select CPU_SUPPORTS_HUGEPAGES
select CPU_SUPPORTS_MSA
+ select CPU_SUPPORTS_VZ
select CPU_DIEI_BROKEN if !LOONGSON3_ENHANCEMENT
select CPU_MIPSR2_IRQ_VI
select DMA_NONCOHERENT
@@ -1389,6 +1390,7 @@ config CPU_MIPS32_R5
select CPU_SUPPORTS_32BIT_KERNEL
select CPU_SUPPORTS_HIGHMEM
select CPU_SUPPORTS_MSA
+ select CPU_SUPPORTS_VZ
select HAVE_KVM
select MIPS_O32_FP64_SUPPORT
help
@@ -1405,6 +1407,7 @@ config CPU_MIPS32_R6
select CPU_SUPPORTS_32BIT_KERNEL
select CPU_SUPPORTS_HIGHMEM
select CPU_SUPPORTS_MSA
+ select CPU_SUPPORTS_VZ
select HAVE_KVM
select MIPS_O32_FP64_SUPPORT
help
@@ -1459,6 +1462,7 @@ config CPU_MIPS64_R5
select CPU_SUPPORTS_HUGEPAGES
select CPU_SUPPORTS_MSA
select MIPS_O32_FP64_SUPPORT if 32BIT || MIPS32_O32
+ select CPU_SUPPORTS_VZ
select HAVE_KVM
help
Choose this option to build a kernel for release 5 or later of the
@@ -1477,6 +1481,7 @@ config CPU_MIPS64_R6
select CPU_SUPPORTS_HUGEPAGES
select CPU_SUPPORTS_MSA
select MIPS_O32_FP64_SUPPORT if 32BIT || MIPS32_O32
+ select CPU_SUPPORTS_VZ
select HAVE_KVM
help
Choose this option to build a kernel for release 6 or later of the
@@ -1492,6 +1497,7 @@ config CPU_P5600
select CPU_SUPPORTS_HIGHMEM
select CPU_SUPPORTS_MSA
select CPU_SUPPORTS_CPUFREQ
+ select CPU_SUPPORTS_VZ
select CPU_MIPSR2_IRQ_VI
select CPU_MIPSR2_IRQ_EI
select HAVE_KVM
@@ -1614,6 +1620,7 @@ config CPU_CAVIUM_OCTEON
select USB_EHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN
select USB_OHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN
select MIPS_L1_CACHE_SHIFT_7
+ select CPU_SUPPORTS_VZ
select HAVE_KVM
help
The Cavium Octeon processor is a highly integrated chip containing
@@ -1969,6 +1976,8 @@ config CPU_SUPPORTS_ADDRWINCFG
config CPU_SUPPORTS_HUGEPAGES
bool
depends on !(32BIT && (PHYS_ADDR_T_64BIT || EVA))
+config CPU_SUPPORTS_VZ
+ bool
config MIPS_PGD_C0_CONTEXT
bool
depends on 64BIT
diff --git a/arch/mips/kvm/Kconfig b/arch/mips/kvm/Kconfig
index 2eb119e78b6e..1156112ffa13 100644
--- a/arch/mips/kvm/Kconfig
+++ b/arch/mips/kvm/Kconfig
@@ -17,7 +17,7 @@ if VIRTUALIZATION
config KVM
tristate "Kernel-based Virtual Machine (KVM) support"
- depends on HAVE_KVM
+ depends on CPU_SUPPORTS_VZ
depends on MIPS_FP_SUPPORT
select EXPORT_UASM
select PREEMPT_NOTIFIERS
--
2.39.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/4] x86, vfio, gdb: replace CONFIG_HAVE_KVM with IS_ENABLED(CONFIG_KVM)
2024-01-04 20:59 [PATCH 0/4] Replace CONFIG_HAVE_KVM with more appropriate symbols Paolo Bonzini
2024-01-04 20:59 ` [PATCH 1/4] KVM: introduce CONFIG_KVM_COMMON Paolo Bonzini
2024-01-04 20:59 ` [PATCH 2/4] MIPS: introduce Kconfig for MIPS VZ Paolo Bonzini
@ 2024-01-04 20:59 ` Paolo Bonzini
2024-01-04 20:59 ` [PATCH 4/4] treewide: remove CONFIG_HAVE_KVM Paolo Bonzini
3 siblings, 0 replies; 9+ messages in thread
From: Paolo Bonzini @ 2024-01-04 20:59 UTC (permalink / raw)
To: linux-kernel, kvm; +Cc: ajones, Alex Williamson, x86, kbingham
Check if KVM is enabled, instead of having the architecture say so.
If KVM is disabled in a specific build, there is no need for support code.
Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: x86@kernel.org
Cc: kbingham@kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
arch/x86/include/asm/hardirq.h | 2 +-
arch/x86/include/asm/idtentry.h | 2 +-
arch/x86/include/asm/irq.h | 2 +-
arch/x86/include/asm/irq_vectors.h | 2 +-
arch/x86/kernel/idt.c | 2 +-
arch/x86/kernel/irq.c | 4 ++--
drivers/vfio/vfio.h | 2 +-
drivers/vfio/vfio_main.c | 4 ++--
scripts/gdb/linux/constants.py.in | 6 +++++-
scripts/gdb/linux/interrupts.py | 2 +-
tools/arch/x86/include/asm/irq_vectors.h | 2 +-
11 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/arch/x86/include/asm/hardirq.h b/arch/x86/include/asm/hardirq.h
index 66837b8c67f1..fbc7722b87d1 100644
--- a/arch/x86/include/asm/hardirq.h
+++ b/arch/x86/include/asm/hardirq.h
@@ -15,7 +15,7 @@ typedef struct {
unsigned int irq_spurious_count;
unsigned int icr_read_retry_count;
#endif
-#ifdef CONFIG_HAVE_KVM
+#if IS_ENABLED(CONFIG_KVM)
unsigned int kvm_posted_intr_ipis;
unsigned int kvm_posted_intr_wakeup_ipis;
unsigned int kvm_posted_intr_nested_ipis;
diff --git a/arch/x86/include/asm/idtentry.h b/arch/x86/include/asm/idtentry.h
index 13639e57e1f8..d9c86733d0db 100644
--- a/arch/x86/include/asm/idtentry.h
+++ b/arch/x86/include/asm/idtentry.h
@@ -675,7 +675,7 @@ DECLARE_IDTENTRY_SYSVEC(IRQ_WORK_VECTOR, sysvec_irq_work);
# endif
#endif
-#ifdef CONFIG_HAVE_KVM
+#if IS_ENABLED(CONFIG_KVM)
DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_VECTOR, sysvec_kvm_posted_intr_ipi);
DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_WAKEUP_VECTOR, sysvec_kvm_posted_intr_wakeup_ipi);
DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_NESTED_VECTOR, sysvec_kvm_posted_intr_nested_ipi);
diff --git a/arch/x86/include/asm/irq.h b/arch/x86/include/asm/irq.h
index 836c170d3087..194dfff84cb1 100644
--- a/arch/x86/include/asm/irq.h
+++ b/arch/x86/include/asm/irq.h
@@ -29,7 +29,7 @@ struct irq_desc;
extern void fixup_irqs(void);
-#ifdef CONFIG_HAVE_KVM
+#if IS_ENABLED(CONFIG_KVM)
extern void kvm_set_posted_intr_wakeup_handler(void (*handler)(void));
#endif
diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h
index 3a19904c2db6..3f73ac3ed3a0 100644
--- a/arch/x86/include/asm/irq_vectors.h
+++ b/arch/x86/include/asm/irq_vectors.h
@@ -84,7 +84,7 @@
#define HYPERVISOR_CALLBACK_VECTOR 0xf3
/* Vector for KVM to deliver posted interrupt IPI */
-#ifdef CONFIG_HAVE_KVM
+#if IS_ENABLED(CONFIG_KVM)
#define POSTED_INTR_VECTOR 0xf2
#define POSTED_INTR_WAKEUP_VECTOR 0xf1
#define POSTED_INTR_NESTED_VECTOR 0xf0
diff --git a/arch/x86/kernel/idt.c b/arch/x86/kernel/idt.c
index 660b601f1d6c..d2bc67cbaf92 100644
--- a/arch/x86/kernel/idt.c
+++ b/arch/x86/kernel/idt.c
@@ -153,7 +153,7 @@ static const __initconst struct idt_data apic_idts[] = {
#ifdef CONFIG_X86_LOCAL_APIC
INTG(LOCAL_TIMER_VECTOR, asm_sysvec_apic_timer_interrupt),
INTG(X86_PLATFORM_IPI_VECTOR, asm_sysvec_x86_platform_ipi),
-# ifdef CONFIG_HAVE_KVM
+# if IS_ENABLED(CONFIG_KVM)
INTG(POSTED_INTR_VECTOR, asm_sysvec_kvm_posted_intr_ipi),
INTG(POSTED_INTR_WAKEUP_VECTOR, asm_sysvec_kvm_posted_intr_wakeup_ipi),
INTG(POSTED_INTR_NESTED_VECTOR, asm_sysvec_kvm_posted_intr_nested_ipi),
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index 11761c124545..35fde0107901 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -164,7 +164,7 @@ int arch_show_interrupts(struct seq_file *p, int prec)
#if defined(CONFIG_X86_IO_APIC)
seq_printf(p, "%*s: %10u\n", prec, "MIS", atomic_read(&irq_mis_count));
#endif
-#ifdef CONFIG_HAVE_KVM
+#if IS_ENABLED(CONFIG_KVM)
seq_printf(p, "%*s: ", prec, "PIN");
for_each_online_cpu(j)
seq_printf(p, "%10u ", irq_stats(j)->kvm_posted_intr_ipis);
@@ -290,7 +290,7 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_x86_platform_ipi)
}
#endif
-#ifdef CONFIG_HAVE_KVM
+#if IS_ENABLED(CONFIG_KVM)
static void dummy_handler(void) {}
static void (*kvm_posted_intr_wakeup_handler)(void) = dummy_handler;
diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h
index 307e3f29b527..c26d1ad68105 100644
--- a/drivers/vfio/vfio.h
+++ b/drivers/vfio/vfio.h
@@ -434,7 +434,7 @@ static inline void vfio_virqfd_exit(void)
}
#endif
-#ifdef CONFIG_HAVE_KVM
+#if IS_ENABLED(CONFIG_KVM)
void vfio_device_get_kvm_safe(struct vfio_device *device, struct kvm *kvm);
void vfio_device_put_kvm(struct vfio_device *device);
#else
diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
index 8d4995ada74a..3e595aabf320 100644
--- a/drivers/vfio/vfio_main.c
+++ b/drivers/vfio/vfio_main.c
@@ -16,7 +16,7 @@
#include <linux/fs.h>
#include <linux/idr.h>
#include <linux/iommu.h>
-#ifdef CONFIG_HAVE_KVM
+#if IS_ENABLED(CONFIG_KVM)
#include <linux/kvm_host.h>
#endif
#include <linux/list.h>
@@ -383,7 +383,7 @@ void vfio_unregister_group_dev(struct vfio_device *device)
}
EXPORT_SYMBOL_GPL(vfio_unregister_group_dev);
-#ifdef CONFIG_HAVE_KVM
+#if IS_ENABLED(CONFIG_KVM)
void vfio_device_get_kvm_safe(struct vfio_device *device, struct kvm *kvm)
{
void (*pfn)(struct kvm *kvm);
diff --git a/scripts/gdb/linux/constants.py.in b/scripts/gdb/linux/constants.py.in
index e810e0c27ff1..5cace7588e24 100644
--- a/scripts/gdb/linux/constants.py.in
+++ b/scripts/gdb/linux/constants.py.in
@@ -130,7 +130,11 @@ LX_CONFIG(CONFIG_X86_MCE_THRESHOLD)
LX_CONFIG(CONFIG_X86_MCE_AMD)
LX_CONFIG(CONFIG_X86_MCE)
LX_CONFIG(CONFIG_X86_IO_APIC)
-LX_CONFIG(CONFIG_HAVE_KVM)
+/*
+ * CONFIG_KVM can be "m" but it affects common code too. Use CONFIG_KVM_COMMON
+ * as a proxy for IS_ENABLED(CONFIG_KVM).
+ */
+LX_CONFIG_KVM = IS_BUILTIN(CONFIG_KVM_COMMON)
LX_CONFIG(CONFIG_NUMA)
LX_CONFIG(CONFIG_ARM64)
LX_CONFIG(CONFIG_ARM64_4K_PAGES)
diff --git a/scripts/gdb/linux/interrupts.py b/scripts/gdb/linux/interrupts.py
index ef478e273791..66ae5c7690cf 100644
--- a/scripts/gdb/linux/interrupts.py
+++ b/scripts/gdb/linux/interrupts.py
@@ -151,7 +151,7 @@ def x86_show_interupts(prec):
if cnt is not None:
text += "%*s: %10u\n" % (prec, "MIS", cnt['counter'])
- if constants.LX_CONFIG_HAVE_KVM:
+ if constants.LX_CONFIG_KVM:
text += x86_show_irqstat(prec, "PIN", 'kvm_posted_intr_ipis', 'Posted-interrupt notification event')
text += x86_show_irqstat(prec, "NPI", 'kvm_posted_intr_nested_ipis', 'Nested posted-interrupt event')
text += x86_show_irqstat(prec, "PIW", 'kvm_posted_intr_wakeup_ipis', 'Posted-interrupt wakeup event')
diff --git a/tools/arch/x86/include/asm/irq_vectors.h b/tools/arch/x86/include/asm/irq_vectors.h
index 3a19904c2db6..3f73ac3ed3a0 100644
--- a/tools/arch/x86/include/asm/irq_vectors.h
+++ b/tools/arch/x86/include/asm/irq_vectors.h
@@ -84,7 +84,7 @@
#define HYPERVISOR_CALLBACK_VECTOR 0xf3
/* Vector for KVM to deliver posted interrupt IPI */
-#ifdef CONFIG_HAVE_KVM
+#if IS_ENABLED(CONFIG_KVM)
#define POSTED_INTR_VECTOR 0xf2
#define POSTED_INTR_WAKEUP_VECTOR 0xf1
#define POSTED_INTR_NESTED_VECTOR 0xf0
--
2.39.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/4] treewide: remove CONFIG_HAVE_KVM
2024-01-04 20:59 [PATCH 0/4] Replace CONFIG_HAVE_KVM with more appropriate symbols Paolo Bonzini
` (2 preceding siblings ...)
2024-01-04 20:59 ` [PATCH 3/4] x86, vfio, gdb: replace CONFIG_HAVE_KVM with IS_ENABLED(CONFIG_KVM) Paolo Bonzini
@ 2024-01-04 20:59 ` Paolo Bonzini
3 siblings, 0 replies; 9+ messages in thread
From: Paolo Bonzini @ 2024-01-04 20:59 UTC (permalink / raw)
To: linux-kernel, kvm; +Cc: ajones
It has no users anymore. While at it also remove a dependency on X86
that is redundant within arch/x86.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
arch/arm64/Kconfig | 1 -
arch/arm64/kvm/Kconfig | 1 -
arch/loongarch/Kconfig | 1 -
arch/loongarch/kvm/Kconfig | 1 -
arch/mips/Kconfig | 9 ---------
arch/s390/Kconfig | 1 -
arch/s390/kvm/Kconfig | 1 -
arch/x86/Kconfig | 1 -
arch/x86/kvm/Kconfig | 2 --
virt/kvm/Kconfig | 3 ---
10 files changed, 21 deletions(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 7b071a00425d..dbf08f8b66dd 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -214,7 +214,6 @@ config ARM64
select HAVE_HW_BREAKPOINT if PERF_EVENTS
select HAVE_IOREMAP_PROT
select HAVE_IRQ_TIME_ACCOUNTING
- select HAVE_KVM
select HAVE_MOD_ARCH_SPECIFIC
select HAVE_NMI
select HAVE_PERF_EVENTS
diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig
index ad5ce0454f17..d8e40d7f89f6 100644
--- a/arch/arm64/kvm/Kconfig
+++ b/arch/arm64/kvm/Kconfig
@@ -20,7 +20,6 @@ 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
diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
index ee123820a476..78330e0ca2f2 100644
--- a/arch/loongarch/Kconfig
+++ b/arch/loongarch/Kconfig
@@ -129,7 +129,6 @@ config LOONGARCH
select HAVE_KPROBES
select HAVE_KPROBES_ON_FTRACE
select HAVE_KRETPROBES
- select HAVE_KVM
select HAVE_MOD_ARCH_SPECIFIC
select HAVE_NMI
select HAVE_PCI
diff --git a/arch/loongarch/kvm/Kconfig b/arch/loongarch/kvm/Kconfig
index 3b284b7e63ad..62c05d6e175c 100644
--- a/arch/loongarch/kvm/Kconfig
+++ b/arch/loongarch/kvm/Kconfig
@@ -20,7 +20,6 @@ if VIRTUALIZATION
config KVM
tristate "Kernel-based Virtual Machine (KVM) support"
depends on AS_HAS_LVZ_EXTENSION
- depends on HAVE_KVM
select HAVE_KVM_DIRTY_RING_ACQ_REL
select HAVE_KVM_VCPU_ASYNC_IOCTL
select KVM_COMMON
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 3eb3239013d9..cf5bb1c756e6 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1262,7 +1262,6 @@ config CPU_LOONGSON64
select MIPS_FP_SUPPORT
select GPIOLIB
select SWIOTLB
- select HAVE_KVM
help
The Loongson GSx64(GS264/GS464/GS464E/GS464V) series of processor
cores implements the MIPS64R2 instruction set with many extensions,
@@ -1375,7 +1374,6 @@ config CPU_MIPS32_R2
select CPU_SUPPORTS_32BIT_KERNEL
select CPU_SUPPORTS_HIGHMEM
select CPU_SUPPORTS_MSA
- select HAVE_KVM
help
Choose this option to build a kernel for release 2 or later of the
MIPS32 architecture. Most modern embedded systems with a 32-bit
@@ -1391,7 +1389,6 @@ config CPU_MIPS32_R5
select CPU_SUPPORTS_HIGHMEM
select CPU_SUPPORTS_MSA
select CPU_SUPPORTS_VZ
- select HAVE_KVM
select MIPS_O32_FP64_SUPPORT
help
Choose this option to build a kernel for release 5 or later of the
@@ -1408,7 +1405,6 @@ config CPU_MIPS32_R6
select CPU_SUPPORTS_HIGHMEM
select CPU_SUPPORTS_MSA
select CPU_SUPPORTS_VZ
- select HAVE_KVM
select MIPS_O32_FP64_SUPPORT
help
Choose this option to build a kernel for release 6 or later of the
@@ -1444,7 +1440,6 @@ config CPU_MIPS64_R2
select CPU_SUPPORTS_HIGHMEM
select CPU_SUPPORTS_HUGEPAGES
select CPU_SUPPORTS_MSA
- select HAVE_KVM
help
Choose this option to build a kernel for release 2 or later of the
MIPS64 architecture. Many modern embedded systems with a 64-bit
@@ -1463,7 +1458,6 @@ config CPU_MIPS64_R5
select CPU_SUPPORTS_MSA
select MIPS_O32_FP64_SUPPORT if 32BIT || MIPS32_O32
select CPU_SUPPORTS_VZ
- select HAVE_KVM
help
Choose this option to build a kernel for release 5 or later of the
MIPS64 architecture. This is a intermediate MIPS architecture
@@ -1482,7 +1476,6 @@ config CPU_MIPS64_R6
select CPU_SUPPORTS_MSA
select MIPS_O32_FP64_SUPPORT if 32BIT || MIPS32_O32
select CPU_SUPPORTS_VZ
- select HAVE_KVM
help
Choose this option to build a kernel for release 6 or later of the
MIPS64 architecture. New MIPS processors, starting with the Warrior
@@ -1500,7 +1493,6 @@ config CPU_P5600
select CPU_SUPPORTS_VZ
select CPU_MIPSR2_IRQ_VI
select CPU_MIPSR2_IRQ_EI
- select HAVE_KVM
select MIPS_O32_FP64_SUPPORT
help
Choose this option to build a kernel for MIPS Warrior P5600 CPU.
@@ -1621,7 +1613,6 @@ config CPU_CAVIUM_OCTEON
select USB_OHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN
select MIPS_L1_CACHE_SHIFT_7
select CPU_SUPPORTS_VZ
- select HAVE_KVM
help
The Cavium Octeon processor is a highly integrated chip containing
many ethernet hardware widgets for networking tasks. The processor
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 3bec98d20283..b369ee2648c2 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -194,7 +194,6 @@ config S390
select HAVE_KPROBES
select HAVE_KPROBES_ON_FTRACE
select HAVE_KRETPROBES
- select HAVE_KVM
select HAVE_LIVEPATCH
select HAVE_MEMBLOCK_PHYS_MAP
select HAVE_MOD_ARCH_SPECIFIC
diff --git a/arch/s390/kvm/Kconfig b/arch/s390/kvm/Kconfig
index f89bedbe63bd..7f17c5185dc3 100644
--- a/arch/s390/kvm/Kconfig
+++ b/arch/s390/kvm/Kconfig
@@ -19,7 +19,6 @@ if VIRTUALIZATION
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
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 3762f41bb092..a3935a737c14 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -240,7 +240,6 @@ config X86
select HAVE_FUNCTION_ERROR_INJECTION
select HAVE_KRETPROBES
select HAVE_RETHOOK
- select HAVE_KVM
select HAVE_LIVEPATCH if X86_64
select HAVE_MIXED_BREAKPOINTS_REGS
select HAVE_MOD_ARCH_SPECIFIC
diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
index c8e62a371d24..419a72ed307a 100644
--- a/arch/x86/kvm/Kconfig
+++ b/arch/x86/kvm/Kconfig
@@ -7,7 +7,6 @@ source "virt/kvm/Kconfig"
menuconfig VIRTUALIZATION
bool "Virtualization"
- depends on HAVE_KVM || X86
default y
help
Say Y here to get to see options for using your Linux host to run other
@@ -20,7 +19,6 @@ if VIRTUALIZATION
config KVM
tristate "Kernel-based Virtual Machine (KVM) support"
- depends on HAVE_KVM
depends on HIGH_RES_TIMERS
depends on X86_LOCAL_APIC
select PREEMPT_NOTIFIERS
diff --git a/virt/kvm/Kconfig b/virt/kvm/Kconfig
index cce5c03ecc92..4ecb6daf3f91 100644
--- a/virt/kvm/Kconfig
+++ b/virt/kvm/Kconfig
@@ -1,9 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
# KVM common configuration items and defaults
-config HAVE_KVM
- bool
-
config KVM_COMMON
bool
select EVENTFD
--
2.39.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] KVM: introduce CONFIG_KVM_COMMON
2024-01-04 20:59 ` [PATCH 1/4] KVM: introduce CONFIG_KVM_COMMON Paolo Bonzini
@ 2024-01-05 9:37 ` Andrew Jones
2024-01-05 19:13 ` Sean Christopherson
1 sibling, 0 replies; 9+ messages in thread
From: Andrew Jones @ 2024-01-05 9:37 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: linux-kernel, kvm
On Thu, Jan 04, 2024 at 03:59:56PM -0500, Paolo Bonzini wrote:
> 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, the "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.
>
> Fixes: 8132d887a702 ("KVM: remove CONFIG_HAVE_KVM_EVENTFD", 2023-12-08)
> Cc: Andrew Jones <ajones@ventanamicro.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> arch/arm64/kvm/Kconfig | 1 +
> arch/loongarch/kvm/Kconfig | 1 +
> arch/mips/kvm/Kconfig | 1 +
> arch/powerpc/kvm/Kconfig | 1 +
> arch/riscv/kvm/Kconfig | 1 +
> arch/s390/kvm/Kconfig | 1 +
> arch/x86/kvm/Kconfig | 1 +
> virt/kvm/Kconfig | 3 +++
> 8 files changed, 10 insertions(+)
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] KVM: introduce CONFIG_KVM_COMMON
2024-01-04 20:59 ` [PATCH 1/4] KVM: introduce CONFIG_KVM_COMMON Paolo Bonzini
2024-01-05 9:37 ` Andrew Jones
@ 2024-01-05 19:13 ` Sean Christopherson
2024-01-05 20:28 ` Paolo Bonzini
1 sibling, 1 reply; 9+ messages in thread
From: Sean Christopherson @ 2024-01-05 19:13 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: linux-kernel, kvm, ajones
On Thu, Jan 04, 2024, Paolo Bonzini wrote:
> 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, the "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.
Why? I don't get it, just have code that cares do IS_ENABLED(CONFIG_KVM). Except
for the MIPS usage of HAVE_KVM that you solved by adding CPU_SUPPORTS_VZ, I got
all the way there using just CONFIG_KVM[*].
Ah, and so does this series for the most part, the only usage of CONFIG_KVM_COMMON
is in scripts/gdb/linux/constants.py.in. Honestly, adding a Kconfig just so that
VMX's posted interrupts that arrive in the host can be printed when KVM is built
as a module is a waste of a Kconfig.
[*] https://lore.kernel.org/all/20230916003118.2540661-12-seanjc@google.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] KVM: introduce CONFIG_KVM_COMMON
2024-01-05 19:13 ` Sean Christopherson
@ 2024-01-05 20:28 ` Paolo Bonzini
2024-01-05 20:57 ` Sean Christopherson
0 siblings, 1 reply; 9+ messages in thread
From: Paolo Bonzini @ 2024-01-05 20:28 UTC (permalink / raw)
To: Sean Christopherson; +Cc: linux-kernel, kvm, ajones
On Fri, Jan 5, 2024 at 8:13 PM Sean Christopherson <seanjc@google.com> wrote:
> > 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.
>
> Why? I don't get it, just have code that cares do IS_ENABLED(CONFIG_KVM). Except
> for the MIPS usage of HAVE_KVM that you solved by adding CPU_SUPPORTS_VZ, I got
> all the way there using just CONFIG_KVM[*].
>
> Ah, and so does this series for the most part, the only usage of CONFIG_KVM_COMMON
> is in scripts/gdb/linux/constants.py.in. Honestly, adding a Kconfig just so that
> VMX's posted interrupts that arrive in the host can be printed when KVM is built
> as a module is a waste of a Kconfig.
There is one extra thing that CONFIG_KVM_COMMON does, which is to
avoid having to select common requirements in all architectures.
I jotted this to solve the reported randconfig failure, which is why
CONFIG_KVM_COMMON only requires "select EVENTFD", but looking more
closely it should also select PREEMPT_NOTIFIERS and INTERVAL_TREE.
Both are used by virt/kvm/kvm_main.c, and loongarch + riscv both lack
INTERVAL_TREE so I do think it's a good idea to introduce this symbol
(though it requires a v2).
> [*] https://lore.kernel.org/all/20230916003118.2540661-12-seanjc@google.com
I guess you mean
https://lore.kernel.org/all/20230916003118.2540661-8-seanjc@google.com/.
Paolo
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] KVM: introduce CONFIG_KVM_COMMON
2024-01-05 20:28 ` Paolo Bonzini
@ 2024-01-05 20:57 ` Sean Christopherson
0 siblings, 0 replies; 9+ messages in thread
From: Sean Christopherson @ 2024-01-05 20:57 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: linux-kernel, kvm, ajones
On Fri, Jan 05, 2024, Paolo Bonzini wrote:
> On Fri, Jan 5, 2024 at 8:13 PM Sean Christopherson <seanjc@google.com> wrote:
> > > 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.
> >
> > Why? I don't get it, just have code that cares do IS_ENABLED(CONFIG_KVM). Except
> > for the MIPS usage of HAVE_KVM that you solved by adding CPU_SUPPORTS_VZ, I got
> > all the way there using just CONFIG_KVM[*].
> >
> > Ah, and so does this series for the most part, the only usage of CONFIG_KVM_COMMON
> > is in scripts/gdb/linux/constants.py.in. Honestly, adding a Kconfig just so that
> > VMX's posted interrupts that arrive in the host can be printed when KVM is built
> > as a module is a waste of a Kconfig.
>
> There is one extra thing that CONFIG_KVM_COMMON does, which is to
> avoid having to select common requirements in all architectures.
Oooh, gotcha. FWIW, I would love to unify the "menuconfig VIRTUALIZATION" and
"config KVM" entries, but I can't think of a sane way to do that without ending
up with something like KVM_COMMON. :-/
> I jotted this to solve the reported randconfig failure, which is why
> CONFIG_KVM_COMMON only requires "select EVENTFD", but looking more
> closely it should also select PREEMPT_NOTIFIERS and INTERVAL_TREE.
> Both are used by virt/kvm/kvm_main.c, and loongarch + riscv both lack
> INTERVAL_TREE so I do think it's a good idea to introduce this symbol
> (though it requires a v2).
>
> > [*] https://lore.kernel.org/all/20230916003118.2540661-12-seanjc@google.com
>
> I guess you mean
> https://lore.kernel.org/all/20230916003118.2540661-8-seanjc@google.com/.
Doh, yes.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-01-05 20:57 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-04 20:59 [PATCH 0/4] Replace CONFIG_HAVE_KVM with more appropriate symbols Paolo Bonzini
2024-01-04 20:59 ` [PATCH 1/4] KVM: introduce CONFIG_KVM_COMMON Paolo Bonzini
2024-01-05 9:37 ` Andrew Jones
2024-01-05 19:13 ` Sean Christopherson
2024-01-05 20:28 ` Paolo Bonzini
2024-01-05 20:57 ` Sean Christopherson
2024-01-04 20:59 ` [PATCH 2/4] MIPS: introduce Kconfig for MIPS VZ Paolo Bonzini
2024-01-04 20:59 ` [PATCH 3/4] x86, vfio, gdb: replace CONFIG_HAVE_KVM with IS_ENABLED(CONFIG_KVM) Paolo Bonzini
2024-01-04 20:59 ` [PATCH 4/4] treewide: remove CONFIG_HAVE_KVM Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox