Commit a5f3839ed4 for qemu.org

commit a5f3839ed46170882d60a2207062adf6ea73fe5b
Author: Alexandr Moshkov <dtalexundeer@yandex-team.ru>
Date:   Tue Sep 29 17:22:23 2026 +0500

    vhost: move skip-drain feature check to vhost-user

    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 <chigot@adacore.com>
    Fixes: 5eb2347867ee ("vhost-user: add skip_drain param to do_vhost_virtqueue_stop")
    Signed-off-by: Alexandr Moshkov <dtalexundeer@yandex-team.ru>
    Acked-by: Stefano Garzarella <sgarzare@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Message-ID: <20260929122223.2164612-1-dtalexundeer@yandex-team.ru>

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,