Allow each device to specify the size of the buffer allocated in vdpa_sim. Signed-off-by: Stefano Garzarella <sgarzare@xxxxxxxxxx> --- 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)) { -- 2.26.2 _______________________________________________ Virtualization mailing list Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/virtualization