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>
This commit is contained in:
committed by
Alex Williamson
parent
16fbf79b0f
commit
c0560f51cf
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user