vfio/cdx: add interrupt support
Subsystems (3)
Nipun Gupta
maintainerPATCH 1/1 vfio/cdx: add interrupt support
Support the following ioctls for CDX devices:
- VFIO_DEVICE_GET_IRQ_INFO
- VFIO_DEVICE_SET_IRQS
This allows user to set an eventfd for cdx device interrupts and trigger this interrupt eventfd from userspace.
All CDX device interrupts are MSIs. The MSIs are allocated from the CDX-MSI domain.
Signed-off-by Nipun Gupta <[email protected]>
Reviewed-by Pieter Jansen van Vuuren <[email protected]>
---
This patch depends on CDX MSI support patch:
https://lore.kernel.org/all/[email protected]/
drivers/vfio/cdx/Makefile | 2 +- drivers/vfio/cdx/intr.c | 211 +++++++++++++++++++++++++++++++++++++ drivers/vfio/cdx/main.c | 60 ++++++++++- drivers/vfio/cdx/private.h | 18 ++++ 4 files changed, 289 insertions(+), 2 deletions(-) create mode 100644 drivers/vfio/cdx/intr.c
drivers/vfio/cdx/Makefile +1 -1
@@ -5,4 +5,4 @@ obj-$(CONFIG_VFIO_CDX) += vfio-cdx.o -vfio-cdx-objs := main.o +vfio-cdx-objs := main.o intr.o
drivers/vfio/cdx/intr.c new file +211 -0
211 lines not on this page · raw message
drivers/vfio/cdx/main.c +59 -1
84 lines not on this page · raw message
drivers/vfio/cdx/private.h +18 -0
@@ -13,6 +13,14 @@ static inline u64 vfio_cdx_index_to_offset(u32 index)return ((u64)(index) <<VFIO_CDX_OFFSET_SHIFT ); } +struct vfio_cdx_irq { +u32 flags; +u32 count; +int irq_no; +struct eventfd_ctx *trigger; +char *name; +}; +struct vfio_cdx_region {u32 flags;u32 type;
@@ -23,6 +31,16 @@ struct vfio_cdx_region {struct vfio_cdx_device {struct vfio_device vdev;struct vfio_cdx_region *regions; +struct vfio_cdx_irq *cdx_irqs; +u32 irq_count; +u32 config_msi; }; +int vfio_cdx_set_irqs_ioctl (struct vfio_cdx_device *vdev, +u32 flags,unsigned int index, +unsigned int start,unsigned int count, +void *data); + +void vfio_cdx_irqs_cleanup (struct vfio_cdx_device *vdev); +#endif /* VFIO_CDX_PRIVATE_H */
Signature · 1 line
2.17.1