Message ID | 0550572e64505df6ecff0b08f1eca869a79f6acf.1706849424.git.reinette.chatre@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | vfio/pci: Remove duplicate code and logic from VFIO PCI interrupt management | expand |
On Thu, 1 Feb 2024 20:57:06 -0800 Reinette Chatre <reinette.chatre@intel.com> wrote: > vfio_msi_set_vector_signal() and by extension vfio_msi_set_block() > are no longer specific to MSI and MSI-X interrupts. > > Change the name of these functions in preparation for them > to be used for management of INTx interrupts. > > Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> > --- > drivers/vfio/pci/vfio_pci_intrs.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c > index 07dc388c4513..7f9dc81cb97f 100644 > --- a/drivers/vfio/pci/vfio_pci_intrs.c > +++ b/drivers/vfio/pci/vfio_pci_intrs.c > @@ -557,7 +557,7 @@ static struct vfio_pci_intr_ops intr_ops[] = { > }, > }; > > -static int vfio_msi_set_vector_signal(struct vfio_pci_core_device *vdev, > +static int vfio_irq_set_vector_signal(struct vfio_pci_core_device *vdev, > unsigned int vector, int fd, > unsigned int index) > { > @@ -617,7 +617,7 @@ static int vfio_msi_set_vector_signal(struct vfio_pci_core_device *vdev, > return ret; > } > > -static int vfio_msi_set_block(struct vfio_pci_core_device *vdev, > +static int vfio_irq_set_block(struct vfio_pci_core_device *vdev, > unsigned int start, unsigned int count, > int32_t *fds, unsigned int index) > { > @@ -626,12 +626,12 @@ static int vfio_msi_set_block(struct vfio_pci_core_device *vdev, > > for (i = 0, j = start; i < count && !ret; i++, j++) { > int fd = fds ? fds[i] : -1; > - ret = vfio_msi_set_vector_signal(vdev, j, fd, index); > + ret = vfio_irq_set_vector_signal(vdev, j, fd, index); > } > > if (ret) { > for (i = start; i < j; i++) > - vfio_msi_set_vector_signal(vdev, i, -1, index); > + vfio_irq_set_vector_signal(vdev, i, -1, index); > } > > return ret; > @@ -648,7 +648,7 @@ static void vfio_msi_disable(struct vfio_pci_core_device *vdev, > xa_for_each(&vdev->ctx, i, ctx) { > vfio_virqfd_disable(&ctx->unmask); > vfio_virqfd_disable(&ctx->mask); > - vfio_msi_set_vector_signal(vdev, i, -1, index); > + vfio_irq_set_vector_signal(vdev, i, -1, index); > vfio_irq_ctx_free(vdev, ctx, i); > } > > @@ -786,14 +786,14 @@ static int vfio_pci_set_msi_trigger(struct vfio_pci_core_device *vdev, > int ret; > > if (vdev->irq_type == index) It's unfortunate that the one place in the code that doesn't use irq_is() is the one that turns into the central callout function, maybe we can fix it along the way. Thanks, Alex > - return vfio_msi_set_block(vdev, start, count, > + return vfio_irq_set_block(vdev, start, count, > fds, index); > > ret = vfio_msi_enable(vdev, start + count, index); > if (ret) > return ret; > > - ret = vfio_msi_set_block(vdev, start, count, fds, index); > + ret = vfio_irq_set_block(vdev, start, count, fds, index); > if (ret) > vfio_msi_disable(vdev, index); >
Hi Alex, On 2/5/2024 2:35 PM, Alex Williamson wrote: > On Thu, 1 Feb 2024 20:57:06 -0800 > Reinette Chatre <reinette.chatre@intel.com> wrote: > >> @@ -786,14 +786,14 @@ static int vfio_pci_set_msi_trigger(struct vfio_pci_core_device *vdev, >> int ret; >> >> if (vdev->irq_type == index) > > It's unfortunate that the one place in the code that doesn't use > irq_is() is the one that turns into the central callout function, maybe > we can fix it along the way. Thanks, > Will do. Thank you. Reinette
diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c index 07dc388c4513..7f9dc81cb97f 100644 --- a/drivers/vfio/pci/vfio_pci_intrs.c +++ b/drivers/vfio/pci/vfio_pci_intrs.c @@ -557,7 +557,7 @@ static struct vfio_pci_intr_ops intr_ops[] = { }, }; -static int vfio_msi_set_vector_signal(struct vfio_pci_core_device *vdev, +static int vfio_irq_set_vector_signal(struct vfio_pci_core_device *vdev, unsigned int vector, int fd, unsigned int index) { @@ -617,7 +617,7 @@ static int vfio_msi_set_vector_signal(struct vfio_pci_core_device *vdev, return ret; } -static int vfio_msi_set_block(struct vfio_pci_core_device *vdev, +static int vfio_irq_set_block(struct vfio_pci_core_device *vdev, unsigned int start, unsigned int count, int32_t *fds, unsigned int index) { @@ -626,12 +626,12 @@ static int vfio_msi_set_block(struct vfio_pci_core_device *vdev, for (i = 0, j = start; i < count && !ret; i++, j++) { int fd = fds ? fds[i] : -1; - ret = vfio_msi_set_vector_signal(vdev, j, fd, index); + ret = vfio_irq_set_vector_signal(vdev, j, fd, index); } if (ret) { for (i = start; i < j; i++) - vfio_msi_set_vector_signal(vdev, i, -1, index); + vfio_irq_set_vector_signal(vdev, i, -1, index); } return ret; @@ -648,7 +648,7 @@ static void vfio_msi_disable(struct vfio_pci_core_device *vdev, xa_for_each(&vdev->ctx, i, ctx) { vfio_virqfd_disable(&ctx->unmask); vfio_virqfd_disable(&ctx->mask); - vfio_msi_set_vector_signal(vdev, i, -1, index); + vfio_irq_set_vector_signal(vdev, i, -1, index); vfio_irq_ctx_free(vdev, ctx, i); } @@ -786,14 +786,14 @@ static int vfio_pci_set_msi_trigger(struct vfio_pci_core_device *vdev, int ret; if (vdev->irq_type == index) - return vfio_msi_set_block(vdev, start, count, + return vfio_irq_set_block(vdev, start, count, fds, index); ret = vfio_msi_enable(vdev, start + count, index); if (ret) return ret; - ret = vfio_msi_set_block(vdev, start, count, fds, index); + ret = vfio_irq_set_block(vdev, start, count, fds, index); if (ret) vfio_msi_disable(vdev, index);
vfio_msi_set_vector_signal() and by extension vfio_msi_set_block() are no longer specific to MSI and MSI-X interrupts. Change the name of these functions in preparation for them to be used for management of INTx interrupts. Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> --- drivers/vfio/pci/vfio_pci_intrs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)