[Intel-gfx] [PATCH v6 21/24] vfio: Add VFIO_DEVICE_BIND_IOMMUFD

Tian, Kevin kevin.tian at intel.com
Fri Mar 10 09:01:55 UTC 2023


> From: Liu, Yi L <yi.l.liu at intel.com>
> Sent: Wednesday, March 8, 2023 9:29 PM
> +
> +static int vfio_device_cdev_probe_noiommu(struct vfio_device *device)
> +{
> +	struct iommu_group *iommu_group;
> +	int ret = 0;
> +
> +	if (!IS_ENABLED(CONFIG_VFIO_NOIOMMU) || !vfio_noiommu)
> +		return -EINVAL;
> +
> +	if (!capable(CAP_SYS_RAWIO))
> +		return -EPERM;
> +
> +	iommu_group = iommu_group_get(device->dev);
> +	if (!iommu_group)
> +		return 0;
> +
> +	/*
> +	 * We cannot support noiommu mode for devices that are protected
> +	 * by IOMMU.  So check the iommu_group, if it is a no-iommu group
> +	 * created by VFIO, we support. If not, we refuse.
> +	 */
> +	if (!vfio_group_find_noiommu_group_from_iommu(iommu_group))
> +		ret = -EINVAL;
> +	iommu_group_put(iommu_group);
> +	return ret;

can check whether group->name == "vfio-noiommu"?


More information about the Intel-gfx mailing list