From: Alexandr Moshkov <[email protected]> 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: 5eb2347867ee ("vhost-user: add skip_drain param to do_vhost_virtqueue_stop") Signed-off-by: Alexandr Moshkov <[email protected]> Acked-by: Stefano Garzarella <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Message-ID: <[email protected]> --- 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 3402accc6f..402d9603c0 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 cbf6e82afb..b25919c5c7 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/misc.h" @@ -1554,10 +1553,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, -- MST
