aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio/vhost-user-base.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/virtio/vhost-user-base.c')
-rw-r--r--hw/virtio/vhost-user-base.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/hw/virtio/vhost-user-base.c b/hw/virtio/vhost-user-base.c
index 78cfa9a5bb..a83167191e 100644
--- a/hw/virtio/vhost-user-base.c
+++ b/hw/virtio/vhost-user-base.c
@@ -140,6 +140,22 @@ static void vub_get_config(VirtIODevice *vdev, uint8_t *config)
}
}
+static void vub_set_config(VirtIODevice *vdev, const uint8_t *config_data)
+{
+ VHostUserBase *vub = VHOST_USER_BASE(vdev);
+ int ret;
+
+ g_assert(vub->config_size && vub->vhost_user.supports_config == true);
+
+ ret = vhost_dev_set_config(&vub->vhost_dev, config_data,
+ 0, vub->config_size,
+ VHOST_SET_CONFIG_TYPE_FRONTEND);
+ if (ret) {
+ error_report("vhost guest set device config space failed: %d", ret);
+ return;
+ }
+}
+
/*
* When the daemon signals an update to the config we just need to
* signal the guest as we re-read the config on demand above.
@@ -337,6 +353,7 @@ static void vub_class_init(ObjectClass *klass, void *data)
vdc->unrealize = vub_device_unrealize;
vdc->get_features = vub_get_features;
vdc->get_config = vub_get_config;
+ vdc->set_config = vub_set_config;
vdc->set_status = vub_set_status;
}