Commit e2d55709 authored by Jason Gunthorpe's avatar Jason Gunthorpe Committed by Alex Williamson

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: default avatarJason Gunthorpe <jgg@nvidia.com>
Reviewed-by: default avatarCornelia Huck <cohuck@redhat.com>
Link: https://lore.kernel.org/r/5-v5-fc5346cacfd4+4c482-vfio_modules_jgg@nvidia.comSigned-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent 20601c45
...@@ -21,7 +21,7 @@ config VFIO_IOMMU_SPAPR_TCE ...@@ -21,7 +21,7 @@ config VFIO_IOMMU_SPAPR_TCE
default VFIO default VFIO
config VFIO_VIRQFD config VFIO_VIRQFD
tristate bool
select EVENTFD select EVENTFD
default n default n
......
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
vfio_virqfd-y := virqfd.o
obj-$(CONFIG_VFIO) += vfio.o obj-$(CONFIG_VFIO) += vfio.o
vfio-y += vfio_main.o \ vfio-y += vfio_main.o \
iova_bitmap.o \ iova_bitmap.o \
container.o container.o
vfio-$(CONFIG_VFIO_VIRQFD) += virqfd.o
obj-$(CONFIG_VFIO_VIRQFD) += vfio_virqfd.o
obj-$(CONFIG_VFIO_IOMMU_TYPE1) += vfio_iommu_type1.o obj-$(CONFIG_VFIO_IOMMU_TYPE1) += vfio_iommu_type1.o
obj-$(CONFIG_VFIO_IOMMU_SPAPR_TCE) += vfio_iommu_spapr_tce.o obj-$(CONFIG_VFIO_IOMMU_SPAPR_TCE) += vfio_iommu_spapr_tce.o
obj-$(CONFIG_VFIO_PCI) += pci/ obj-$(CONFIG_VFIO_PCI) += pci/
......
...@@ -124,6 +124,19 @@ long vfio_container_ioctl_check_extension(struct vfio_container *container, ...@@ -124,6 +124,19 @@ long vfio_container_ioctl_check_extension(struct vfio_container *container,
int __init vfio_container_init(void); int __init vfio_container_init(void);
void vfio_container_cleanup(void); void vfio_container_cleanup(void);
#if IS_ENABLED(CONFIG_VFIO_VIRQFD)
int __init vfio_virqfd_init(void);
void vfio_virqfd_exit(void);
#else
static inline int __init vfio_virqfd_init(void)
{
return 0;
}
static inline void vfio_virqfd_exit(void)
{
}
#endif
#ifdef CONFIG_VFIO_NOIOMMU #ifdef CONFIG_VFIO_NOIOMMU
extern bool vfio_noiommu __read_mostly; extern bool vfio_noiommu __read_mostly;
#else #else
......
...@@ -1832,6 +1832,10 @@ static int __init vfio_init(void) ...@@ -1832,6 +1832,10 @@ static int __init vfio_init(void)
if (ret) if (ret)
return ret; return ret;
ret = vfio_virqfd_init();
if (ret)
goto err_virqfd;
/* /dev/vfio/$GROUP */ /* /dev/vfio/$GROUP */
vfio.class = class_create(THIS_MODULE, "vfio"); vfio.class = class_create(THIS_MODULE, "vfio");
if (IS_ERR(vfio.class)) { if (IS_ERR(vfio.class)) {
...@@ -1862,6 +1866,8 @@ static int __init vfio_init(void) ...@@ -1862,6 +1866,8 @@ static int __init vfio_init(void)
class_destroy(vfio.class); class_destroy(vfio.class);
vfio.class = NULL; vfio.class = NULL;
err_group_class: err_group_class:
vfio_virqfd_exit();
err_virqfd:
vfio_container_cleanup(); vfio_container_cleanup();
return ret; return ret;
} }
...@@ -1876,6 +1882,7 @@ static void __exit vfio_cleanup(void) ...@@ -1876,6 +1882,7 @@ static void __exit vfio_cleanup(void)
class_destroy(vfio.device_class); class_destroy(vfio.device_class);
vfio.device_class = NULL; vfio.device_class = NULL;
class_destroy(vfio.class); class_destroy(vfio.class);
vfio_virqfd_exit();
vfio_container_cleanup(); vfio_container_cleanup();
vfio.class = NULL; vfio.class = NULL;
xa_destroy(&vfio_device_set_xa); xa_destroy(&vfio_device_set_xa);
......
...@@ -12,15 +12,12 @@ ...@@ -12,15 +12,12 @@
#include <linux/file.h> #include <linux/file.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
#include "vfio.h"
#define DRIVER_VERSION "0.1"
#define DRIVER_AUTHOR "Alex Williamson <alex.williamson@redhat.com>"
#define DRIVER_DESC "IRQFD support for VFIO bus drivers"
static struct workqueue_struct *vfio_irqfd_cleanup_wq; static struct workqueue_struct *vfio_irqfd_cleanup_wq;
static DEFINE_SPINLOCK(virqfd_lock); static DEFINE_SPINLOCK(virqfd_lock);
static int __init vfio_virqfd_init(void) int __init vfio_virqfd_init(void)
{ {
vfio_irqfd_cleanup_wq = vfio_irqfd_cleanup_wq =
create_singlethread_workqueue("vfio-irqfd-cleanup"); create_singlethread_workqueue("vfio-irqfd-cleanup");
...@@ -30,7 +27,7 @@ static int __init vfio_virqfd_init(void) ...@@ -30,7 +27,7 @@ static int __init vfio_virqfd_init(void)
return 0; return 0;
} }
static void __exit vfio_virqfd_exit(void) void vfio_virqfd_exit(void)
{ {
destroy_workqueue(vfio_irqfd_cleanup_wq); destroy_workqueue(vfio_irqfd_cleanup_wq);
} }
...@@ -216,11 +213,3 @@ void vfio_virqfd_disable(struct virqfd **pvirqfd) ...@@ -216,11 +213,3 @@ void vfio_virqfd_disable(struct virqfd **pvirqfd)
flush_workqueue(vfio_irqfd_cleanup_wq); flush_workqueue(vfio_irqfd_cleanup_wq);
} }
EXPORT_SYMBOL_GPL(vfio_virqfd_disable); EXPORT_SYMBOL_GPL(vfio_virqfd_disable);
module_init(vfio_virqfd_init);
module_exit(vfio_virqfd_exit);
MODULE_VERSION(DRIVER_VERSION);
MODULE_LICENSE("GPL v2");
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment