> From: Liu, Yi L <[email protected]>
> Sent: Monday, February 13, 2023 11:14 PM
> 
> This adds three vfio device ioctls for userspace using iommufd to set up
> secure DMA context for device access.
> 
>     VFIO_DEVICE_BIND_IOMMUFD: bind device to an iommufd, hence gain
> DMA
>                             control provided by the iommufd. open_device
>                             op is called after bind_iommufd op.
>                             VFIO no iommu mode is indicated by passing
>                             a negative iommufd value.
>     VFIO_DEVICE_ATTACH_IOMMUFD_PT: attach device to IOAS,
> hw_pagetable
>                                  managed by iommufd. Attach can be
>                                  undo by
> VFIO_DEVICE_DETACH_IOMMUFD_PT
>                                  or device fd close.
>     VFIO_DEVICE_DETACH_IOMMUFD_PT: detach device from the current
> attached
>                                  IOAS or hw_pagetable managed by
> iommufd.

let's split into two patches: bind and attach/detach.

> 
> +int vfio_device_claim_group(struct vfio_device *device)
> +void vfio_device_release_group(struct vfio_device *device)

vfio_device_block_group()
vfio_device_unblock_group()

> 
> +     /*
> +      * For group/container path, iommufd pointer is NULL when comes
> +      * into this helper. Its noiommu support is in container.c.

"Its noiommu support is handled by vfio_device_group_use_iommu()"

> +      *
> +      * For iommufd compat mode, iommufd pointer here is a valid value.
> +      * Its noiommu support is in vfio_iommufd_bind().
> +      *
> +      * For device cdev path, iommufd pointer here is a valid value for
> +      * normal cases, but it is NULL if it's noiommu. To differentiate
> +      * the noiommu from the group/container path which also passes
> NULL
> +      * iommufd pointer in, check df->noiommu which is set only in the
> +      * cdev path.

"Check df->noiommu to differentiate cdev noiommu from the group/
container path which also passes NULL iommufd pointer in. If set
then do nothing."

Reply via email to