@@ -73,6 +73,14 @@ vfio_irq_ctx_alloc(struct vfio_pci_intr_ctx *intr_ctx, unsigned long index)
if (!ctx)
return NULL;
+ if (intr_ctx->ops->init_irq_ctx) {
+ ret = intr_ctx->ops->init_irq_ctx(intr_ctx, ctx);
+ if (ret < 0) {
+ kfree(ctx);
+ return NULL;
+ }
+ }
+
ret = xa_insert(&intr_ctx->ctx, index, ctx, GFP_KERNEL_ACCOUNT);
if (ret) {
kfree(ctx);
@@ -106,6 +106,8 @@ struct vfio_pci_intr_ops {
unsigned int vector);
char *(*msi_device_name)(struct vfio_pci_intr_ctx *intr_ctx,
unsigned int vector, unsigned int index);
+ int (*init_irq_ctx)(struct vfio_pci_intr_ctx *intr_ctx,
+ struct vfio_pci_irq_ctx *ctx);
};
struct vfio_pci_core_device {
The per-interrupt context may contain backend specific data. Call a backend provided initializer on per-interrupt context creation. Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> --- Changes since RFC V2: - New patch drivers/vfio/pci/vfio_pci_intrs.c | 8 ++++++++ include/linux/vfio_pci_core.h | 2 ++ 2 files changed, 10 insertions(+)