Currently, do_vhost_virtqueue_stop() calls vhost_user_has_protocol_feature(), causing a link failure with --disable-vhost-user when other vhost backends are enabled.
Move the assertion to vhost_user_get_vring_base_skip_drain(), keeping the protocol feature check in the vhost-user backend and removing the dependency from the common vhost code. Reported-by: Clément Chigot <[email protected]> Fixes: 5eb2347867 ("vhost-user: add skip_drain param to do_vhost_virtqueue_stop") Signed-off-by: Alexandr Moshkov <[email protected]> --- v1 -> v2: - Move the protocol feature assertion from do_vhost_virtqueue_stop() to vhost_user_get_vring_base_skip_drain(). - Drop the stub added in v1 and remove the unused vhost-user.h include. hw/virtio/vhost-user.c | 4 +--- hw/virtio/vhost.c | 5 ----- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 65889b0776..84918c7265 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1463,9 +1463,7 @@ static int vhost_user_get_vring_base_skip_drain(struct vhost_dev *dev, bool skip_drain_supported = vhost_user_has_protocol_feature(dev, VHOST_USER_PROTOCOL_F_GET_VRING_BASE_SKIP_DRAIN); - if (!skip_drain_supported) { - return 0; - } + assert(skip_drain_supported); return get_vring_base(dev, ring, true); } diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 68a8e40481..db8f246137 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -23,7 +23,6 @@ #include "qemu/log.h" #include "standard-headers/linux/vhost_types.h" #include "hw/virtio/virtio-bus.h" -#include "hw/virtio/vhost-user.h" #include "hw/mem/memory-device.h" #include "migration/blocker.h" #include "migration/qemu-file-types.h" @@ -1503,10 +1502,6 @@ static int do_vhost_virtqueue_stop(struct vhost_dev *dev, unsigned idx, bool force, bool skip_drain) { - if (skip_drain) { - assert(vhost_user_has_protocol_feature(dev, - VHOST_USER_PROTOCOL_F_GET_VRING_BASE_SKIP_DRAIN)); - } int vhost_vq_index = dev->vhost_ops->vhost_get_vq_index(dev, idx); struct vhost_vring_state state = { .index = vhost_vq_index, -- 2.34.1
