From: Christoph Hellwig <hch@lst.de>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: Diana Craciun <diana.craciun@oss.nxp.com>,
Cornelia Huck <cohuck@redhat.com>,
Kirti Wankhede <kwankhede@nvidia.com>,
Eric Auger <eric.auger@redhat.com>,
Jason Gunthorpe <jgg@ziepe.ca>,
Terrence Xu <terrence.xu@intel.com>,
kvm@vger.kernel.org, Jason Gunthorpe <jgg@nvidia.com>,
Kevin Tian <kevin.tian@intel.com>
Subject: [PATCH 09/15] vfio: move the vfio_iommu_driver_ops interface out of <linux/vfio.h>
Date: Fri, 24 Sep 2021 17:56:59 +0200 [thread overview]
Message-ID: <20210924155705.4258-10-hch@lst.de> (raw)
In-Reply-To: <20210924155705.4258-1-hch@lst.de>
Create a new private drivers/vfio/vfio.h header for the interface between
the VFIO core and the iommu drivers.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
drivers/vfio/vfio.c | 1 +
drivers/vfio/vfio.h | 47 +++++++++++++++++++++++++++++
drivers/vfio/vfio_iommu_spapr_tce.c | 1 +
drivers/vfio/vfio_iommu_type1.c | 1 +
include/linux/vfio.h | 44 ---------------------------
5 files changed, 50 insertions(+), 44 deletions(-)
create mode 100644 drivers/vfio/vfio.h
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index 2c1c7316aa192c..6589e296ef348c 100644
--- a/drivers/vfio/vfio.c
+++ b/drivers/vfio/vfio.c
@@ -32,6 +32,7 @@
#include <linux/vfio.h>
#include <linux/wait.h>
#include <linux/sched/signal.h>
+#include "vfio.h"
#define DRIVER_VERSION "0.3"
#define DRIVER_AUTHOR "Alex Williamson <alex.williamson@redhat.com>"
diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h
new file mode 100644
index 00000000000000..a78de649eb2f16
--- /dev/null
+++ b/drivers/vfio/vfio.h
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ * Author: Alex Williamson <alex.williamson@redhat.com>
+ */
+
+/* events for the backend driver notify callback */
+enum vfio_iommu_notify_type {
+ VFIO_IOMMU_CONTAINER_CLOSE = 0,
+};
+
+/**
+ * struct vfio_iommu_driver_ops - VFIO IOMMU driver callbacks
+ */
+struct vfio_iommu_driver_ops {
+ char *name;
+ struct module *owner;
+ void *(*open)(unsigned long arg);
+ void (*release)(void *iommu_data);
+ long (*ioctl)(void *iommu_data, unsigned int cmd,
+ unsigned long arg);
+ int (*attach_group)(void *iommu_data,
+ struct iommu_group *group);
+ void (*detach_group)(void *iommu_data,
+ struct iommu_group *group);
+ int (*pin_pages)(void *iommu_data,
+ struct iommu_group *group,
+ unsigned long *user_pfn,
+ int npage, int prot,
+ unsigned long *phys_pfn);
+ int (*unpin_pages)(void *iommu_data,
+ unsigned long *user_pfn, int npage);
+ int (*register_notifier)(void *iommu_data,
+ unsigned long *events,
+ struct notifier_block *nb);
+ int (*unregister_notifier)(void *iommu_data,
+ struct notifier_block *nb);
+ int (*dma_rw)(void *iommu_data, dma_addr_t user_iova,
+ void *data, size_t count, bool write);
+ struct iommu_domain *(*group_iommu_domain)(void *iommu_data,
+ struct iommu_group *group);
+ void (*notify)(void *iommu_data,
+ enum vfio_iommu_notify_type event);
+};
+
+int vfio_register_iommu_driver(const struct vfio_iommu_driver_ops *ops);
+void vfio_unregister_iommu_driver(const struct vfio_iommu_driver_ops *ops);
diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c
index fe888b5dcc0062..3efd09faeca4a8 100644
--- a/drivers/vfio/vfio_iommu_spapr_tce.c
+++ b/drivers/vfio/vfio_iommu_spapr_tce.c
@@ -20,6 +20,7 @@
#include <linux/sched/mm.h>
#include <linux/sched/signal.h>
#include <linux/mm.h>
+#include "vfio.h"
#include <asm/iommu.h>
#include <asm/tce.h>
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index 0e9217687f5c3e..2e51e4390c1531 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -40,6 +40,7 @@
#include <linux/notifier.h>
#include <linux/dma-iommu.h>
#include <linux/irqdomain.h>
+#include "vfio.h"
#define DRIVER_VERSION "0.2"
#define DRIVER_AUTHOR "Alex Williamson <alex.williamson@redhat.com>"
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 7a57a0077f9637..76191d7abed185 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -82,50 +82,6 @@ extern void vfio_device_put(struct vfio_device *device);
int vfio_assign_device_set(struct vfio_device *device, void *set_id);
-/* events for the backend driver notify callback */
-enum vfio_iommu_notify_type {
- VFIO_IOMMU_CONTAINER_CLOSE = 0,
-};
-
-/**
- * struct vfio_iommu_driver_ops - VFIO IOMMU driver callbacks
- */
-struct vfio_iommu_driver_ops {
- char *name;
- struct module *owner;
- void *(*open)(unsigned long arg);
- void (*release)(void *iommu_data);
- long (*ioctl)(void *iommu_data, unsigned int cmd,
- unsigned long arg);
- int (*attach_group)(void *iommu_data,
- struct iommu_group *group);
- void (*detach_group)(void *iommu_data,
- struct iommu_group *group);
- int (*pin_pages)(void *iommu_data,
- struct iommu_group *group,
- unsigned long *user_pfn,
- int npage, int prot,
- unsigned long *phys_pfn);
- int (*unpin_pages)(void *iommu_data,
- unsigned long *user_pfn, int npage);
- int (*register_notifier)(void *iommu_data,
- unsigned long *events,
- struct notifier_block *nb);
- int (*unregister_notifier)(void *iommu_data,
- struct notifier_block *nb);
- int (*dma_rw)(void *iommu_data, dma_addr_t user_iova,
- void *data, size_t count, bool write);
- struct iommu_domain *(*group_iommu_domain)(void *iommu_data,
- struct iommu_group *group);
- void (*notify)(void *iommu_data,
- enum vfio_iommu_notify_type event);
-};
-
-extern int vfio_register_iommu_driver(const struct vfio_iommu_driver_ops *ops);
-
-extern void vfio_unregister_iommu_driver(
- const struct vfio_iommu_driver_ops *ops);
-
/*
* External user API
*/
--
2.30.2
next prev parent reply other threads:[~2021-09-24 16:08 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-24 15:56 cleanup vfio iommu_group creation v6 Christoph Hellwig
2021-09-24 15:56 ` [PATCH 01/15] vfio: Move vfio_iommu_group_get() to vfio_register_group_dev() Christoph Hellwig
2021-09-24 15:56 ` [PATCH 02/15] vfio: factor out a vfio_iommu_driver_allowed helper Christoph Hellwig
2021-09-24 15:56 ` [PATCH 03/15] vfio: remove the iommudata check in vfio_noiommu_attach_group Christoph Hellwig
2021-09-24 15:56 ` [PATCH 04/15] vfio: factor out a vfio_group_find_or_alloc helper Christoph Hellwig
2021-09-24 15:56 ` [PATCH 05/15] vfio: refactor noiommu group creation Christoph Hellwig
2021-09-24 15:56 ` [PATCH 06/15] vfio: remove the iommudata hack for noiommu groups Christoph Hellwig
2021-09-24 15:56 ` [PATCH 07/15] vfio: simplify iommu group allocation for mediated devices Christoph Hellwig
2021-09-24 15:56 ` [PATCH 08/15] vfio: remove unused method from vfio_iommu_driver_ops Christoph Hellwig
2021-09-24 15:56 ` Christoph Hellwig [this message]
2021-09-24 15:57 ` [PATCH 10/15] vfio: remove the unused mdev iommu hook Christoph Hellwig
2021-09-24 15:57 ` [PATCH 11/15] vfio: clean up the check for mediated device in vfio_iommu_type1 Christoph Hellwig
2021-09-24 15:57 ` [PATCH 12/15] vfio/spapr_tce: reject mediated devices Christoph Hellwig
2021-09-24 15:57 ` [PATCH 13/15] vfio/iommu_type1: initialize pgsize_bitmap in ->open Christoph Hellwig
2021-09-24 17:48 ` Jason Gunthorpe
2021-09-24 18:37 ` Alex Williamson
2021-09-27 11:49 ` Christoph Hellwig
2021-09-27 12:56 ` Alex Williamson
2021-09-27 13:53 ` Christoph Hellwig
2021-09-24 15:57 ` [PATCH 14/15] vfio/iommu_type1: remove the "external" domain Christoph Hellwig
2021-09-24 15:57 ` [PATCH 15/15] vfio/iommu_type1: remove IS_IOMMU_CAP_DOMAIN_IN_CONTAINER Christoph Hellwig
2021-09-30 20:16 ` cleanup vfio iommu_group creation v6 Alex Williamson
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=20210924155705.4258-10-hch@lst.de \
--to=hch@lst.de \
--cc=alex.williamson@redhat.com \
--cc=cohuck@redhat.com \
--cc=diana.craciun@oss.nxp.com \
--cc=eric.auger@redhat.com \
--cc=jgg@nvidia.com \
--cc=jgg@ziepe.ca \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=kwankhede@nvidia.com \
--cc=terrence.xu@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox