RE: [RFC v2 05/11] vfio: Make vfio_device_open() group agnostic

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

 



> From: Liu, Yi L <yi.l.liu@xxxxxxxxx>
> Sent: Thursday, November 24, 2022 8:27 PM
> 
> This prepares for moving group specific code to separate file.
> 
> Signed-off-by: Yi Liu <yi.l.liu@xxxxxxxxx>
> ---
>  drivers/vfio/vfio_main.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
> index edcfa8a61096..fcb9f778fc9b 100644
> --- a/drivers/vfio/vfio_main.c
> +++ b/drivers/vfio/vfio_main.c
> @@ -878,9 +878,6 @@ static struct file *vfio_device_open(struct vfio_device
> *device)
>  	 */
>  	filep->f_mode |= (FMODE_PREAD | FMODE_PWRITE);
> 
> -	if (device->group->type == VFIO_NO_IOMMU)
> -		dev_warn(device->dev, "vfio-noiommu device opened by
> user "
> -			 "(%s:%d)\n", current->comm, task_pid_nr(current));
>  	/*
>  	 * On success the ref of device is moved to the file and
>  	 * put in vfio_device_fops_release()
> @@ -927,6 +924,10 @@ static int vfio_group_ioctl_get_device_fd(struct
> vfio_group *group,
>  		goto err_put_fdno;
>  	}
> 
> +	if (group->type == VFIO_NO_IOMMU)
> +		dev_warn(device->dev, "vfio-noiommu device opened by
> user "
> +			 "(%s:%d)\n", current->comm, task_pid_nr(current));
> +
>  	fd_install(fdno, filep);
>  	return fdno;
> 

Do we want to support no-iommu mode in future cdev path?

If yes keeping the check in vfio_device_open() makes more sense. Just
replace direct device->group reference with a helper e.g.:

	vfio_device_group_noiommu()




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux