summaryrefslogtreecommitdiff
path: root/include/linux/vfio.h
diff options
context:
space:
mode:
authorKirti Wankhede <kwankhede@nvidia.com>2016-11-17 07:58:26 +0300
committerAlex Williamson <alex.williamson@redhat.com>2016-11-17 18:33:07 +0300
commitc086de818dd81c3c2f7cecff23de6585b74340c0 (patch)
tree5bef30bb704ea2a9d83dfd70fce00e878dc638a1 /include/linux/vfio.h
parenta54eb55045ae9b3032c71f1134e30d02de527038 (diff)
downloadlinux-c086de818dd81c3c2f7cecff23de6585b74340c0.tar.xz
vfio iommu: Add blocking notifier to notify DMA_UNMAP
Added blocking notifier to IOMMU TYPE1 driver to notify vendor drivers about DMA_UNMAP. Exported two APIs vfio_register_notifier() and vfio_unregister_notifier(). Notifier should be registered, if external user wants to use vfio_pin_pages()/vfio_unpin_pages() APIs to pin/unpin pages. Vendor driver should use VFIO_IOMMU_NOTIFY_DMA_UNMAP action to invalidate mappings. Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com> Signed-off-by: Neo Jia <cjia@nvidia.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'include/linux/vfio.h')
-rw-r--r--include/linux/vfio.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 3c862a030029..6ab13f7e2920 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -80,6 +80,10 @@ struct vfio_iommu_driver_ops {
unsigned long *phys_pfn);
int (*unpin_pages)(void *iommu_data,
unsigned long *user_pfn, int npage);
+ int (*register_notifier)(void *iommu_data,
+ struct notifier_block *nb);
+ int (*unregister_notifier)(void *iommu_data,
+ struct notifier_block *nb);
};
extern int vfio_register_iommu_driver(const struct vfio_iommu_driver_ops *ops);
@@ -103,6 +107,14 @@ extern int vfio_pin_pages(struct device *dev, unsigned long *user_pfn,
extern int vfio_unpin_pages(struct device *dev, unsigned long *user_pfn,
int npage);
+#define VFIO_IOMMU_NOTIFY_DMA_UNMAP (1)
+
+extern int vfio_register_notifier(struct device *dev,
+ struct notifier_block *nb);
+
+extern int vfio_unregister_notifier(struct device *dev,
+ struct notifier_block *nb);
+
/*
* Sub-module helpers
*/