[Intel-gfx] [PATCH v1 1/5] iommufd: Create access in vfio_iommufd_emulated_bind()

Tian, Kevin kevin.tian at intel.com
Fri Mar 10 02:08:15 UTC 2023


> From: Liu, Yi L <yi.l.liu at intel.com>
> Sent: Wednesday, March 8, 2023 9:14 PM
>
> @@ -449,33 +450,18 @@ iommufd_access_create(struct iommufd_ctx *ictx,
> u32 ioas_id,
>  	access->data = data;
>  	access->ops = ops;
> 
> -	obj = iommufd_get_object(ictx, ioas_id, IOMMUFD_OBJ_IOAS);
> -	if (IS_ERR(obj)) {
> -		rc = PTR_ERR(obj);
> -		goto out_abort;
> -	}
> -	access->ioas = container_of(obj, struct iommufd_ioas, obj);
> -	iommufd_ref_to_users(obj);
> -
>  	if (ops->needs_pin_pages)
>  		access->iova_alignment = PAGE_SIZE;
>  	else
>  		access->iova_alignment = 1;
> -	rc = iopt_add_access(&access->ioas->iopt, access);
> -	if (rc)
> -		goto out_put_ioas;
> 
>  	/* The calling driver is a user until iommufd_access_destroy() */
>  	refcount_inc(&access->obj.users);
> +	mutex_init(&access->ioas_lock);
>  	access->ictx = ictx;
>  	iommufd_ctx_get(ictx);

this refcnt get should be moved to the start given next patch
removes the reference in the caller side.


More information about the Intel-gfx mailing list