mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
hw/virtio: Support set_config() callback in vhost-user-base
The Virtio input device invokes set_config() callback for retrieving the event configuration info, but the callback is not supported in vhost-user-base. This patch adds support set_config() callback in vhost-user-base. Signed-off-by: Leo Yan <leo.yan@linaro.org> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20231120043721.50555-2-leo.yan@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240104210945.1223134-9-alex.bennee@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
e7fe912276
commit
a26105dd56
1 changed files with 17 additions and 0 deletions
|
@ -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
|
* 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.
|
* 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->unrealize = vub_device_unrealize;
|
||||||
vdc->get_features = vub_get_features;
|
vdc->get_features = vub_get_features;
|
||||||
vdc->get_config = vub_get_config;
|
vdc->get_config = vub_get_config;
|
||||||
|
vdc->set_config = vub_set_config;
|
||||||
vdc->set_status = vub_set_status;
|
vdc->set_status = vub_set_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue