mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
KVM: Move architecture capability Kconfigs to header defines
With s390 hosting multiple independent KVM implementations within the same kernel build (native s390 KVM and arm64 on s390), global Kconfig selections force both implementations to inherit options that only apply to one of them. Replace global Kconfig options which only apply to one KVM implementation with architecture-specific opt-in defines in the respective <asm/kvm_host.h>. Only remove Kconfig symbols that would be different on both s390 KVM implementations - __KVM_HAVE_INVALID_WAKEUPS (formerly HAVE_KVM_INVALID_WAKEUPS) - __KVM_HAVE_MSI (formerly HAVE_KVM_MSI) - __KVM_HAVE_NO_POLL (formerly HAVE_KVM_NO_POLL) - __KVM_HAVE_READONLY_MEM (formerly HAVE_KVM_READONLY_MEM) - __KVM_HAVE_VCPU_RUN_PID_CHANGE (formerly HAVE_KVM_VCPU_RUN_PID_CHANGE) This allows each architecture and guest implementation to configure its supported capabilities independently in its kvm_host header and eliminates adding unnecessary fallback stubs across different KVM targets. Acked-by: Hendrik Brueckner <brueckner@linux.ibm.com> Signed-off-by: Steffen Eiden <seiden@linux.ibm.com> Link: https://patch.msgid.link/20261013121343.1997112-1-seiden@linux.ibm.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
71cf35e389
commit
1499fd7cd2
|
|
@ -30,6 +30,9 @@
|
|||
#include <asm/vncr_mapping.h>
|
||||
|
||||
#define __KVM_HAVE_ARCH_INTC_INITIALIZED
|
||||
#define __KVM_HAVE_MSI
|
||||
#define __KVM_HAVE_READONLY_MEM
|
||||
#define __KVM_HAVE_VCPU_RUN_PID_CHANGE
|
||||
|
||||
#define KVM_HALT_POLL_NS_DEFAULT 500000
|
||||
|
||||
|
|
|
|||
|
|
@ -28,12 +28,9 @@ menuconfig KVM
|
|||
select KVM_VFIO
|
||||
select HAVE_KVM_DIRTY_RING_ACQ_REL
|
||||
select NEED_KVM_DIRTY_RING_WITH_BITMAP
|
||||
select HAVE_KVM_MSI
|
||||
select HAVE_KVM_IRQCHIP
|
||||
select HAVE_KVM_IRQ_ROUTING
|
||||
select HAVE_KVM_IRQ_BYPASS
|
||||
select HAVE_KVM_READONLY_MEM
|
||||
select HAVE_KVM_VCPU_RUN_PID_CHANGE
|
||||
select SCHED_INFO
|
||||
select GUEST_PERF_EVENTS if PERF_EVENTS
|
||||
select KVM_GUEST_MEMFD
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
#include <asm/loongarch.h>
|
||||
|
||||
#define __KVM_HAVE_ARCH_INTC_INITIALIZED
|
||||
#define __KVM_HAVE_MSI
|
||||
#define __KVM_HAVE_READONLY_MEM
|
||||
|
||||
/* Loongarch KVM register ids */
|
||||
#define KVM_GET_IOC_CSR_IDX(id) ((id & KVM_CSR_IDX_MASK) >> LOONGARCH_REG_SHIFT)
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@ config KVM
|
|||
select HAVE_KVM_DIRTY_RING_ACQ_REL
|
||||
select HAVE_KVM_IRQ_ROUTING
|
||||
select HAVE_KVM_IRQCHIP
|
||||
select HAVE_KVM_MSI
|
||||
select HAVE_KVM_READONLY_MEM
|
||||
select KVM_COMMON
|
||||
select KVM_GENERIC_DIRTYLOG_READ_PROTECT
|
||||
select KVM_GENERIC_HARDWARE_ENABLING
|
||||
|
|
|
|||
|
|
@ -893,5 +893,6 @@ static inline void kvm_arch_vcpu_blocking(struct kvm_vcpu *vcpu) {}
|
|||
static inline void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu) {}
|
||||
|
||||
#define __KVM_HAVE_ARCH_FLUSH_REMOTE_TLBS
|
||||
#define __KVM_HAVE_READONLY_MEM
|
||||
|
||||
#endif /* __MIPS_KVM_HOST_H__ */
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ config KVM
|
|||
select KVM_GENERIC_DIRTYLOG_READ_PROTECT
|
||||
select KVM_MMIO
|
||||
select KVM_GENERIC_HARDWARE_ENABLING
|
||||
select HAVE_KVM_READONLY_MEM
|
||||
help
|
||||
Support for hosting Guest kernels.
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,9 @@
|
|||
#endif /* CONFIG_KVM_BOOK3S_HV_POSSIBLE */
|
||||
|
||||
#define __KVM_HAVE_ARCH_INTC_INITIALIZED
|
||||
#ifdef CONFIG_KVM_MPIC
|
||||
#define __KVM_HAVE_MSI
|
||||
#endif
|
||||
|
||||
#define KVM_HALT_POLL_NS_DEFAULT 10000 /* 10 us */
|
||||
|
||||
|
|
|
|||
|
|
@ -232,7 +232,6 @@ config KVM_MPIC
|
|||
depends on KVM && PPC_E500
|
||||
select HAVE_KVM_IRQCHIP
|
||||
select HAVE_KVM_IRQ_ROUTING
|
||||
select HAVE_KVM_MSI
|
||||
help
|
||||
Enable support for emulating MPIC devices inside the
|
||||
host kernel, rather than relying on userspace to emulate.
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@
|
|||
#define KVM_REQ_STEAL_UPDATE KVM_ARCH_REQ(6)
|
||||
|
||||
#define __KVM_HAVE_ARCH_FLUSH_REMOTE_TLBS_RANGE
|
||||
#define __KVM_HAVE_MSI
|
||||
#define __KVM_HAVE_READONLY_MEM
|
||||
|
||||
#define KVM_HAVE_MMU_RWLOCK
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,6 @@ config KVM
|
|||
depends on RISCV_SBI && MMU
|
||||
select HAVE_KVM_IRQCHIP
|
||||
select HAVE_KVM_IRQ_ROUTING
|
||||
select HAVE_KVM_MSI
|
||||
select HAVE_KVM_READONLY_MEM
|
||||
select HAVE_KVM_DIRTY_RING_ACQ_REL
|
||||
select KVM_COMMON
|
||||
select KVM_GENERIC_DIRTYLOG_READ_PROTECT
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@
|
|||
|
||||
#define KVM_INTERNAL_MEM_SLOTS 1
|
||||
|
||||
#define __KVM_HAVE_INVALID_WAKEUPS
|
||||
#define __KVM_HAVE_NO_POLL
|
||||
|
||||
#define KVM_S390_MANAGES_S390_GUEST 1
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@ config KVM
|
|||
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 VIRT_XFER_TO_GUEST_WORK
|
||||
select KVM_MMU_LOCKLESS_AGING
|
||||
|
|
|
|||
|
|
@ -48,6 +48,9 @@
|
|||
#define kvm_file_to_kvm_arch x86
|
||||
|
||||
#define __KVM_HAVE_ARCH_VCPU_DEBUGFS
|
||||
#define __KVM_HAVE_MSI
|
||||
#define __KVM_HAVE_NO_POLL
|
||||
#define __KVM_HAVE_READONLY_MEM
|
||||
|
||||
/*
|
||||
* CONFIG_KVM_MAX_NR_VCPUS is defined iff CONFIG_KVM!=n, provide a dummy max if
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ config KVM_X86
|
|||
select HAVE_KVM_DIRTY_RING_ACQ_REL
|
||||
select HAVE_KVM_IRQ_BYPASS
|
||||
select HAVE_KVM_IRQ_ROUTING
|
||||
select HAVE_KVM_READONLY_MEM
|
||||
select VHOST_TASK
|
||||
select KVM_ASYNC_PF
|
||||
select USER_RETURN_NOTIFIER
|
||||
|
|
@ -37,9 +36,7 @@ config KVM_X86
|
|||
select PERF_EVENTS
|
||||
select GUEST_PERF_EVENTS
|
||||
select PERF_GUEST_MEDIATED_PMU
|
||||
select HAVE_KVM_MSI
|
||||
select HAVE_KVM_CPU_RELAX_INTERCEPT
|
||||
select HAVE_KVM_NO_POLL
|
||||
select VIRT_XFER_TO_GUEST_WORK
|
||||
select KVM_GENERIC_DIRTYLOG_READ_PROTECT
|
||||
select KVM_VFIO
|
||||
|
|
|
|||
|
|
@ -750,7 +750,11 @@ static inline u64 kvm_gmem_get_supported_flags(struct kvm *kvm)
|
|||
#ifndef kvm_arch_has_readonly_mem
|
||||
static inline bool kvm_arch_has_readonly_mem(struct kvm *kvm)
|
||||
{
|
||||
return IS_ENABLED(CONFIG_HAVE_KVM_READONLY_MEM);
|
||||
#ifdef __KVM_HAVE_READONLY_MEM
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -2483,7 +2487,7 @@ void kvm_arch_update_irqfd_routing(struct kvm_kernel_irqfd *irqfd,
|
|||
struct kvm_kernel_irq_routing_entry *new);
|
||||
#endif /* CONFIG_HAVE_KVM_IRQ_BYPASS */
|
||||
|
||||
#ifdef CONFIG_HAVE_KVM_INVALID_WAKEUPS
|
||||
#ifdef __KVM_HAVE_INVALID_WAKEUPS
|
||||
/* If we wakeup during the poll time, was it a sucessful poll? */
|
||||
static inline bool vcpu_valid_wakeup(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
|
|
@ -2495,9 +2499,9 @@ static inline bool vcpu_valid_wakeup(struct kvm_vcpu *vcpu)
|
|||
{
|
||||
return true;
|
||||
}
|
||||
#endif /* CONFIG_HAVE_KVM_INVALID_WAKEUPS */
|
||||
#endif /* __KVM_HAVE_INVALID_WAKEUPS */
|
||||
|
||||
#ifdef CONFIG_HAVE_KVM_NO_POLL
|
||||
#ifdef __KVM_HAVE_NO_POLL
|
||||
/* Callback that tells if we must not poll */
|
||||
bool kvm_arch_no_poll(struct kvm_vcpu *vcpu);
|
||||
#else
|
||||
|
|
@ -2505,18 +2509,18 @@ static inline bool kvm_arch_no_poll(struct kvm_vcpu *vcpu)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
#endif /* CONFIG_HAVE_KVM_NO_POLL */
|
||||
#endif /* __KVM_HAVE_NO_POLL */
|
||||
|
||||
void kvm_arch_guest_memory_reclaimed(struct kvm *kvm);
|
||||
|
||||
#ifdef CONFIG_HAVE_KVM_VCPU_RUN_PID_CHANGE
|
||||
#ifdef __KVM_HAVE_VCPU_RUN_PID_CHANGE
|
||||
int kvm_arch_vcpu_run_pid_change(struct kvm_vcpu *vcpu);
|
||||
#else
|
||||
static inline int kvm_arch_vcpu_run_pid_change(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_HAVE_KVM_VCPU_RUN_PID_CHANGE */
|
||||
#endif /* __KVM_HAVE_VCPU_RUN_PID_CHANGE */
|
||||
|
||||
#ifdef CONFIG_VIRT_XFER_TO_GUEST_WORK
|
||||
static inline void kvm_handle_signal_exit(struct kvm_vcpu *vcpu)
|
||||
|
|
|
|||
|
|
@ -50,21 +50,12 @@ config KVM_ASYNC_PF
|
|||
config KVM_ASYNC_PF_SYNC
|
||||
bool
|
||||
|
||||
config HAVE_KVM_MSI
|
||||
bool
|
||||
|
||||
config HAVE_KVM_READONLY_MEM
|
||||
bool
|
||||
|
||||
config HAVE_KVM_CPU_RELAX_INTERCEPT
|
||||
bool
|
||||
|
||||
config KVM_VFIO
|
||||
bool
|
||||
|
||||
config HAVE_KVM_INVALID_WAKEUPS
|
||||
bool
|
||||
|
||||
config KVM_GENERIC_DIRTYLOG_READ_PROTECT
|
||||
bool
|
||||
|
||||
|
|
@ -79,12 +70,6 @@ config HAVE_KVM_IRQ_BYPASS
|
|||
tristate
|
||||
select IRQ_BYPASS_MANAGER
|
||||
|
||||
config HAVE_KVM_VCPU_RUN_PID_CHANGE
|
||||
bool
|
||||
|
||||
config HAVE_KVM_NO_POLL
|
||||
bool
|
||||
|
||||
config VIRT_XFER_TO_GUEST_WORK
|
||||
bool
|
||||
|
||||
|
|
|
|||
|
|
@ -4903,7 +4903,7 @@ static int kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg)
|
|||
case KVM_CAP_DESTROY_MEMORY_REGION_WORKS:
|
||||
case KVM_CAP_JOIN_MEMORY_REGIONS_WORKS:
|
||||
case KVM_CAP_INTERNAL_ERROR_DATA:
|
||||
#ifdef CONFIG_HAVE_KVM_MSI
|
||||
#ifdef __KVM_HAVE_MSI
|
||||
case KVM_CAP_SIGNAL_MSI:
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_KVM_IRQCHIP
|
||||
|
|
@ -5293,7 +5293,7 @@ static long kvm_vm_ioctl(struct file *filp,
|
|||
r = kvm_ioeventfd(kvm, &data);
|
||||
break;
|
||||
}
|
||||
#ifdef CONFIG_HAVE_KVM_MSI
|
||||
#ifdef __KVM_HAVE_MSI
|
||||
case KVM_SIGNAL_MSI: {
|
||||
struct kvm_msi msi;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user