[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <433bbdf4-b69c-7ae8-a734-923ffac646eb@redhat.com>
Date: Mon, 16 Nov 2020 12:19:55 +0800
From: Jason Wang <jasowang@...hat.com>
To: Stefano Garzarella <sgarzare@...hat.com>,
virtualization@...ts.linux-foundation.org
Cc: Stefan Hajnoczi <stefanha@...hat.com>,
Laurent Vivier <lvivier@...hat.com>,
linux-kernel@...r.kernel.org, Eli Cohen <elic@...dia.com>,
"Michael S. Tsirkin" <mst@...hat.com>,
Max Gurtovoy <mgurtovoy@...dia.com>
Subject: Re: [PATCH RFC 09/12] vdpa_sim: make vdpasim->buffer size
configurable
On 2020/11/13 下午9:47, Stefano Garzarella wrote:
> Allow each device to specify the size of the buffer allocated
> in vdpa_sim.
>
> Signed-off-by: Stefano Garzarella <sgarzare@...hat.com>
Acked-by: Jason Wang <jasowang@...hat.com>
> ---
> drivers/vdpa/vdpa_sim/vdpa_sim.h | 1 +
> drivers/vdpa/vdpa_sim/vdpa_sim.c | 2 +-
> drivers/vdpa/vdpa_sim/vdpa_sim_blk.c | 1 +
> drivers/vdpa/vdpa_sim/vdpa_sim_net.c | 1 +
> 4 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.h b/drivers/vdpa/vdpa_sim/vdpa_sim.h
> index f7e1fe0a88d3..cc21e07aa2f7 100644
> --- a/drivers/vdpa/vdpa_sim/vdpa_sim.h
> +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.h
> @@ -49,6 +49,7 @@ struct vdpasim_device {
>
> struct vdpasim_init_attr {
> struct vdpasim_device device;
> + size_t buffer_size;
> int batch_mapping;
>
> work_func_t work_fn;
> diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
> index bd034fbf4683..3863d49e0d6d 100644
> --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
> +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
> @@ -223,7 +223,7 @@ struct vdpasim *vdpasim_create(struct vdpasim_init_attr *attr)
> if (!vdpasim->iommu)
> goto err_iommu;
>
> - vdpasim->buffer = kvmalloc(PAGE_SIZE, GFP_KERNEL);
> + vdpasim->buffer = kvmalloc(attr->buffer_size, GFP_KERNEL);
> if (!vdpasim->buffer)
> goto err_iommu;
>
> diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c b/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c
> index f456a0e4e097..122a3c039507 100644
> --- a/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c
> +++ b/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c
> @@ -100,6 +100,7 @@ static int __init vdpasim_blk_init(void)
> attr.device.update_config = vdpasim_blk_update_config;
>
> attr.work_fn = vdpasim_blk_work;
> + attr.buffer_size = PAGE_SIZE;
>
> vdpasim_blk_dev = vdpasim_create(&attr);
> if (IS_ERR(vdpasim_blk_dev)) {
> diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim_net.c b/drivers/vdpa/vdpa_sim/vdpa_sim_net.c
> index b9372fdf2415..d0a1403f64b2 100644
> --- a/drivers/vdpa/vdpa_sim/vdpa_sim_net.c
> +++ b/drivers/vdpa/vdpa_sim/vdpa_sim_net.c
> @@ -124,6 +124,7 @@ static int __init vdpasim_net_init(void)
>
> attr.work_fn = vdpasim_net_work;
> attr.batch_mapping = batch_mapping;
> + attr.buffer_size = PAGE_SIZE;
>
> vdpasim_net_dev = vdpasim_create(&attr);
> if (IS_ERR(vdpasim_net_dev)) {
Powered by blists - more mailing lists