[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <3fcc1552648614e2d37fa2dc997f59184efad838.1696609476.git.reinette.chatre@intel.com>
Date: Fri, 6 Oct 2023 09:41:01 -0700
From: Reinette Chatre <reinette.chatre@...el.com>
To: jgg@...dia.com, yishaih@...dia.com,
shameerali.kolothum.thodi@...wei.com, kevin.tian@...el.com,
alex.williamson@...hat.com
Cc: kvm@...r.kernel.org, dave.jiang@...el.com, jing2.liu@...el.com,
ashok.raj@...el.com, fenghua.yu@...el.com,
tom.zanussi@...ux.intel.com, reinette.chatre@...el.com,
linux-kernel@...r.kernel.org, patches@...ts.linux.dev
Subject: [RFC PATCH V2 06/18] vfio/pci: Separate MSI and MSI-X handling
VFIO PCI interrupt management uses a single entry for both
MSI and MSI-X management with the called functions using a boolean
when necessary to distinguish between MSI and MSI-X. This remains
unchanged.
Virtual device interrupt management should not be required to
use the same callback for both MSI and MSI-X. It may be possible
for a virtual device to not support MSI at all and only
provide MSI-X interrupt management.
Separate the MSI and MSI-X interrupt management by allowing
different callbacks for each interrupt type. For PCI devices
the callback remains the same.
Signed-off-by: Reinette Chatre <reinette.chatre@...el.com>
---
drivers/vfio/pci/vfio_pci_intrs.c | 14 +++++++++++++-
include/linux/vfio_pci_core.h | 3 +++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c
index e2d39b7561b8..76ec5af3681a 100644
--- a/drivers/vfio/pci/vfio_pci_intrs.c
+++ b/drivers/vfio/pci/vfio_pci_intrs.c
@@ -800,6 +800,7 @@ struct vfio_pci_intr_ops vfio_pci_intr_ops = {
.set_intx_unmask = vfio_pci_set_intx_unmask,
.set_intx_trigger = vfio_pci_set_intx_trigger,
.set_msi_trigger = vfio_pci_set_msi_trigger,
+ .set_msix_trigger = vfio_pci_set_msi_trigger,
.set_err_trigger = vfio_pci_set_err_trigger,
.set_req_trigger = vfio_pci_set_req_trigger,
};
@@ -838,7 +839,6 @@ int vfio_pci_set_irqs_ioctl(struct vfio_pci_intr_ctx *intr_ctx, uint32_t flags,
}
break;
case VFIO_PCI_MSI_IRQ_INDEX:
- case VFIO_PCI_MSIX_IRQ_INDEX:
switch (flags & VFIO_IRQ_SET_ACTION_TYPE_MASK) {
case VFIO_IRQ_SET_ACTION_MASK:
case VFIO_IRQ_SET_ACTION_UNMASK:
@@ -850,6 +850,18 @@ int vfio_pci_set_irqs_ioctl(struct vfio_pci_intr_ctx *intr_ctx, uint32_t flags,
break;
}
break;
+ case VFIO_PCI_MSIX_IRQ_INDEX:
+ switch (flags & VFIO_IRQ_SET_ACTION_TYPE_MASK) {
+ case VFIO_IRQ_SET_ACTION_MASK:
+ case VFIO_IRQ_SET_ACTION_UNMASK:
+ /* XXX Need masking support exported */
+ break;
+ case VFIO_IRQ_SET_ACTION_TRIGGER:
+ if (intr_ctx->ops->set_msix_trigger)
+ func = intr_ctx->ops->set_msix_trigger;
+ break;
+ }
+ break;
case VFIO_PCI_ERR_IRQ_INDEX:
switch (flags & VFIO_IRQ_SET_ACTION_TYPE_MASK) {
case VFIO_IRQ_SET_ACTION_TRIGGER:
diff --git a/include/linux/vfio_pci_core.h b/include/linux/vfio_pci_core.h
index aba69669ec25..e9bfca9a0c0a 100644
--- a/include/linux/vfio_pci_core.h
+++ b/include/linux/vfio_pci_core.h
@@ -72,6 +72,9 @@ struct vfio_pci_intr_ops {
int (*set_msi_trigger)(struct vfio_pci_intr_ctx *intr_ctx,
unsigned int index, unsigned int start,
unsigned int count, uint32_t flags, void *data);
+ int (*set_msix_trigger)(struct vfio_pci_intr_ctx *intr_ctx,
+ unsigned int index, unsigned int start,
+ unsigned int count, uint32_t flags, void *data);
int (*set_err_trigger)(struct vfio_pci_intr_ctx *intr_ctx,
unsigned int index, unsigned int start,
unsigned int count, uint32_t flags, void *data);
--
2.34.1
Powered by blists - more mailing lists