All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 00/10] vdpa: get/set_config() rework
@ 2021-02-16  9:44 ` Stefano Garzarella
  0 siblings, 0 replies; 42+ messages in thread
From: Stefano Garzarella @ 2021-02-16  9:44 UTC (permalink / raw)
  To: virtualization; +Cc: kvm, linux-kernel, Michael S. Tsirkin, Jason Wang

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(-)

-- 
2.29.2


^ permalink raw reply	[flat|nested] 42+ messages in thread

end of thread, other threads:[~2021-03-08  4:00 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-16  9:44 [RFC PATCH 00/10] vdpa: get/set_config() rework Stefano Garzarella
2021-02-16  9:44 ` Stefano Garzarella
2021-02-16  9:44 ` [RFC PATCH 01/10] vdpa: add get_config_size callback in vdpa_config_ops Stefano Garzarella
2021-02-16  9:44   ` Stefano Garzarella
2021-03-02  4:14   ` Jason Wang
2021-03-02  4:14     ` Jason Wang
2021-03-02 14:15     ` Stefano Garzarella
2021-03-02 14:15       ` Stefano Garzarella
2021-03-04  8:34       ` Jason Wang
2021-03-04  8:34         ` Jason Wang
2021-03-05  8:38         ` Stefano Garzarella
2021-03-05  8:38           ` Stefano Garzarella
2021-02-16  9:44 ` [RFC PATCH 02/10] vdpa: check vdpa_get_config() parameters and return bytes read Stefano Garzarella
2021-02-16  9:44   ` Stefano Garzarella
2021-02-16  9:44 ` [RFC PATCH 03/10] vdpa: add vdpa_set_config() helper Stefano Garzarella
2021-02-16  9:44   ` Stefano Garzarella
2021-02-16  9:44 ` [RFC PATCH 04/10] vdpa: remove param checks in the get/set_config callbacks Stefano Garzarella
2021-02-16  9:44   ` Stefano Garzarella
2021-02-16  9:44 ` [RFC PATCH 05/10] vdpa: remove WARN_ON() " Stefano Garzarella
2021-02-16  9:44   ` Stefano Garzarella
2021-02-16  9:44 ` [RFC PATCH 06/10] virtio_vdpa: use vdpa_set_config() Stefano Garzarella
2021-02-16  9:44   ` Stefano Garzarella
2021-02-16  9:44 ` [RFC PATCH 07/10] vhost/vdpa: " Stefano Garzarella
2021-02-16  9:44   ` Stefano Garzarella
2021-02-16  9:44 ` [RFC PATCH 08/10] vhost/vdpa: allow user space to pass buffers bigger than config space Stefano Garzarella
2021-02-16  9:44   ` Stefano Garzarella
2021-02-16  9:44 ` [RFC PATCH 09/10] vhost/vdpa: use get_config_size callback in vhost_vdpa_config_validate() Stefano Garzarella
2021-02-16  9:44   ` Stefano Garzarella
2021-02-16  9:44 ` [RFC PATCH 10/10] vhost/vdpa: return configuration bytes read and written to user space Stefano Garzarella
2021-02-16  9:44   ` Stefano Garzarella
2021-03-02  4:05   ` Jason Wang
2021-03-02  4:05     ` Jason Wang
2021-03-02 14:06     ` Stefano Garzarella
2021-03-02 14:06       ` Stefano Garzarella
2021-03-04  8:31       ` Jason Wang
2021-03-04  8:31         ` Jason Wang
2021-03-05  8:37         ` Stefano Garzarella
2021-03-05  8:37           ` Stefano Garzarella
2021-03-08  3:59           ` Jason Wang
2021-03-08  3:59             ` Jason Wang
2021-03-01  8:17 ` [RFC PATCH 00/10] vdpa: get/set_config() rework Stefano Garzarella
2021-03-01  8:17   ` Stefano Garzarella

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.