Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2225313/?format=api
{ "id": 2225313, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2225313/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260420200339.708640-5-vsementsov@yandex-team.ru/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.2/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260420200339.708640-5-vsementsov@yandex-team.ru>", "list_archive_url": null, "date": "2026-04-20T20:03:19", "name": "[v6,04/22] vhost: move protocol_features to vhost_user", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "f90a8802289093e85bca0230134e94c72a37273e", "submitter": { "id": 84116, "url": "http://patchwork.ozlabs.org/api/1.2/people/84116/?format=api", "name": "Vladimir Sementsov-Ogievskiy", "email": "vsementsov@yandex-team.ru" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260420200339.708640-5-vsementsov@yandex-team.ru/mbox/", "series": [ { "id": 500672, "url": "http://patchwork.ozlabs.org/api/1.2/series/500672/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=500672", "date": "2026-04-20T20:03:18", "name": "vhost refactoring and fixes", "version": 6, "mbox": "http://patchwork.ozlabs.org/series/500672/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2225313/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2225313/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=yandex-team.ru header.i=@yandex-team.ru\n header.a=rsa-sha256 header.s=default header.b=UqyWIg/C;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)", "mail-nwsmtp-smtp-corp-main-68.klg.yp-c.yandex.net;\n dkim=pass header.i=@yandex-team.ru" ], "Received": [ "from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fzxN34dnZz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Apr 2026 06:06:59 +1000 (AEST)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wEur2-0001lU-6A; Mon, 20 Apr 2026 16:04:24 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <vsementsov@yandex-team.ru>)\n id 1wEuqk-0001LO-23; Mon, 20 Apr 2026 16:04:08 -0400", "from forwardcorp1d.mail.yandex.net\n ([2a02:6b8:c41:1300:1:45:d181:df01])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <vsementsov@yandex-team.ru>)\n id 1wEuqf-0001l2-4a; Mon, 20 Apr 2026 16:04:04 -0400", "from mail-nwsmtp-smtp-corp-main-68.klg.yp-c.yandex.net\n (mail-nwsmtp-smtp-corp-main-68.klg.yp-c.yandex.net\n [IPv6:2a02:6b8:c42:94a9:0:640:a3fa:0])\n by forwardcorp1d.mail.yandex.net (Yandex) with ESMTPS id 85CDC806F6;\n Mon, 20 Apr 2026 23:03:54 +0300 (MSK)", "from vsementsov-lin (unknown [2a02:6bf:8080:54b::1:34])\n by mail-nwsmtp-smtp-corp-main-68.klg.yp-c.yandex.net (smtpcorp) with ESMTPSA\n id f3YMX10K1Sw0-dZfyZF20; Mon, 20 Apr 2026 23:03:53 +0300" ], "Precedence": "bulk", "X-Yandex-Fwd": "1", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru;\n s=default; t=1776715433;\n bh=SMmontHdsj1x/Xo2OKpTpsUMrsx0YlKdiWr/lKmVTuA=;\n h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From;\n b=UqyWIg/CYBvXRnydcejiGXxngk4gVfQumdGGG7aO9EF6bH9vcP7bvq34Ciq8wdt/T\n NaU33HeotY2W7gcctqmYoJx/wpgK1NLY8BAjur/5S+UUG3wpafBivTdm3OtkMRVSDU\n dUIE7i8sKfio8IhODLICkz/kHYBV9kQSfat+I4dg=", "From": "Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>", "To": "mst@redhat.com", "Cc": "sgarzare@redhat.com, raphael@enfabrica.net, qemu-devel@nongnu.org,\n vsementsov@yandex-team.ru, yc-core@yandex-team.ru,\n d-tatianin@yandex-team.ru, \"Gonglei (Arei)\" <arei.gonglei@huawei.com>,\n zhenwei pi <zhenwei.pi@linux.dev>, Raphael Norwitz <rnorwitz@nvidia.com>,\n Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>,\n Jason Wang <jasowang@redhat.com>,\n qemu-block@nongnu.org (open list:Block layer core)", "Subject": "[PATCH v6 04/22] vhost: move protocol_features to vhost_user", "Date": "Mon, 20 Apr 2026 23:03:19 +0300", "Message-ID": "<20260420200339.708640-5-vsementsov@yandex-team.ru>", "X-Mailer": "git-send-email 2.52.0", "In-Reply-To": "<20260420200339.708640-1-vsementsov@yandex-team.ru>", "References": "<20260420200339.708640-1-vsementsov@yandex-team.ru>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=2a02:6b8:c41:1300:1:45:d181:df01;\n envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1d.mail.yandex.net", "X-Spam_score_int": "-20", "X-Spam_score": "-2.1", "X-Spam_bar": "--", "X-Spam_report": "(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no", "X-Spam_action": "no action", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.29", "List-Id": "qemu development <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "As comment says: it's only for vhost-user. So, let's move it\nto corresponding vhost backend realization.\n\nSigned-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>\n---\n backends/cryptodev-vhost.c | 1 -\n hw/block/vhost-user-blk.c | 6 ++----\n hw/net/vhost_net.c | 2 --\n hw/virtio/meson.build | 3 +++\n hw/virtio/vhost-user-stub.c | 6 ++++++\n hw/virtio/vhost-user.c | 36 +++++++++++++++++++++++++++-------\n hw/virtio/virtio-qmp.c | 6 ++++--\n include/hw/virtio/vhost-user.h | 4 ++++\n include/hw/virtio/vhost.h | 8 --------\n 9 files changed, 48 insertions(+), 24 deletions(-)\n create mode 100644 hw/virtio/vhost-user-stub.c", "diff": "diff --git a/backends/cryptodev-vhost.c b/backends/cryptodev-vhost.c\nindex abdfce33afc..c6069f4e5bd 100644\n--- a/backends/cryptodev-vhost.c\n+++ b/backends/cryptodev-vhost.c\n@@ -60,7 +60,6 @@ cryptodev_vhost_init(\n \n crypto->cc = options->cc;\n \n- crypto->dev.protocol_features = 0;\n crypto->backend = -1;\n \n /* vhost-user needs vq_index to initiate a specific queue pair */\ndiff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c\nindex dc99de02635..2831f3c0530 100644\n--- a/hw/block/vhost-user-blk.c\n+++ b/hw/block/vhost-user-blk.c\n@@ -572,10 +572,8 @@ static bool vhost_user_blk_inflight_needed(void *opaque)\n {\n struct VHostUserBlk *s = opaque;\n \n- bool inflight_migration = virtio_has_feature(s->dev.protocol_features,\n- VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT);\n-\n- return inflight_migration;\n+ return vhost_user_has_protocol_feature(\n+ &s->dev, VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT);\n }\n \n static const VMStateDescription vmstate_vhost_user_blk_inflight = {\ndiff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c\nindex fda90e231e6..ca199831260 100644\n--- a/hw/net/vhost_net.c\n+++ b/hw/net/vhost_net.c\n@@ -265,9 +265,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options)\n goto fail;\n }\n net->backend = r;\n- net->dev.protocol_features = 0;\n } else {\n- net->dev.protocol_features = 0;\n net->backend = -1;\n \n /* vhost-user needs vq_index to initiate a specific queue pair */\ndiff --git a/hw/virtio/meson.build b/hw/virtio/meson.build\nindex 415e359e9fc..adc3a4f748a 100644\n--- a/hw/virtio/meson.build\n+++ b/hw/virtio/meson.build\n@@ -43,6 +43,8 @@ if have_vhost\n if_true: files('vhost-user-input-pci.c'))\n system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_SPI'],\n if_true: files('vhost-user-spi-pci.c'))\n+ else\n+ system_virtio_ss.add(files('vhost-user-stub.c'))\n endif\n if have_vhost_vdpa\n system_virtio_ss.add(files('vhost-vdpa.c'))\n@@ -91,6 +93,7 @@ system_virtio_ss.add_all(when: 'CONFIG_VIRTIO_PCI', if_true: virtio_pci_ss)\n \n system_ss.add_all(when: 'CONFIG_VIRTIO', if_true: system_virtio_ss)\n stub_ss.add(files('vhost-stub.c'))\n+stub_ss.add(files('vhost-user-stub.c'))\n stub_ss.add(files('virtio-stub.c'))\n stub_ss.add(files('virtio-md-stubs.c'))\n \ndiff --git a/hw/virtio/vhost-user-stub.c b/hw/virtio/vhost-user-stub.c\nnew file mode 100644\nindex 00000000000..45559788dd4\n--- /dev/null\n+++ b/hw/virtio/vhost-user-stub.c\n@@ -0,0 +1,6 @@\n+#include \"qemu/osdep.h\"\n+#include \"hw/virtio/vhost-user.h\"\n+\n+void vhost_user_qmp_status(struct vhost_dev *dev, VirtioStatus *status)\n+{\n+}\ndiff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c\nindex 72aeed26caa..fc2ed1f17e5 100644\n--- a/hw/virtio/vhost-user.c\n+++ b/hw/virtio/vhost-user.c\n@@ -11,6 +11,7 @@\n #include \"qemu/osdep.h\"\n #include \"qapi/error.h\"\n #include \"hw/virtio/virtio-dmabuf.h\"\n+#include \"hw/virtio/virtio-qmp.h\"\n #include \"hw/virtio/vhost.h\"\n #include \"hw/virtio/virtio-crypto.h\"\n #include \"hw/virtio/vhost-user.h\"\n@@ -259,6 +260,14 @@ struct vhost_user {\n /* Our current regions */\n int num_shadow_regions;\n struct vhost_memory_region shadow_regions[VHOST_USER_MAX_RAM_SLOTS];\n+\n+ /**\n+ * @protocol_features: the vhost-user protocol feature set by\n+ * VHOST_USER_SET_PROTOCOL_FEATURES. Protocol features are only\n+ * negotiated if VHOST_USER_F_PROTOCOL_FEATURES has been offered\n+ * by the backend (see @features).\n+ */\n+ uint64_t protocol_features;\n };\n \n struct scrub_regions {\n@@ -267,10 +276,13 @@ struct scrub_regions {\n int fd_idx;\n };\n \n-static bool vhost_user_has_protocol_feature(struct vhost_dev *dev,\n- uint64_t feature)\n+bool vhost_user_has_protocol_feature(struct vhost_dev *dev, uint64_t feature)\n {\n- return virtio_has_feature(dev->protocol_features, feature);\n+ struct vhost_user *u = dev->opaque;\n+\n+ assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_USER);\n+\n+ return virtio_has_feature(u->protocol_features, feature);\n }\n \n static int vhost_user_read_header(struct vhost_dev *dev, VhostUserMsg *msg)\n@@ -1338,8 +1350,8 @@ static int vhost_set_vring_file(struct vhost_dev *dev,\n int ret;\n int fds[VHOST_USER_MAX_RAM_SLOTS];\n size_t fd_num = 0;\n- bool reply_supported = virtio_has_feature(dev->protocol_features,\n- VHOST_USER_PROTOCOL_F_REPLY_ACK);\n+ bool reply_supported =\n+ vhost_user_has_protocol_feature(dev, VHOST_USER_PROTOCOL_F_REPLY_ACK);\n VhostUserMsg msg = {\n .hdr.request = request,\n .hdr.flags = VHOST_USER_VERSION,\n@@ -2239,8 +2251,8 @@ static int vhost_user_backend_init(struct vhost_dev *dev, void *opaque,\n }\n \n /* final set of protocol features */\n- dev->protocol_features = protocol_features;\n- err = vhost_user_set_protocol_features(dev, dev->protocol_features);\n+ u->protocol_features = protocol_features;\n+ err = vhost_user_set_protocol_features(dev, u->protocol_features);\n if (err < 0) {\n error_setg_errno(errp, EPROTO, \"vhost_backend_init failed\");\n return -EPROTO;\n@@ -3033,6 +3045,16 @@ static int vhost_user_check_device_state(struct vhost_dev *dev, Error **errp)\n return 0;\n }\n \n+void vhost_user_qmp_status(struct vhost_dev *dev, VirtioStatus *status)\n+{\n+ struct vhost_user *u = dev->opaque;\n+\n+ assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_USER);\n+\n+ status->vhost_dev->protocol_features =\n+ qmp_decode_protocols(u->protocol_features);\n+}\n+\n const VhostOps user_ops = {\n .backend_type = VHOST_BACKEND_TYPE_USER,\n .vhost_backend_init = vhost_user_backend_init,\ndiff --git a/hw/virtio/virtio-qmp.c b/hw/virtio/virtio-qmp.c\nindex 71717c56a41..c8bf702d38d 100644\n--- a/hw/virtio/virtio-qmp.c\n+++ b/hw/virtio/virtio-qmp.c\n@@ -751,12 +751,14 @@ VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp)\n status->vhost_dev->acked_features =\n qmp_decode_features(vdev->device_id, hdev->acked_features_ex);\n \n- status->vhost_dev->protocol_features =\n- qmp_decode_protocols(hdev->protocol_features);\n status->vhost_dev->max_queues = hdev->max_queues;\n status->vhost_dev->backend_cap = hdev->backend_cap;\n status->vhost_dev->log_enabled = hdev->log_enabled;\n status->vhost_dev->log_size = hdev->log_size;\n+\n+ if (hdev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_USER) {\n+ vhost_user_qmp_status(hdev, status);\n+ }\n }\n \n return status;\ndiff --git a/include/hw/virtio/vhost-user.h b/include/hw/virtio/vhost-user.h\nindex 53fe9966862..0e576fc5386 100644\n--- a/include/hw/virtio/vhost-user.h\n+++ b/include/hw/virtio/vhost-user.h\n@@ -10,6 +10,7 @@\n \n #include \"chardev/char-fe.h\"\n #include \"hw/virtio/virtio.h\"\n+#include \"qapi/qapi-types-virtio.h\"\n \n enum VhostUserProtocolFeature {\n VHOST_USER_PROTOCOL_F_MQ = 0,\n@@ -113,4 +114,7 @@ void vhost_user_async_close(DeviceState *d,\n CharFrontend *chardev, struct vhost_dev *vhost,\n vu_async_close_fn cb);\n \n+void vhost_user_qmp_status(struct vhost_dev *dev, VirtioStatus *status);\n+bool vhost_user_has_protocol_feature(struct vhost_dev *dev, uint64_t feature);\n+\n #endif\ndiff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h\nindex e139e059857..4a9bd3effef 100644\n--- a/include/hw/virtio/vhost.h\n+++ b/include/hw/virtio/vhost.h\n@@ -104,14 +104,6 @@ struct vhost_dev {\n VIRTIO_DECLARE_FEATURES(features);\n VIRTIO_DECLARE_FEATURES(acked_features);\n \n- /**\n- * @protocol_features: is the vhost-user only feature set by\n- * VHOST_USER_SET_PROTOCOL_FEATURES. Protocol features are only\n- * negotiated if VHOST_USER_F_PROTOCOL_FEATURES has been offered\n- * by the backend (see @features).\n- */\n- uint64_t protocol_features;\n-\n uint64_t max_queues;\n uint64_t backend_cap;\n /* @started: is the vhost device started? */\n", "prefixes": [ "v6", "04/22" ] }