diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2015-10-09 17:17:24 +0200 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2015-10-22 14:34:49 +0300 |
commit | 1be0ac2109fbaca6e730ac578f0564507d173e2d (patch) | |
tree | 32ace8879e93a17585cfd26f62e94d22a32dcd2a /hw | |
parent | c2bea314f6a2870b847c79e2e11263c5f9334db7 (diff) |
vhost-user: add vhost_user_requires_shm_log()
Check if the backend has VHOST_USER_PROTOCOL_F_LOG_SHMFD feature and
require a shared log.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/virtio/vhost-user.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 5d512898cf..e10ce87299 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -25,9 +25,10 @@ #define VHOST_MEMORY_MAX_NREGIONS 8 #define VHOST_USER_F_PROTOCOL_FEATURES 30 -#define VHOST_USER_PROTOCOL_FEATURE_MASK 0x1ULL -#define VHOST_USER_PROTOCOL_F_MQ 0 +#define VHOST_USER_PROTOCOL_FEATURE_MASK 0x3ULL +#define VHOST_USER_PROTOCOL_F_MQ 0 +#define VHOST_USER_PROTOCOL_F_LOG_SHMFD 1 typedef enum VhostUserRequest { VHOST_USER_NONE = 0, @@ -458,6 +459,14 @@ static int vhost_user_memslots_limit(struct vhost_dev *dev) return VHOST_MEMORY_MAX_NREGIONS; } +static bool vhost_user_requires_shm_log(struct vhost_dev *dev) +{ + assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_USER); + + return virtio_has_feature(dev->protocol_features, + VHOST_USER_PROTOCOL_F_LOG_SHMFD); +} + const VhostOps user_ops = { .backend_type = VHOST_BACKEND_TYPE_USER, .vhost_call = vhost_user_call, @@ -467,4 +476,5 @@ const VhostOps user_ops = { .vhost_backend_set_vring_enable = vhost_user_set_vring_enable, .vhost_backend_memslots_limit = vhost_user_memslots_limit, .vhost_set_log_base = vhost_set_log_base, + .vhost_requires_shm_log = vhost_user_requires_shm_log, }; |