0001
0002
0003
0004
0005
0006
0007 enum vfio_group_type {
0008
0009
0010
0011 VFIO_IOMMU,
0012
0013
0014
0015
0016
0017
0018
0019 VFIO_EMULATED_IOMMU,
0020
0021
0022
0023
0024
0025
0026
0027
0028 VFIO_NO_IOMMU,
0029 };
0030
0031
0032 enum vfio_iommu_notify_type {
0033 VFIO_IOMMU_CONTAINER_CLOSE = 0,
0034 };
0035
0036
0037
0038
0039 struct vfio_iommu_driver_ops {
0040 char *name;
0041 struct module *owner;
0042 void *(*open)(unsigned long arg);
0043 void (*release)(void *iommu_data);
0044 long (*ioctl)(void *iommu_data, unsigned int cmd,
0045 unsigned long arg);
0046 int (*attach_group)(void *iommu_data,
0047 struct iommu_group *group,
0048 enum vfio_group_type);
0049 void (*detach_group)(void *iommu_data,
0050 struct iommu_group *group);
0051 int (*pin_pages)(void *iommu_data,
0052 struct iommu_group *group,
0053 dma_addr_t user_iova,
0054 int npage, int prot,
0055 struct page **pages);
0056 void (*unpin_pages)(void *iommu_data,
0057 dma_addr_t user_iova, int npage);
0058 void (*register_device)(void *iommu_data,
0059 struct vfio_device *vdev);
0060 void (*unregister_device)(void *iommu_data,
0061 struct vfio_device *vdev);
0062 int (*dma_rw)(void *iommu_data, dma_addr_t user_iova,
0063 void *data, size_t count, bool write);
0064 struct iommu_domain *(*group_iommu_domain)(void *iommu_data,
0065 struct iommu_group *group);
0066 void (*notify)(void *iommu_data,
0067 enum vfio_iommu_notify_type event);
0068 };
0069
0070 int vfio_register_iommu_driver(const struct vfio_iommu_driver_ops *ops);
0071 void vfio_unregister_iommu_driver(const struct vfio_iommu_driver_ops *ops);