Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vfio: Fold vfio_virqfd.ko into vfio.ko

This is only 1.8k, putting it in its own module is not really
necessary. The kconfig infrastructure is still there to completely remove
it for systems that are trying for small footprint.

Put it in the main vfio.ko module now that kbuild can support multiple .c
files.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Link: https://lore.kernel.org/r/5-v5-fc5346cacfd4+4c482-vfio_modules_jgg@nvidia.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>

authored by

Jason Gunthorpe and committed by
Alex Williamson
e2d55709 20601c45

+25 -18
+1 -1
drivers/vfio/Kconfig
··· 21 21 default VFIO 22 22 23 23 config VFIO_VIRQFD 24 - tristate 24 + bool 25 25 select EVENTFD 26 26 default n 27 27
+1 -3
drivers/vfio/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 - vfio_virqfd-y := virqfd.o 3 - 4 2 obj-$(CONFIG_VFIO) += vfio.o 5 3 6 4 vfio-y += vfio_main.o \ 7 5 iova_bitmap.o \ 8 6 container.o 7 + vfio-$(CONFIG_VFIO_VIRQFD) += virqfd.o 9 8 10 - obj-$(CONFIG_VFIO_VIRQFD) += vfio_virqfd.o 11 9 obj-$(CONFIG_VFIO_IOMMU_TYPE1) += vfio_iommu_type1.o 12 10 obj-$(CONFIG_VFIO_IOMMU_SPAPR_TCE) += vfio_iommu_spapr_tce.o 13 11 obj-$(CONFIG_VFIO_PCI) += pci/
+13
drivers/vfio/vfio.h
··· 124 124 int __init vfio_container_init(void); 125 125 void vfio_container_cleanup(void); 126 126 127 + #if IS_ENABLED(CONFIG_VFIO_VIRQFD) 128 + int __init vfio_virqfd_init(void); 129 + void vfio_virqfd_exit(void); 130 + #else 131 + static inline int __init vfio_virqfd_init(void) 132 + { 133 + return 0; 134 + } 135 + static inline void vfio_virqfd_exit(void) 136 + { 137 + } 138 + #endif 139 + 127 140 #ifdef CONFIG_VFIO_NOIOMMU 128 141 extern bool vfio_noiommu __read_mostly; 129 142 #else
+7
drivers/vfio/vfio_main.c
··· 1832 1832 if (ret) 1833 1833 return ret; 1834 1834 1835 + ret = vfio_virqfd_init(); 1836 + if (ret) 1837 + goto err_virqfd; 1838 + 1835 1839 /* /dev/vfio/$GROUP */ 1836 1840 vfio.class = class_create(THIS_MODULE, "vfio"); 1837 1841 if (IS_ERR(vfio.class)) { ··· 1866 1862 class_destroy(vfio.class); 1867 1863 vfio.class = NULL; 1868 1864 err_group_class: 1865 + vfio_virqfd_exit(); 1866 + err_virqfd: 1869 1867 vfio_container_cleanup(); 1870 1868 return ret; 1871 1869 } ··· 1882 1876 class_destroy(vfio.device_class); 1883 1877 vfio.device_class = NULL; 1884 1878 class_destroy(vfio.class); 1879 + vfio_virqfd_exit(); 1885 1880 vfio_container_cleanup(); 1886 1881 vfio.class = NULL; 1887 1882 xa_destroy(&vfio_device_set_xa);
+3 -14
drivers/vfio/virqfd.c
··· 12 12 #include <linux/file.h> 13 13 #include <linux/module.h> 14 14 #include <linux/slab.h> 15 - 16 - #define DRIVER_VERSION "0.1" 17 - #define DRIVER_AUTHOR "Alex Williamson <alex.williamson@redhat.com>" 18 - #define DRIVER_DESC "IRQFD support for VFIO bus drivers" 15 + #include "vfio.h" 19 16 20 17 static struct workqueue_struct *vfio_irqfd_cleanup_wq; 21 18 static DEFINE_SPINLOCK(virqfd_lock); 22 19 23 - static int __init vfio_virqfd_init(void) 20 + int __init vfio_virqfd_init(void) 24 21 { 25 22 vfio_irqfd_cleanup_wq = 26 23 create_singlethread_workqueue("vfio-irqfd-cleanup"); ··· 27 30 return 0; 28 31 } 29 32 30 - static void __exit vfio_virqfd_exit(void) 33 + void vfio_virqfd_exit(void) 31 34 { 32 35 destroy_workqueue(vfio_irqfd_cleanup_wq); 33 36 } ··· 213 216 flush_workqueue(vfio_irqfd_cleanup_wq); 214 217 } 215 218 EXPORT_SYMBOL_GPL(vfio_virqfd_disable); 216 - 217 - module_init(vfio_virqfd_init); 218 - module_exit(vfio_virqfd_exit); 219 - 220 - MODULE_VERSION(DRIVER_VERSION); 221 - MODULE_LICENSE("GPL v2"); 222 - MODULE_AUTHOR(DRIVER_AUTHOR); 223 - MODULE_DESCRIPTION(DRIVER_DESC);