In order to simplify the code of the vdpa_sim core, we move the
config management in each device simulator.
The device must provide the size of config structure and a callback
to update this structure called during the vdpasim_set_features().
Signed-off-by: Stefano Garzarella <sgarzare@xxxxxxxxxx>
---
drivers/vdpa/vdpa_sim/vdpa_sim.h | 5 +++--
drivers/vdpa/vdpa_sim/vdpa_sim.c | 29 +++++-----------------------
drivers/vdpa/vdpa_sim/vdpa_sim_blk.c | 27 ++++++++++++++++----------
drivers/vdpa/vdpa_sim/vdpa_sim_net.c | 12 ++++++++++++
4 files changed, 37 insertions(+), 36 deletions(-)
diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.h b/drivers/vdpa/vdpa_sim/vdpa_sim.h
index 76e642042eb0..f7e1fe0a88d3 100644
--- a/drivers/vdpa/vdpa_sim/vdpa_sim.h
+++ b/drivers/vdpa/vdpa_sim/vdpa_sim.h
@@ -10,8 +10,6 @@
#include <linux/vdpa.h>
#include <linux/vhost_iotlb.h>
#include <uapi/linux/virtio_config.h>
-#include <uapi/linux/virtio_net.h>
-#include <uapi/linux/virtio_blk.h>
#define DRV_VERSION "0.1"
#define DRV_AUTHOR "Jason Wang <jasowang@xxxxxxxxxx>"
@@ -42,8 +40,11 @@ struct vdpasim_virtqueue {
struct vdpasim_device {
u64 supported_features;
+ size_t config_size;
u32 id;
int nvqs;
+
+ void (*update_config)(struct vdpasim *vdpasim);