Commit da7af696 authored by Stefano Garzarella's avatar Stefano Garzarella Committed by Michael S. Tsirkin

vdpa_sim: make vdpasim->buffer size configurable

Allow each device to specify the size of the buffer allocated
in vdpa_sim.
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Signed-off-by: default avatarStefano Garzarella <sgarzare@redhat.com>
Link: https://lore.kernel.org/r/20201215144256.155342-17-sgarzare@redhat.comSigned-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent 165be1f8
......@@ -73,6 +73,7 @@ struct vdpasim;
struct vdpasim_dev_attr {
u64 supported_features;
size_t config_size;
size_t buffer_size;
int nvqs;
u32 id;
......@@ -418,7 +419,7 @@ static struct vdpasim *vdpasim_create(struct vdpasim_dev_attr *dev_attr)
if (!vdpasim->iommu)
goto err_iommu;
vdpasim->buffer = kvmalloc(PAGE_SIZE, GFP_KERNEL);
vdpasim->buffer = kvmalloc(dev_attr->buffer_size, GFP_KERNEL);
if (!vdpasim->buffer)
goto err_iommu;
......@@ -787,6 +788,7 @@ static int __init vdpasim_dev_init(void)
dev_attr.config_size = sizeof(struct virtio_net_config);
dev_attr.get_config = vdpasim_net_get_config;
dev_attr.work_fn = vdpasim_net_work;
dev_attr.buffer_size = PAGE_SIZE;
vdpasim_dev = vdpasim_create(&dev_attr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment