Skip to content

RFC vdpa: get/set_config() rework

Stefano Garzarella kvm lkml virtualization 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest10 patches 10 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10vdpa: add get_config_size callback in vdpa_config_opsdrivers/vdpa/ifcvf/ifcvf_main.c drivers/vdpa/mlx5/net/mlx5_vnet.c drivers/vdpa/vdpa_sim/vdpa_sim.c +1 more+25 -04 replies
2/10vdpa: check vdpa_get_config() parameters and return bytes readdrivers/vdpa/vdpa.c include/linux/vdpa.h+37 -140 replies
3/10vdpa: add vdpa_set_config() helperdrivers/vdpa/vdpa.c include/linux/vdpa.h+18 -00 replies
4/10vdpa: remove param checks in the get/set_config callbacksdrivers/vdpa/mlx5/net/mlx5_vnet.c drivers/vdpa/vdpa_sim/vdpa_sim.c+1 -80 replies
5/10vdpa: remove WARN_ON() in the get/set_config callbacksdrivers/vdpa/ifcvf/ifcvf_base.c drivers/vdpa/ifcvf/ifcvf_main.c+1 -40 replies
6/10virtio_vdpa: use vdpa_set_config()drivers/virtio/virtio_vdpa.c+1 -20 replies
7/10vhost/vdpa: use vdpa_set_config()drivers/vhost/vdpa.c+1 -20 replies
8/10vhost/vdpa: allow user space to pass buffers bigger than config spacedrivers/vhost/vdpa.c+20 -160 replies
9/10vhost/vdpa: use get_config_size callback in vhost_vdpa_config_validate()drivers/vhost/vdpa.c+2 -70 replies
10/10vhost/vdpa: return configuration bytes read and written to user spacedrivers/vhost/vdpa.c+15 -115 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 00/10] vdpa: get/set_config() rework

Following the discussion with Michael and Jason [1], I reworked a bit get/set_config() in vdpa.

I changed vdpa_get_config() to check the boundaries and added vdpa_set_config(). When 'offset' or 'len' parameters exceed boundaries, we limit the reading to the available configuration space in the device, and we return the amount of bytes read/written.

In this way the user space can pass buffers bigger than config space. I also returned the amount of bytes read and written to user space.

Patches also available here:
https://github.com/stefano-garzarella/linux/tree/vdpa-get-set-config-refactoring

Thanks for your comments,
Stefano

[1] https://lkml.org/lkml/2021/2/10/350

Stefano Garzarella (10):
vdpa: add get_config_size callback in vdpa_config_ops
vdpa: check vdpa_get_config() parameters and return bytes read
vdpa: add vdpa_set_config() helper
vdpa: remove param checks in the get/set_config callbacks
vdpa: remove WARN_ON() in the get/set_config callbacks
virtio_vdpa: use vdpa_set_config()
vhost/vdpa: use vdpa_set_config()
vhost/vdpa: allow user space to pass buffers bigger than config space vhost/vdpa: use get_config_size callback in
vhost_vdpa_config_validate()
vhost/vdpa: return configuration bytes read and written to user space

 include/linux/vdpa.h              | 22 ++++-------
 drivers/vdpa/ifcvf/ifcvf_base.c   |  3 +-
 drivers/vdpa/ifcvf/ifcvf_main.c   |  8 +++-
 drivers/vdpa/mlx5/net/mlx5_vnet.c |  9 ++++-
 drivers/vdpa/vdpa.c               | 51 ++++++++++++++++++++++++
 drivers/vdpa/vdpa_sim/vdpa_sim.c  | 15 +++++---
 drivers/vhost/vdpa.c              | 64 ++++++++++++++++---------------
 drivers/virtio/virtio_vdpa.c      |  3 +-
 8 files changed, 116 insertions(+), 59 deletions(-)
Signature · 6 lines
2.29.2

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization