RE: [PATCH v3 14/15] vfio: Add ioctls for device cdev using iommufd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Liu, Yi L <yi.l.liu@xxxxxxxxx>
> 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."





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux