diff options
author | Antonios Motakis <a.motakis@virtualopensystems.com> | 2015-03-16 16:08:51 -0400 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2015-03-16 16:08:51 -0400 |
commit | bdc5e1021b7fa061d21e64fc6d308ee0ef3c7582 (patch) | |
tree | 24ef5af5b64f5414a0bcef8139072bc13ef75f32 /drivers/vfio | |
parent | 06211b40ce6b63903fe03831fd075a25630dc856 (diff) |
vfio: add a vfio_ prefix to virqfd_enable and virqfd_disable and export
We want to reuse virqfd functionality in multiple VFIO drivers; before
moving these functions to core VFIO, add the vfio_ prefix to the
virqfd_enable and virqfd_disable functions, and export them so they can
be used from other modules.
Signed-off-by: Antonios Motakis <a.motakis@virtualopensystems.com>
Signed-off-by: Baptiste Reynal <b.reynal@virtualopensystems.com>
Reviewed-by: Eric Auger <eric.auger@linaro.org>
Tested-by: Eric Auger <eric.auger@linaro.org>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio')
-rw-r--r-- | drivers/vfio/pci/vfio_pci_intrs.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c index 2027a27546ef..09e38b92ae50 100644 --- a/drivers/vfio/pci/vfio_pci_intrs.c +++ b/drivers/vfio/pci/vfio_pci_intrs.c | |||
@@ -126,10 +126,10 @@ static void virqfd_inject(struct work_struct *work) | |||
126 | virqfd->thread(virqfd->vdev, virqfd->data); | 126 | virqfd->thread(virqfd->vdev, virqfd->data); |
127 | } | 127 | } |
128 | 128 | ||
129 | static int virqfd_enable(struct vfio_pci_device *vdev, | 129 | int vfio_virqfd_enable(struct vfio_pci_device *vdev, |
130 | int (*handler)(struct vfio_pci_device *, void *), | 130 | int (*handler)(struct vfio_pci_device *, void *), |
131 | void (*thread)(struct vfio_pci_device *, void *), | 131 | void (*thread)(struct vfio_pci_device *, void *), |
132 | void *data, struct virqfd **pvirqfd, int fd) | 132 | void *data, struct virqfd **pvirqfd, int fd) |
133 | { | 133 | { |
134 | struct fd irqfd; | 134 | struct fd irqfd; |
135 | struct eventfd_ctx *ctx; | 135 | struct eventfd_ctx *ctx; |
@@ -215,9 +215,9 @@ err_fd: | |||
215 | 215 | ||
216 | return ret; | 216 | return ret; |
217 | } | 217 | } |
218 | EXPORT_SYMBOL_GPL(vfio_virqfd_enable); | ||
218 | 219 | ||
219 | static void virqfd_disable(struct vfio_pci_device *vdev, | 220 | void vfio_virqfd_disable(struct vfio_pci_device *vdev, struct virqfd **pvirqfd) |
220 | struct virqfd **pvirqfd) | ||
221 | { | 221 | { |
222 | unsigned long flags; | 222 | unsigned long flags; |
223 | 223 | ||
@@ -237,6 +237,7 @@ static void virqfd_disable(struct vfio_pci_device *vdev, | |||
237 | */ | 237 | */ |
238 | flush_workqueue(vfio_irqfd_cleanup_wq); | 238 | flush_workqueue(vfio_irqfd_cleanup_wq); |
239 | } | 239 | } |
240 | EXPORT_SYMBOL_GPL(vfio_virqfd_disable); | ||
240 | 241 | ||
241 | /* | 242 | /* |
242 | * INTx | 243 | * INTx |
@@ -440,8 +441,8 @@ static int vfio_intx_set_signal(struct vfio_pci_device *vdev, int fd) | |||
440 | static void vfio_intx_disable(struct vfio_pci_device *vdev) | 441 | static void vfio_intx_disable(struct vfio_pci_device *vdev) |
441 | { | 442 | { |
442 | vfio_intx_set_signal(vdev, -1); | 443 | vfio_intx_set_signal(vdev, -1); |
443 | virqfd_disable(vdev, &vdev->ctx[0].unmask); | 444 | vfio_virqfd_disable(vdev, &vdev->ctx[0].unmask); |
444 | virqfd_disable(vdev, &vdev->ctx[0].mask); | 445 | vfio_virqfd_disable(vdev, &vdev->ctx[0].mask); |
445 | vdev->irq_type = VFIO_PCI_NUM_IRQS; | 446 | vdev->irq_type = VFIO_PCI_NUM_IRQS; |
446 | vdev->num_ctx = 0; | 447 | vdev->num_ctx = 0; |
447 | kfree(vdev->ctx); | 448 | kfree(vdev->ctx); |
@@ -605,8 +606,8 @@ static void vfio_msi_disable(struct vfio_pci_device *vdev, bool msix) | |||
605 | vfio_msi_set_block(vdev, 0, vdev->num_ctx, NULL, msix); | 606 | vfio_msi_set_block(vdev, 0, vdev->num_ctx, NULL, msix); |
606 | 607 | ||
607 | for (i = 0; i < vdev->num_ctx; i++) { | 608 | for (i = 0; i < vdev->num_ctx; i++) { |
608 | virqfd_disable(vdev, &vdev->ctx[i].unmask); | 609 | vfio_virqfd_disable(vdev, &vdev->ctx[i].unmask); |
609 | virqfd_disable(vdev, &vdev->ctx[i].mask); | 610 | vfio_virqfd_disable(vdev, &vdev->ctx[i].mask); |
610 | } | 611 | } |
611 | 612 | ||
612 | if (msix) { | 613 | if (msix) { |
@@ -639,11 +640,12 @@ static int vfio_pci_set_intx_unmask(struct vfio_pci_device *vdev, | |||
639 | } else if (flags & VFIO_IRQ_SET_DATA_EVENTFD) { | 640 | } else if (flags & VFIO_IRQ_SET_DATA_EVENTFD) { |
640 | int32_t fd = *(int32_t *)data; | 641 | int32_t fd = *(int32_t *)data; |
641 | if (fd >= 0) | 642 | if (fd >= 0) |
642 | return virqfd_enable(vdev, vfio_pci_intx_unmask_handler, | 643 | return vfio_virqfd_enable(vdev, |
643 | vfio_send_intx_eventfd, NULL, | 644 | vfio_pci_intx_unmask_handler, |
644 | &vdev->ctx[0].unmask, fd); | 645 | vfio_send_intx_eventfd, NULL, |
646 | &vdev->ctx[0].unmask, fd); | ||
645 | 647 | ||
646 | virqfd_disable(vdev, &vdev->ctx[0].unmask); | 648 | vfio_virqfd_disable(vdev, &vdev->ctx[0].unmask); |
647 | } | 649 | } |
648 | 650 | ||
649 | return 0; | 651 | return 0; |