On Fri, Jun 02, 2023, Anish Moorthy wrote: > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index 05d6e7e3994d..2c276d4d0821 100644 > --- a/virt/kvm/kvm_main.c > +++ b/virt/kvm/kvm_main.c > @@ -1527,6 +1527,9 @@ static int check_memory_region_flags(const struct kvm_userspace_memory_region *m > valid_flags |= KVM_MEM_READONLY; > #endif > > + if (kvm_vm_ioctl_check_extension(NULL, KVM_CAP_NOWAIT_ON_FAULT)) Rather than force architectures to add the extension, probably better to use a config HAVE_KVM_NOWAIT_ON_FAULT bool and select that from arch Kconfigs. That way the enumeration can be done in common code, and then this can be computed at compile time doesn't need to do a rather weird invocation of kvm_dev_ioctl() with KVM_CHECK_EXTENSION. FWIW, you should be able to do if (IS_ENABLED(CONFIG_HAVE_KVM_NOWAIT_ON_FAULT)) and avoid more #ifdefs.