Re: [PATCH] vfio-pci/zdev: require KVM to be built-in

From: Pierre Morel
Date: Tue Aug 16 2022 - 05:31:07 EST




On 8/16/22 08:04, Randy Dunlap wrote:
Hi--

On 8/15/22 02:43, Pierre Morel wrote:
Thank you Randy for this good catch.
However forcing KVM to be include statically in the kernel when using VFIO_PCI extensions is not a good solution for us I think.

I suggest we better do something like:

----

diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index 6287a843e8bc..1733339cc4eb 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -1038,7 +1038,7 @@ static inline void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu) {}
 #define __KVM_HAVE_ARCH_VM_FREE
 void kvm_arch_free_vm(struct kvm *kvm);

-#ifdef CONFIG_VFIO_PCI_ZDEV_KVM
+#if defined(CONFIG_VFIO_PCI_ZDEV_KVM) || defined(CONFIG_VFIO_PCI_ZDEV_KVM_MODULE)

This all looks good except for the line above.
It should be:

#if IS_ENABLED(CONFIG_VFIO_PCI_ZDEV_KVM)

Thanks.

Yes, better, thanks.
How do we do? Should I repost it with reported-by you or do you want to post it?

Pierre




 int kvm_s390_pci_register_kvm(struct zpci_dev *zdev, struct kvm *kvm);
 void kvm_s390_pci_unregister_kvm(struct zpci_dev *zdev);
 #else
diff --git a/drivers/vfio/pci/Kconfig b/drivers/vfio/pci/Kconfig
index f9d0c908e738..bbc375b028ef 100644
--- a/drivers/vfio/pci/Kconfig
+++ b/drivers/vfio/pci/Kconfig
@@ -45,9 +45,9 @@ config VFIO_PCI_IGD
 endif

 config VFIO_PCI_ZDEV_KVM
-       bool "VFIO PCI extensions for s390x KVM passthrough"
+       def_tristate y
+       prompt "VFIO PCI extensions for s390x KVM passthrough"
        depends on S390 && KVM
-       default y
        help
          Support s390x-specific extensions to enable support for enhancements
          to KVM passthrough capabilities, such as interpretive execution of

----

What do you think? It seems to me it solves the problem, what do you think?

Regards,
Pierre



--
Pierre Morel
IBM Lab Boeblingen