aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/vfio.h
diff options
context:
space:
mode:
authorYan Zhao <yan.y.zhao@intel.com>2020-03-24 09:27:56 -0600
committerAlex Williamson <alex.williamson@redhat.com>2020-03-24 09:27:56 -0600
commitc0560f51cf77472f4ed113539b0a02ca6cda7961 (patch)
treef738f84f02f8dbc0c43d1a4312e8f5f38a228b9a /include/linux/vfio.h
parentLinux 5.6-rc7 (diff)
downloadlinux-dev-c0560f51cf77472f4ed113539b0a02ca6cda7961.tar.xz
linux-dev-c0560f51cf77472f4ed113539b0a02ca6cda7961.zip
vfio: allow external user to get vfio group from device
external user calls vfio_group_get_external_user_from_dev() with a device pointer to get the VFIO group associated with this device. The VFIO group is checked to be vialbe and have IOMMU set. Then container user counter is increased and VFIO group reference is hold to prevent the VFIO group from disposal before external user exits. when the external user finishes using of the VFIO group, it calls vfio_group_put_external_user() to dereference the VFIO group and the container user counter. Suggested-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Yan Zhao <yan.y.zhao@intel.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'include/linux/vfio.h')
-rw-r--r--include/linux/vfio.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index e42a711a2800..fb71e0ac0e76 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -94,6 +94,8 @@ extern void vfio_unregister_iommu_driver(
*/
extern struct vfio_group *vfio_group_get_external_user(struct file *filep);
extern void vfio_group_put_external_user(struct vfio_group *group);
+extern struct vfio_group *vfio_group_get_external_user_from_dev(struct device
+ *dev);
extern bool vfio_external_group_match_file(struct vfio_group *group,
struct file *filep);
extern int vfio_external_user_iommu_id(struct vfio_group *group);