All of lore.kernel.org
 help / color / mirror / Atom feed
From: Baptiste Reynal <b.reynal@virtualopensystems.com>
To: kvmarm@lists.cs.columbia.edu, iommu@lists.linux-fundation.org,
	alex.williamson@redhat.com
Cc: will.deacon@arm.com, tech@virtualopensystems.com,
	christoffer.dall@linaro.org, eric.auger@linaro.org,
	kim.phillips@freescale.com, marc.zyngier@arm.com,
	Antonios Motakis <a.motakis@virtualopensystems.com>,
	Gavin Shan <gwshan@linux.vnet.ibm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Alexander Gordeev <agordeev@redhat.com>,
	Jiang Liu <jiang.liu@linux.intel.com>,
	kvm@vger.kernel.org (open list:VFIO DRIVER),
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH v12 12/18] vfio: add a vfio_ prefix to virqfd_enable and virqfd_disable and export
Date: Wed, 21 Jan 2015 13:50:00 +0100	[thread overview]
Message-ID: <1421844606-24751-13-git-send-email-b.reynal@virtualopensystems.com> (raw)
In-Reply-To: <1421844606-24751-1-git-send-email-b.reynal@virtualopensystems.com>

From: Antonios Motakis <a.motakis@virtualopensystems.com>

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>
---
 drivers/vfio/pci/vfio_pci_intrs.c   | 30 ++++++++++++++++--------------
 drivers/vfio/pci/vfio_pci_private.h |  4 ++--
 2 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c
index e8d695b..0a41833d 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)
 		virqfd->thread(virqfd->vdev, virqfd->data);
 }
 
-static int virqfd_enable(struct vfio_pci_device *vdev,
-			 int (*handler)(struct vfio_pci_device *, void *),
-			 void (*thread)(struct vfio_pci_device *, void *),
-			 void *data, struct virqfd **pvirqfd, int fd)
+int vfio_virqfd_enable(struct vfio_pci_device *vdev,
+		       int (*handler)(struct vfio_pci_device *, void *),
+		       void (*thread)(struct vfio_pci_device *, void *),
+		       void *data, struct virqfd **pvirqfd, int fd)
 {
 	struct fd irqfd;
 	struct eventfd_ctx *ctx;
@@ -215,9 +215,9 @@ err_fd:
 
 	return ret;
 }
+EXPORT_SYMBOL_GPL(vfio_virqfd_enable);
 
-static void virqfd_disable(struct vfio_pci_device *vdev,
-			   struct virqfd **pvirqfd)
+void vfio_virqfd_disable(struct vfio_pci_device *vdev, struct virqfd **pvirqfd)
 {
 	unsigned long flags;
 
@@ -237,6 +237,7 @@ static void virqfd_disable(struct vfio_pci_device *vdev,
 	 */
 	flush_workqueue(vfio_irqfd_cleanup_wq);
 }
+EXPORT_SYMBOL_GPL(vfio_virqfd_disable);
 
 /*
  * INTx
@@ -440,8 +441,8 @@ static int vfio_intx_set_signal(struct vfio_pci_device *vdev, int fd)
 static void vfio_intx_disable(struct vfio_pci_device *vdev)
 {
 	vfio_intx_set_signal(vdev, -1);
-	virqfd_disable(vdev, &vdev->ctx[0].unmask);
-	virqfd_disable(vdev, &vdev->ctx[0].mask);
+	vfio_virqfd_disable(vdev, &vdev->ctx[0].unmask);
+	vfio_virqfd_disable(vdev, &vdev->ctx[0].mask);
 	vdev->irq_type = VFIO_PCI_NUM_IRQS;
 	vdev->num_ctx = 0;
 	kfree(vdev->ctx);
@@ -605,8 +606,8 @@ static void vfio_msi_disable(struct vfio_pci_device *vdev, bool msix)
 	vfio_msi_set_block(vdev, 0, vdev->num_ctx, NULL, msix);
 
 	for (i = 0; i < vdev->num_ctx; i++) {
-		virqfd_disable(vdev, &vdev->ctx[i].unmask);
-		virqfd_disable(vdev, &vdev->ctx[i].mask);
+		vfio_virqfd_disable(vdev, &vdev->ctx[i].unmask);
+		vfio_virqfd_disable(vdev, &vdev->ctx[i].mask);
 	}
 
 	if (msix) {
@@ -639,11 +640,12 @@ static int vfio_pci_set_intx_unmask(struct vfio_pci_device *vdev,
 	} else if (flags & VFIO_IRQ_SET_DATA_EVENTFD) {
 		int32_t fd = *(int32_t *)data;
 		if (fd >= 0)
-			return virqfd_enable(vdev, vfio_pci_intx_unmask_handler,
-					     vfio_send_intx_eventfd, NULL,
-					     &vdev->ctx[0].unmask, fd);
+			return vfio_virqfd_enable(vdev,
+						  vfio_pci_intx_unmask_handler,
+						  vfio_send_intx_eventfd, NULL,
+						  &vdev->ctx[0].unmask, fd);
 
-		virqfd_disable(vdev, &vdev->ctx[0].unmask);
+		vfio_virqfd_disable(vdev, &vdev->ctx[0].unmask);
 	}
 
 	return 0;
diff --git a/drivers/vfio/pci/vfio_pci_private.h b/drivers/vfio/pci/vfio_pci_private.h
index 671c17a..2e2f0ea 100644
--- a/drivers/vfio/pci/vfio_pci_private.h
+++ b/drivers/vfio/pci/vfio_pci_private.h
@@ -86,8 +86,8 @@ extern ssize_t vfio_pci_vga_rw(struct vfio_pci_device *vdev, char __user *buf,
 extern int vfio_pci_init_perm_bits(void);
 extern void vfio_pci_uninit_perm_bits(void);
 
-extern int vfio_pci_virqfd_init(void);
-extern void vfio_pci_virqfd_exit(void);
+extern int vfio_virqfd_init(void);
+extern void vfio_virqfd_exit(void);
 
 extern int vfio_config_init(struct vfio_pci_device *vdev);
 extern void vfio_config_free(struct vfio_pci_device *vdev);
-- 
2.2.2


  parent reply	other threads:[~2015-01-21 12:53 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1421844606-24751-1-git-send-email-b.reynal@virtualopensystems.com>
2015-01-21 12:49 ` [PATCH v12 01/18] vfio/platform: initial skeleton of VFIO support for platform devices Baptiste Reynal
2015-01-21 12:49 ` [PATCH v12 02/18] vfio: platform: probe to devices on the platform bus Baptiste Reynal
2015-01-21 12:49   ` Baptiste Reynal
2015-01-21 12:49 ` [PATCH v12 03/18] vfio: platform: add the VFIO PLATFORM module to Kconfig Baptiste Reynal
2015-01-21 12:49 ` [PATCH v12 04/18] vfio/platform: return info for bound device Baptiste Reynal
2015-01-21 12:49 ` [PATCH v12 05/18] vfio/platform: return info for device memory mapped IO regions Baptiste Reynal
2015-01-21 12:49 ` [PATCH v12 06/18] vfio/platform: read and write support for the device fd Baptiste Reynal
2015-01-21 12:49 ` [PATCH v12 07/18] vfio/platform: support MMAP of MMIO regions Baptiste Reynal
2015-01-21 12:49 ` [PATCH v12 08/18] vfio/platform: return IRQ info Baptiste Reynal
2015-01-21 12:49 ` [PATCH v12 09/18] vfio/platform: initial interrupts support code Baptiste Reynal
2015-01-21 12:49 ` [PATCH v12 10/18] vfio/platform: trigger an interrupt via eventfd Baptiste Reynal
2015-01-21 23:26   ` Alex Williamson
2015-01-21 12:49 ` [PATCH v12 11/18] vfio/platform: support for level sensitive interrupts Baptiste Reynal
2015-01-21 12:50 ` Baptiste Reynal [this message]
2015-01-21 23:25   ` [PATCH v12 12/18] vfio: add a vfio_ prefix to virqfd_enable and virqfd_disable and export Alex Williamson
2015-01-21 12:50 ` [PATCH v12 13/18] vfio: virqfd: rename vfio_pci_virqfd_init and vfio_pci_virqfd_exit Baptiste Reynal
2015-01-21 12:50 ` [PATCH v12 14/18] vfio: add local lock for virqfd instead of depending on VFIO PCI Baptiste Reynal
2015-01-21 12:50 ` [PATCH v12 15/18] vfio: pass an opaque pointer on virqfd initialization Baptiste Reynal
2015-01-21 12:50 ` [PATCH v12 16/18] vfio: move eventfd support code for VFIO_PCI to a separate file Baptiste Reynal
2015-01-21 12:50 ` [PATCH v12 17/18] vfio: initialize the virqfd workqueue in VFIO generic code Baptiste Reynal
2015-01-21 12:50 ` [PATCH v12 18/18] vfio/platform: implement IRQ masking/unmasking via an eventfd Baptiste Reynal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1421844606-24751-13-git-send-email-b.reynal@virtualopensystems.com \
    --to=b.reynal@virtualopensystems.com \
    --cc=a.motakis@virtualopensystems.com \
    --cc=agordeev@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=christoffer.dall@linaro.org \
    --cc=eric.auger@linaro.org \
    --cc=gwshan@linux.vnet.ibm.com \
    --cc=iommu@lists.linux-fundation.org \
    --cc=jiang.liu@linux.intel.com \
    --cc=kim.phillips@freescale.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=tech@virtualopensystems.com \
    --cc=tglx@linutronix.de \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.