[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACGkMEv9s2WP+Ou5wk2GCBXfD+Pc8CDY2Kz41w7sO8bnkVTc7w@mail.gmail.com>
Date: Thu, 14 Jul 2022 10:51:31 +0800
From: Jason Wang <jasowang@...hat.com>
To: Xie Yongji <xieyongji@...edance.com>
Cc: mst <mst@...hat.com>, Liu Xiaodong <xiaodong.liu@...el.com>,
Maxime Coquelin <maxime.coquelin@...hat.com>,
Stefan Hajnoczi <stefanha@...hat.com>,
songmuchun@...edance.com,
virtualization <virtualization@...ts.linux-foundation.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 4/5] vduse: Support querying IOLTB information
On Wed, Jul 6, 2022 at 1:06 PM Xie Yongji <xieyongji@...edance.com> wrote:
>
> This introduces a new ioctl: VDUSE_IOTLB_GET_INFO to
> support querying IOLTB information such as bounce
> buffer size.
>
> Signed-off-by: Xie Yongji <xieyongji@...edance.com>
> ---
> drivers/vdpa/vdpa_user/vduse_dev.c | 13 +++++++++++++
> include/uapi/linux/vduse.h | 17 +++++++++++++++++
> 2 files changed, 30 insertions(+)
>
> diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
> index 3bc27de58f46..c47a5d9765cf 100644
> --- a/drivers/vdpa/vdpa_user/vduse_dev.c
> +++ b/drivers/vdpa/vdpa_user/vduse_dev.c
> @@ -1089,6 +1089,19 @@ static long vduse_dev_ioctl(struct file *file, unsigned int cmd,
> ret = vduse_dev_queue_irq_work(dev, &dev->vqs[index].inject);
> break;
> }
> + case VDUSE_IOTLB_GET_INFO: {
As discussed, it's better not to expose the VDUSE internal structure
like "IOTLB" in the name.
We probably need to extend GET_FD or have a new ioctl like GET_FD_INFO.
Thanks
> + struct vduse_iotlb_info iotlb;
> +
> + iotlb.bounce_iova = 0;
> + iotlb.bounce_size = dev->domain->bounce_size;
> +
> + ret = -EFAULT;
> + if (copy_to_user(argp, &iotlb, sizeof(iotlb)))
> + break;
> +
> + ret = 0;
> + break;
> + }
> default:
> ret = -ENOIOCTLCMD;
> break;
> diff --git a/include/uapi/linux/vduse.h b/include/uapi/linux/vduse.h
> index 7cfe1c1280c0..c201b7a77c2c 100644
> --- a/include/uapi/linux/vduse.h
> +++ b/include/uapi/linux/vduse.h
> @@ -210,6 +210,23 @@ struct vduse_vq_eventfd {
> */
> #define VDUSE_VQ_INJECT_IRQ _IOW(VDUSE_BASE, 0x17, __u32)
>
> +/**
> + * struct vduse_iotlb_info - IOTLB information
> + * @bounce_iova: start IOVA of bounce buffer
> + * @bounce_size: bounce buffer size
> + * @reserved: for future use, needs to be initialized to zero
> + *
> + * Structure used by VDUSE_IOTLB_GET_INFO ioctl to get IOTLB information.
> + */
> +struct vduse_iotlb_info {
> + __u64 bounce_iova;
> + __u64 bounce_size;
> + __u64 reserved[2];
> +};
> +
> +/* Get IOTLB information, e.g. bounce buffer size */
> +#define VDUSE_IOTLB_GET_INFO _IOR(VDUSE_BASE, 0x18, struct vduse_iotlb_info)
> +
> /* The control messages definition for read(2)/write(2) on /dev/vduse/$NAME */
>
> /**
> --
> 2.20.1
>
Powered by blists - more mailing lists