From: Xie Yongji <xieyongji@bytedance.com>
To: Coiby.Xu@gmail.com, stefanha@redhat.com,
marcandre.lureau@redhat.com, kwolf@redhat.com, mreitz@redhat.com
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: [PATCH 1/2] libvhost-user: Add vu_notify_config_change() to support config change notify
Date: Fri, 21 Jan 2022 16:46:43 +0800 [thread overview]
Message-ID: <20220121084644.217-1-xieyongji@bytedance.com> (raw)
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(+)
diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c
index 787f4d2d4f..ff95ccd6f3 100644
--- a/subprojects/libvhost-user/libvhost-user.c
+++ b/subprojects/libvhost-user/libvhost-user.c
@@ -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)
{
diff --git a/subprojects/libvhost-user/libvhost-user.h b/subprojects/libvhost-user/libvhost-user.h
index 3d13dfadde..dd14242a7b 100644
--- a/subprojects/libvhost-user/libvhost-user.h
+++ b/subprojects/libvhost-user/libvhost-user.h
@@ -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
--
2.20.1
next reply other threads:[~2022-01-21 10:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-21 8:46 Xie Yongji [this message]
2022-01-21 8:46 ` [PATCH 2/2] block/export: Add vhost-user-blk resize support Xie Yongji
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220121084644.217-1-xieyongji@bytedance.com \
--to=xieyongji@bytedance.com \
--cc=Coiby.Xu@gmail.com \
--cc=kwolf@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).