summaryrefslogtreecommitdiff
path: root/drivers/vfio/vfio.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-09-24 18:57:01 +0300
committerAlex Williamson <alex.williamson@redhat.com>2021-09-30 21:46:44 +0300
commitc3c0fa9d94f7078b6664d29d79484d071a144f2e (patch)
tree30e9089670973348a96dc8968eef50d73e51fa69 /drivers/vfio/vfio.h
parentfda49d97f2c4faf0b42e8796d3e6c868d992f3af (diff)
downloadlinux-c3c0fa9d94f7078b6664d29d79484d071a144f2e.tar.xz
vfio: clean up the check for mediated device in vfio_iommu_type1
Pass the group flags to ->attach_group and remove the messy check for the bus type. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Link: https://lore.kernel.org/r/20210924155705.4258-12-hch@lst.de Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio/vfio.h')
-rw-r--r--drivers/vfio/vfio.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h
index a78de649eb2f..a67130221151 100644
--- a/drivers/vfio/vfio.h
+++ b/drivers/vfio/vfio.h
@@ -4,6 +4,30 @@
* Author: Alex Williamson <alex.williamson@redhat.com>
*/
+enum vfio_group_type {
+ /*
+ * Physical device with IOMMU backing.
+ */
+ VFIO_IOMMU,
+
+ /*
+ * Virtual device without IOMMU backing. The VFIO core fakes up an
+ * iommu_group as the iommu_group sysfs interface is part of the
+ * userspace ABI. The user of these devices must not be able to
+ * directly trigger unmediated DMA.
+ */
+ VFIO_EMULATED_IOMMU,
+
+ /*
+ * Physical device without IOMMU backing. The VFIO core fakes up an
+ * iommu_group as the iommu_group sysfs interface is part of the
+ * userspace ABI. Users can trigger unmediated DMA by the device,
+ * usage is highly dangerous, requires an explicit opt-in and will
+ * taint the kernel.
+ */
+ VFIO_NO_IOMMU,
+};
+
/* events for the backend driver notify callback */
enum vfio_iommu_notify_type {
VFIO_IOMMU_CONTAINER_CLOSE = 0,
@@ -20,7 +44,8 @@ struct vfio_iommu_driver_ops {
long (*ioctl)(void *iommu_data, unsigned int cmd,
unsigned long arg);
int (*attach_group)(void *iommu_data,
- struct iommu_group *group);
+ struct iommu_group *group,
+ enum vfio_group_type);
void (*detach_group)(void *iommu_data,
struct iommu_group *group);
int (*pin_pages)(void *iommu_data,