On Thu, 16 Oct 2025 17:32:19 -0700 Sean Christopherson <[email protected]> wrote:
> Implement kvm_arch_vcpu_async_ioctl() "natively" in x86 and arm64 instead > of relying on an #ifdef'd stub, and drop HAVE_KVM_VCPU_ASYNC_IOCTL in > anticipation of using the API on x86. Once x86 uses the API, providing a > stub for one architecture and having all other architectures opt-in > requires more code than simply implementing the API in the lone holdout. > > Eliminating the Kconfig will also reduce churn if the API is renamed in > the future (spoiler alert). > > No functional change intended. > > Signed-off-by: Sean Christopherson <[email protected]> Acked-by: Claudio Imbrenda <[email protected]> > --- > arch/arm64/kvm/arm.c | 6 ++++++ > 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/x86.c | 6 ++++++ > include/linux/kvm_host.h | 10 ---------- > virt/kvm/Kconfig | 3 --- > 9 files changed, 12 insertions(+), 18 deletions(-) > > diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c > index f21d1b7f20f8..785aaaee6a5d 100644 > --- a/arch/arm64/kvm/arm.c > +++ b/arch/arm64/kvm/arm.c > @@ -1828,6 +1828,12 @@ long kvm_arch_vcpu_ioctl(struct file *filp, > return r; > } > > +long kvm_arch_vcpu_async_ioctl(struct file *filp, unsigned int ioctl, > + unsigned long arg) > +{ > + return -ENOIOCTLCMD; > +} > + > void kvm_arch_sync_dirty_log(struct kvm *kvm, struct kvm_memory_slot > *memslot) > { > > diff --git a/arch/loongarch/kvm/Kconfig b/arch/loongarch/kvm/Kconfig > index ae64bbdf83a7..ed4f724db774 100644 > --- a/arch/loongarch/kvm/Kconfig > +++ b/arch/loongarch/kvm/Kconfig > @@ -25,7 +25,6 @@ config KVM > select HAVE_KVM_IRQCHIP > select HAVE_KVM_MSI > select HAVE_KVM_READONLY_MEM > - select HAVE_KVM_VCPU_ASYNC_IOCTL > select KVM_COMMON > select KVM_GENERIC_DIRTYLOG_READ_PROTECT > select KVM_GENERIC_HARDWARE_ENABLING > diff --git a/arch/mips/kvm/Kconfig b/arch/mips/kvm/Kconfig > index ab57221fa4dd..cc13cc35f208 100644 > --- a/arch/mips/kvm/Kconfig > +++ b/arch/mips/kvm/Kconfig > @@ -22,7 +22,6 @@ config KVM > select EXPORT_UASM > select KVM_COMMON > select KVM_GENERIC_DIRTYLOG_READ_PROTECT > - select HAVE_KVM_VCPU_ASYNC_IOCTL > select KVM_MMIO > select KVM_GENERIC_MMU_NOTIFIER > select KVM_GENERIC_HARDWARE_ENABLING > diff --git a/arch/powerpc/kvm/Kconfig b/arch/powerpc/kvm/Kconfig > index 2f2702c867f7..c9a2d50ff1b0 100644 > --- a/arch/powerpc/kvm/Kconfig > +++ b/arch/powerpc/kvm/Kconfig > @@ -20,7 +20,6 @@ if VIRTUALIZATION > config KVM > bool > select KVM_COMMON > - select HAVE_KVM_VCPU_ASYNC_IOCTL > select KVM_VFIO > select HAVE_KVM_IRQ_BYPASS > > diff --git a/arch/riscv/kvm/Kconfig b/arch/riscv/kvm/Kconfig > index c50328212917..77379f77840a 100644 > --- a/arch/riscv/kvm/Kconfig > +++ b/arch/riscv/kvm/Kconfig > @@ -23,7 +23,6 @@ config KVM > select HAVE_KVM_IRQCHIP > select HAVE_KVM_IRQ_ROUTING > select HAVE_KVM_MSI > - select HAVE_KVM_VCPU_ASYNC_IOCTL > select HAVE_KVM_READONLY_MEM > select HAVE_KVM_DIRTY_RING_ACQ_REL > select KVM_COMMON > diff --git a/arch/s390/kvm/Kconfig b/arch/s390/kvm/Kconfig > index cae908d64550..96d16028e8b7 100644 > --- a/arch/s390/kvm/Kconfig > +++ b/arch/s390/kvm/Kconfig > @@ -20,7 +20,6 @@ config KVM > def_tristate y > prompt "Kernel-based Virtual Machine (KVM) support" > select HAVE_KVM_CPU_RELAX_INTERCEPT > - select HAVE_KVM_VCPU_ASYNC_IOCTL > select KVM_ASYNC_PF > select KVM_ASYNC_PF_SYNC > select KVM_COMMON > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index b4b5d2d09634..ca5ba2caf314 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -7240,6 +7240,12 @@ static int kvm_vm_ioctl_set_clock(struct kvm *kvm, > void __user *argp) > return 0; > } > > +long kvm_arch_vcpu_async_ioctl(struct file *filp, unsigned int ioctl, > + unsigned long arg) > +{ > + return -ENOIOCTLCMD; > +} > + > int kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long > arg) > { > struct kvm *kvm = filp->private_data; > diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h > index 5bd76cf394fa..7186b2ae4b57 100644 > --- a/include/linux/kvm_host.h > +++ b/include/linux/kvm_host.h > @@ -2437,18 +2437,8 @@ static inline bool kvm_arch_no_poll(struct kvm_vcpu > *vcpu) > } > #endif /* CONFIG_HAVE_KVM_NO_POLL */ > > -#ifdef CONFIG_HAVE_KVM_VCPU_ASYNC_IOCTL > long kvm_arch_vcpu_async_ioctl(struct file *filp, > unsigned int ioctl, unsigned long arg); > -#else > -static inline long kvm_arch_vcpu_async_ioctl(struct file *filp, > - unsigned int ioctl, > - unsigned long arg) > -{ > - return -ENOIOCTLCMD; > -} > -#endif /* CONFIG_HAVE_KVM_VCPU_ASYNC_IOCTL */ > - > void kvm_arch_guest_memory_reclaimed(struct kvm *kvm); > > #ifdef CONFIG_HAVE_KVM_VCPU_RUN_PID_CHANGE > diff --git a/virt/kvm/Kconfig b/virt/kvm/Kconfig > index 5f0015c5dd95..267c7369c765 100644 > --- a/virt/kvm/Kconfig > +++ b/virt/kvm/Kconfig > @@ -78,9 +78,6 @@ config HAVE_KVM_IRQ_BYPASS > tristate > select IRQ_BYPASS_MANAGER > > -config HAVE_KVM_VCPU_ASYNC_IOCTL > - bool > - > config HAVE_KVM_VCPU_RUN_PID_CHANGE > bool >
