@@ -1545,6 +1545,26 @@ vu_set_config(VuDev *dev, VhostUserMsg *vmsg)
return false;
}
+bool vu_notify_config_change(VuDev *dev)
+{
+ bool ret;
+ VhostUserMsg vmsg = {
+ .request = VHOST_USER_SLAVE_CONFIG_CHANGE_MSG,
+ .flags = VHOST_USER_VERSION,
+ .size = 0,
+ };
+
+ if (!vu_has_protocol_feature(dev, VHOST_USER_PROTOCOL_F_CONFIG)) {
+ return false;
+ }
+
+ pthread_mutex_lock(&dev->slave_mutex);
+ ret = !vu_message_write(dev, dev->slave_fd, &vmsg);
+ pthread_mutex_unlock(&dev->slave_mutex);
+
+ return ret;
+}
+
static bool
vu_set_postcopy_advise(VuDev *dev, VhostUserMsg *vmsg)
{
@@ -491,6 +491,14 @@ bool vu_dispatch(VuDev *dev);
*/
void *vu_gpa_to_va(VuDev *dev, uint64_t *plen, uint64_t guest_addr);
+/**
+ * vu_notify_config_change:
+ * @dev: a VuDev context
+ *
+ * Notify that the configuration space has changed. Returns FALSE on failure.
+ */
+bool vu_notify_config_change(VuDev *dev);
+
/**
* vu_get_queue:
* @dev: a VuDev context
This adds a new API vu_notify_config_change() to support sending VHOST_USER_SLAVE_CONFIG_CHANGE_MSG message to notify that the configuration space has changed. Signed-off-by: Xie Yongji <xieyongji@bytedance.com> --- subprojects/libvhost-user/libvhost-user.c | 20 ++++++++++++++++++++ subprojects/libvhost-user/libvhost-user.h | 8 ++++++++ 2 files changed, 28 insertions(+)