Send the shm for the dirty pages logging if the backend support VHOST_USER_PROTOCOL_F_LOG_SHMFD.
Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> --- hw/virtio/vhost-user.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 4993b63..fe75618 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -26,7 +26,9 @@ #define VHOST_MEMORY_MAX_NREGIONS 8 #define VHOST_USER_F_PROTOCOL_FEATURES 30 -#define VHOST_USER_PROTOCOL_FEATURE_MASK 0x0ULL + +#define VHOST_USER_PROTOCOL_FEATURE_MASK 0x1ULL +#define VHOST_USER_PROTOCOL_F_LOG_SHMFD 0 typedef enum VhostUserRequest { VHOST_USER_NONE = 0, @@ -213,8 +215,15 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request, need_reply = 1; break; - case VHOST_USER_SET_FEATURES: case VHOST_USER_SET_LOG_BASE: + if (__virtio_has_feature(dev->protocol_features, + VHOST_USER_PROTOCOL_F_LOG_SHMFD) && + dev->log->fd != -1) { + fds[fd_num++] = dev->log->fd; + } + /* fall through */ + + case VHOST_USER_SET_FEATURES: msg.u64 = *((__u64 *) arg); msg.size = sizeof(m.u64); break; -- 2.4.3