From nobody Sat Nov 15 12:49:56 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1751547372; cv=none; d=zohomail.com; s=zohoarc; b=BIPT6D/4ilLVFEkJ5QogRpWIqgy7d8Y0BUQDbvnCRA53esbbkhXv3/V3WOMWbRxI0uaA1FDXXaBUD7FJWwPvVsERMogui4Wcqeyl6vpf1Tmv7D3stHCLORNdBZAVzAZo7UCehMrjOih+nUeX6xxDB4cSa7bJfgR3rDhREq8P/lM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751547372; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=AySAxDUiU1PmP0dJyXSDIuLXy0LWQcMASwNWclWRNw0=; b=bQ2u6MlHOQTo7yig3JFE/cTVtGOG/xS+AFOrZnQEvUF95c2AJSmDuvif7Jn6ktkJ4QcY/JPNYb9F2MbFNm9hS19efvvwxbqXf2BNQpClQ5o89uvz9Q+83yvHB/b/cMvMVKSGnQ1gxcItezD5pYg9Lrm0FGsC81Sd0+Q8Cs1Se/0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751547372364168.7663539782642; Thu, 3 Jul 2025 05:56:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uXJLv-0005sr-P4; Thu, 03 Jul 2025 08:47:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uXJLg-0005Tt-PG; Thu, 03 Jul 2025 08:47:33 -0400 Received: from forwardcorp1b.mail.yandex.net ([2a02:6b8:c02:900:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uXJLc-0006ni-KU; Thu, 03 Jul 2025 08:47:32 -0400 Received: from mail-nwsmtp-smtp-corp-canary-81.sas.yp-c.yandex.net (mail-nwsmtp-smtp-corp-canary-81.sas.yp-c.yandex.net [IPv6:2a02:6b8:c10:4a1:0:640:2691:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id 4EDBA60CC7; Thu, 3 Jul 2025 15:47:19 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6bf:8080:73d::1:28]) by mail-nwsmtp-smtp-corp-canary-81.sas.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id HlbMgQ0FgSw0-5XJ9sAkD; Thu, 03 Jul 2025 15:47:18 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1751546838; bh=AySAxDUiU1PmP0dJyXSDIuLXy0LWQcMASwNWclWRNw0=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=053XnnZatYaIcRJFccCO9TtUVqEnfOAGV2pA+1XWPfAbH2HwWgnoH++qb1z01APne jGMFoKlebSnpC//1xvI+nRcXWboRfrGiFiHKAoGUsbFL9Tgv2cYLrUEDNKhdNhpbTr NWvzerERgTnG7Kxrb3EtYuyBvPRKpq8nbMhrvndw= Authentication-Results: mail-nwsmtp-smtp-corp-canary-81.sas.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, mst@redhat.com Cc: qemu-block@nongnu.org, fam@euphon.net, pbonzini@redhat.com, jasowang@redhat.com, hreitz@redhat.com, kwolf@redhat.com, sgarzare@redhat.com, raphael@enfabrica.net, Vladimir Sementsov-Ogievskiy Subject: [PATCH 1/4] vhost: introduce vhost_ops->vhost_set_vring_enable_supported method Date: Thu, 3 Jul 2025 15:47:09 +0300 Message-ID: <20250703124713.2530079-2-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250703124713.2530079-1-vsementsov@yandex-team.ru> References: <20250703124713.2530079-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a02:6b8:c02:900:1:45:d181:df01; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1b.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, 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 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1751547375305116600 Content-Type: text/plain; charset="utf-8" Remove vhost-user specific hack from generic code. Signed-off-by: Vladimir Sementsov-Ogievskiy Tested-by: Lei Yang --- hw/virtio/vhost-user.c | 8 ++++++++ hw/virtio/vhost.c | 15 ++++++--------- include/hw/virtio/vhost-backend.h | 2 ++ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 1e1d6b0d6e0..1b2879a90cc 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1230,6 +1230,12 @@ static int vhost_user_set_vring_base(struct vhost_de= v *dev, return vhost_set_vring(dev, VHOST_USER_SET_VRING_BASE, ring, false); } =20 +static bool vhost_user_set_vring_enable_supported(struct vhost_dev *dev) +{ + return virtio_has_feature(dev->backend_features, + VHOST_USER_F_PROTOCOL_FEATURES); +} + static int vhost_user_set_vring_enable(struct vhost_dev *dev, int enable) { int i; @@ -3032,6 +3038,8 @@ const VhostOps user_ops =3D { .vhost_reset_device =3D vhost_user_reset_device, .vhost_get_vq_index =3D vhost_user_get_vq_index, .vhost_set_vring_enable =3D vhost_user_set_vring_enable, + .vhost_set_vring_enable_supported =3D + vhost_user_set_vring_enable_supported, .vhost_requires_shm_log =3D vhost_user_requires_shm_log, .vhost_migration_done =3D vhost_user_migration_done, .vhost_net_set_mtu =3D vhost_user_net_set_mtu, diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index fc438537048..429fad07ded 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1988,15 +1988,12 @@ static int vhost_dev_set_vring_enable(struct vhost_= dev *hdev, int enable) return 0; } =20 - /* - * For vhost-user devices, if VHOST_USER_F_PROTOCOL_FEATURES has not - * been negotiated, the rings start directly in the enabled state, and - * .vhost_set_vring_enable callback will fail since - * VHOST_USER_SET_VRING_ENABLE is not supported. - */ - if (hdev->vhost_ops->backend_type =3D=3D VHOST_BACKEND_TYPE_USER && - !virtio_has_feature(hdev->backend_features, - VHOST_USER_F_PROTOCOL_FEATURES)) { + if (hdev->vhost_ops->vhost_set_vring_enable_supported && + !hdev->vhost_ops->vhost_set_vring_enable_supported(hdev)) { + /* + * This means, that rings are always enabled, and disable/enable + * API is not supported. + */ return 0; } =20 diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-ba= ckend.h index d6df209a2f0..f65fa26298e 100644 --- a/include/hw/virtio/vhost-backend.h +++ b/include/hw/virtio/vhost-backend.h @@ -105,6 +105,7 @@ typedef int (*vhost_reset_device_op)(struct vhost_dev *= dev); typedef int (*vhost_get_vq_index_op)(struct vhost_dev *dev, int idx); typedef int (*vhost_set_vring_enable_op)(struct vhost_dev *dev, int enable); +typedef bool (*vhost_set_vring_enable_supported_op)(struct vhost_dev *dev); typedef bool (*vhost_requires_shm_log_op)(struct vhost_dev *dev); typedef int (*vhost_migration_done_op)(struct vhost_dev *dev, char *mac_addr); @@ -193,6 +194,7 @@ typedef struct VhostOps { vhost_reset_device_op vhost_reset_device; vhost_get_vq_index_op vhost_get_vq_index; vhost_set_vring_enable_op vhost_set_vring_enable; + vhost_set_vring_enable_supported_op vhost_set_vring_enable_supported; vhost_requires_shm_log_op vhost_requires_shm_log; vhost_migration_done_op vhost_migration_done; vhost_vsock_set_guest_cid_op vhost_vsock_set_guest_cid; --=20 2.48.1 From nobody Sat Nov 15 12:49:56 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1751547278; cv=none; d=zohomail.com; s=zohoarc; b=g5PemMn9XTXhI7tbBBOHCHCcqS5stmrRvIEYkWFft2a7Olwerjuyed9Nof5bgVXYpVpioKzKKeOzaWgqyLiyo3axgS+E4Gx1OjKoN9+DPn7ggByPbc+a4zLnJ0bUgfETdUJeABz2aAGHJeHavkqLdE68WsCdzL4WKf3vpgtHSVA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751547278; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=F84/vf+slKCAI1XpqnU8oxnofrZpTBeaYgujwpNDFAw=; b=ObCmEqk+leMTrlqnFDZzxfoaY7jIvKIQ23uW0xBF5YWk3cfKzmmCxotUb8kOa33y23oIXcRD7MbXqAJ8AhW7utH8rxcR7iX49TTRVtTlsg/JiTi7YRVZDKf078pfxruav+zZeqrC+/EDyMqQzuksJ4jtL+K7GkRuZ1kMOhLYPyY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 175154727894849.18515874056516; Thu, 3 Jul 2025 05:54:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uXJOB-00085A-Nj; Thu, 03 Jul 2025 08:50:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uXJLm-0005lQ-MG; Thu, 03 Jul 2025 08:47:39 -0400 Received: from forwardcorp1b.mail.yandex.net ([178.154.239.136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uXJLf-0006np-4T; Thu, 03 Jul 2025 08:47:37 -0400 Received: from mail-nwsmtp-smtp-corp-canary-81.sas.yp-c.yandex.net (mail-nwsmtp-smtp-corp-canary-81.sas.yp-c.yandex.net [IPv6:2a02:6b8:c10:4a1:0:640:2691:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id 17C5660CD1; Thu, 3 Jul 2025 15:47:20 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6bf:8080:73d::1:28]) by mail-nwsmtp-smtp-corp-canary-81.sas.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id HlbMgQ0FgSw0-B6MCEwG0; Thu, 03 Jul 2025 15:47:19 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1751546839; bh=F84/vf+slKCAI1XpqnU8oxnofrZpTBeaYgujwpNDFAw=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=YvcDsdkL0SE1IibwRdN5G3Vd22hJYZi5aW/d32fkKqbuPI0yICK0yzZuFnj5AAk9b G34I1XhhPaeWmN9brSmsWWRnOBJ8JJf4QxiE+GRzl2W0e5hUTpEdVqpj+hAujecIvJ A401lN/zoJ7jmjyM0tTGJ8HYcAskdVn3fiMwaXwc= Authentication-Results: mail-nwsmtp-smtp-corp-canary-81.sas.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, mst@redhat.com Cc: qemu-block@nongnu.org, fam@euphon.net, pbonzini@redhat.com, jasowang@redhat.com, hreitz@redhat.com, kwolf@redhat.com, sgarzare@redhat.com, raphael@enfabrica.net, Vladimir Sementsov-Ogievskiy Subject: [PATCH 2/4] vhost-user: stop use backend_features Date: Thu, 3 Jul 2025 15:47:10 +0300 Message-ID: <20250703124713.2530079-3-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250703124713.2530079-1-vsementsov@yandex-team.ru> References: <20250703124713.2530079-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.136; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1b.mail.yandex.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.237, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, 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 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1751547279795116600 Content-Type: text/plain; charset="utf-8" Simply use features instead, we have same flag here. Signed-off-by: Vladimir Sementsov-Ogievskiy Tested-by: Lei Yang --- hw/virtio/vhost-user.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 1b2879a90cc..cf6f53801db 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1232,7 +1232,7 @@ static int vhost_user_set_vring_base(struct vhost_dev= *dev, =20 static bool vhost_user_set_vring_enable_supported(struct vhost_dev *dev) { - return virtio_has_feature(dev->backend_features, + return virtio_has_feature(dev->features, VHOST_USER_F_PROTOCOL_FEATURES); } =20 @@ -1449,14 +1449,15 @@ static int vhost_user_set_features(struct vhost_dev= *dev, int ret; =20 /* - * We need to include any extra backend only feature bits that - * might be needed by our device. Currently this includes the - * VHOST_USER_F_PROTOCOL_FEATURES bit for enabling protocol - * features. + * Don't lose VHOST_USER_F_PROTOCOL_FEATURES, which is vhost-user + * specific. */ - ret =3D vhost_user_set_u64(dev, VHOST_USER_SET_FEATURES, - features | dev->backend_features, - log_enabled); + if (virtio_has_feature(dev->features, VHOST_USER_F_PROTOCOL_FEATURES))= { + features |=3D 1ULL << VHOST_USER_F_PROTOCOL_FEATURES; + } + + ret =3D vhost_user_set_u64(dev, VHOST_USER_SET_FEATURES, features, + log_enabled); =20 if (virtio_has_feature(dev->protocol_features, VHOST_USER_PROTOCOL_F_STATUS)) { @@ -2187,8 +2188,6 @@ static int vhost_user_backend_init(struct vhost_dev *= dev, void *opaque, (dev->config_ops && dev->config_ops->vhost_dev_config_notifier= ); uint64_t protocol_features; =20 - dev->backend_features |=3D 1ULL << VHOST_USER_F_PROTOCOL_FEATURES; - err =3D vhost_user_get_u64(dev, VHOST_USER_GET_PROTOCOL_FEATURES, &protocol_features); if (err < 0) { --=20 2.48.1 From nobody Sat Nov 15 12:49:56 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1751547473; cv=none; d=zohomail.com; s=zohoarc; b=lO3vhf1bTK4H7PdGynZzW3+g9Jbyj4oinPGMJfmaaQq0tjveO3p216Ya75uQ4qiDXRDPw71KL2AoqVPhCcDvvAVk2CASL3Zbr4lUDwAX1/sDRT4jBnHcsSRa2Zc91CSKFt8eaj9w4evP05VJlmfKcWBR9e0GptoxZbo+LwfNKmw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751547473; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=K1guSZvgPSyqTL8nJpBNAWLbXMO659zzSoxEpeUp2kw=; b=avWqAJp3VDE0u+v01+SKBu0Hs2pzMTjYuBEMWmk4EKqR5w9iwnh2TGjBlSj0uo9LicF3F5IxkEl7CDwYheYgmfPBG2mUJcDeOLm1Q7dAtdMtOWgDUZ1kWCGRv0/jDkobxfGQ48TP8vUGb4Sv4sLzeL5fTyaKlEI9TpRo1h2acwY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751547473170665.2221862345568; Thu, 3 Jul 2025 05:57:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uXJNP-0007Vi-NW; Thu, 03 Jul 2025 08:49:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uXJLk-0005fo-IA; Thu, 03 Jul 2025 08:47:36 -0400 Received: from forwardcorp1b.mail.yandex.net ([178.154.239.136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uXJLc-0006o2-Kn; Thu, 03 Jul 2025 08:47:35 -0400 Received: from mail-nwsmtp-smtp-corp-canary-81.sas.yp-c.yandex.net (mail-nwsmtp-smtp-corp-canary-81.sas.yp-c.yandex.net [IPv6:2a02:6b8:c10:4a1:0:640:2691:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id D835A60CAF; Thu, 3 Jul 2025 15:47:20 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6bf:8080:73d::1:28]) by mail-nwsmtp-smtp-corp-canary-81.sas.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id HlbMgQ0FgSw0-4uj2EH2p; Thu, 03 Jul 2025 15:47:20 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1751546840; bh=K1guSZvgPSyqTL8nJpBNAWLbXMO659zzSoxEpeUp2kw=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=oT0rtWYc1KEms+cwhH746I/KLz3WIwZ9MO27cx6K4WnY8/m2n8+VCbjCfnAgTtXas J0xlK7WTViqAd7CKudxWXv5/9LsuqH104Svanj9SGG+RSxxjm4ntH+6lmhzN4BGWzy kMy/6kK8a3F8ziiQtjsXx3OhUua0ZFC1I/1u3cfg= Authentication-Results: mail-nwsmtp-smtp-corp-canary-81.sas.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, mst@redhat.com Cc: qemu-block@nongnu.org, fam@euphon.net, pbonzini@redhat.com, jasowang@redhat.com, hreitz@redhat.com, kwolf@redhat.com, sgarzare@redhat.com, raphael@enfabrica.net, Vladimir Sementsov-Ogievskiy Subject: [PATCH 3/4] vhost_net: stop use backend_features Date: Thu, 3 Jul 2025 15:47:11 +0300 Message-ID: <20250703124713.2530079-4-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250703124713.2530079-1-vsementsov@yandex-team.ru> References: <20250703124713.2530079-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.136; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1b.mail.yandex.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.237, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1751547474204116600 Content-Type: text/plain; charset="utf-8" We are going to drop backend_features variable as an extra one. Call to qemu_has_vnet_hdr() is cheap. Signed-off-by: Vladimir Sementsov-Ogievskiy Tested-by: Lei Yang --- hw/net/vhost_net.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 891f235a0a6..38cbc6caa14 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -139,7 +139,8 @@ int vhost_net_set_config(struct vhost_net *net, const u= int8_t *data, =20 void vhost_net_ack_features(struct vhost_net *net, uint64_t features) { - net->dev.acked_features =3D net->dev.backend_features; + net->dev.acked_features =3D qemu_has_vnet_hdr(net->nc) + ? 0 : (1ULL << VHOST_NET_F_VIRTIO_NET_HDR); vhost_ack_features(&net->dev, vhost_net_get_feature_bits(net), feature= s); } =20 @@ -338,12 +339,9 @@ struct vhost_net *vhost_net_init(VhostNetOptions *opti= ons) if (r < 0) { goto fail; } - net->dev.backend_features =3D qemu_has_vnet_hdr(options->net_backe= nd) - ? 0 : (1ULL << VHOST_NET_F_VIRTIO_NET_HDR); net->backend =3D r; net->dev.protocol_features =3D 0; } else { - net->dev.backend_features =3D 0; net->dev.protocol_features =3D 0; net->backend =3D -1; =20 @@ -363,10 +361,10 @@ struct vhost_net *vhost_net_init(VhostNetOptions *opt= ions) sizeof(struct virtio_net_hdr_mrg_rxbuf))) { net->dev.features &=3D ~(1ULL << VIRTIO_NET_F_MRG_RXBUF); } - if (~net->dev.features & net->dev.backend_features) { - fprintf(stderr, "vhost lacks feature mask 0x%" PRIx64 - " for backend\n", - (uint64_t)(~net->dev.features & net->dev.backend_featur= es)); + if (!qemu_has_vnet_hdr(options->net_backend) && + (~net->dev.features & (1ULL << VHOST_NET_F_VIRTIO_NET_HDR))) { + fprintf(stderr, "vhost lacks feature mask 0x%llx for backend\n= ", + ~net->dev.features & (1ULL << VHOST_NET_F_VIRTIO_NET_H= DR)); goto fail; } } --=20 2.48.1 From nobody Sat Nov 15 12:49:56 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1751547125; cv=none; d=zohomail.com; s=zohoarc; b=bUTVUXVSiQY1WtgcH6BQgklCNaXU8IENrD021dfZKNKtD2PxPr8M/0NqNHD1ZQlcbsyFq/uyDawczrMUisuzzVqI3lUzxE9C8hL/w/tvRMcZ1OTMCgtpTw0uR6vM7gBetX1xWKk4rXqy4PJ8TbxC8bGslG1WNw4Kk8dRuLurmhQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751547125; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5bC95VXV5236FRUQzBWj4uboAIkxgDmBkiRLwpbUVcM=; b=QT4/Xdws3HtueCJhp6OvVMrdEB0phK9K53mV4+7+jtvoQMtgp0avMv1lktbHSMl6eB0q9/VEOb+2T9gY87vo6Nu+GQ4tqjYyHxkbMxuHR/yKddl4ZwRf4UsZ6in8TErwaH86kDLitLcYTYVa0Ih9IHsLWMkmQmJT9Kg8don91AY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751547125033613.3212957421572; Thu, 3 Jul 2025 05:52:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uXJMV-0006wc-9y; Thu, 03 Jul 2025 08:48:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uXJLk-0005eO-4z; Thu, 03 Jul 2025 08:47:36 -0400 Received: from forwardcorp1b.mail.yandex.net ([178.154.239.136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uXJLc-0006oa-KY; Thu, 03 Jul 2025 08:47:34 -0400 Received: from mail-nwsmtp-smtp-corp-canary-81.sas.yp-c.yandex.net (mail-nwsmtp-smtp-corp-canary-81.sas.yp-c.yandex.net [IPv6:2a02:6b8:c10:4a1:0:640:2691:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id CA9E560C88; Thu, 3 Jul 2025 15:47:21 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6bf:8080:73d::1:28]) by mail-nwsmtp-smtp-corp-canary-81.sas.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id HlbMgQ0FgSw0-6ElfXpBj; Thu, 03 Jul 2025 15:47:21 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1751546841; bh=5bC95VXV5236FRUQzBWj4uboAIkxgDmBkiRLwpbUVcM=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=vSq4yMnJCH4Z+3npji4HTDunBMV+STb/geUoV7g3IKtARGEjN+ctq+/FJkRgJ1RPr /Kw6QU5GBFCeS81t67EdvcL9AMISAlYyYYrARwPPsU4I11CVFe4/vOyjf220StdZRR VINz2oow8YYu0ZwuR8R6dyHtbO+LSu7QbPpsswPA= Authentication-Results: mail-nwsmtp-smtp-corp-canary-81.sas.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, mst@redhat.com Cc: qemu-block@nongnu.org, fam@euphon.net, pbonzini@redhat.com, jasowang@redhat.com, hreitz@redhat.com, kwolf@redhat.com, sgarzare@redhat.com, raphael@enfabrica.net, Vladimir Sementsov-Ogievskiy Subject: [PATCH 4/4] hw/vhost: finally drop vhost_dev.backend_features field Date: Thu, 3 Jul 2025 15:47:12 +0300 Message-ID: <20250703124713.2530079-5-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250703124713.2530079-1-vsementsov@yandex-team.ru> References: <20250703124713.2530079-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.136; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1b.mail.yandex.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.237, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, 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 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1751547126238116600 Content-Type: text/plain; charset="utf-8" It's unused now. Signed-off-by: Vladimir Sementsov-Ogievskiy Tested-by: Lei Yang --- hw/block/vhost-user-blk.c | 1 - hw/scsi/vhost-scsi.c | 1 - hw/scsi/vhost-user-scsi.c | 1 - hw/virtio/vdpa-dev.c | 1 - hw/virtio/virtio-qmp.c | 2 -- include/hw/virtio/vhost.h | 7 ------- 6 files changed, 13 deletions(-) diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index 0eebbcd80d8..079a6492355 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -343,7 +343,6 @@ static int vhost_user_blk_connect(DeviceState *dev, Err= or **errp) s->dev.nvqs =3D s->num_queues; s->dev.vqs =3D s->vhost_vqs; s->dev.vq_index =3D 0; - s->dev.backend_features =3D 0; =20 vhost_dev_set_config_notifier(&s->dev, &blk_ops); =20 diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index cdf405b0f86..d694a25fe2d 100644 --- a/hw/scsi/vhost-scsi.c +++ b/hw/scsi/vhost-scsi.c @@ -276,7 +276,6 @@ static void vhost_scsi_realize(DeviceState *dev, Error = **errp) vqs =3D g_new0(struct vhost_virtqueue, vsc->dev.nvqs); vsc->dev.vqs =3D vqs; vsc->dev.vq_index =3D 0; - vsc->dev.backend_features =3D 0; =20 ret =3D vhost_dev_init(&vsc->dev, (void *)(uintptr_t)vhostfd, VHOST_BACKEND_TYPE_KERNEL, 0, errp); diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index 25f2d894e7c..0c80a271d8b 100644 --- a/hw/scsi/vhost-user-scsi.c +++ b/hw/scsi/vhost-user-scsi.c @@ -159,7 +159,6 @@ static int vhost_user_scsi_connect(DeviceState *dev, Er= ror **errp) vsc->dev.nvqs =3D VIRTIO_SCSI_VQ_NUM_FIXED + vs->conf.num_queues; vsc->dev.vqs =3D s->vhost_vqs; vsc->dev.vq_index =3D 0; - vsc->dev.backend_features =3D 0; =20 ret =3D vhost_dev_init(&vsc->dev, &s->vhost_user, VHOST_BACKEND_TYPE_U= SER, 0, errp); diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c index d1da40afc80..3c0eed3e8e1 100644 --- a/hw/virtio/vdpa-dev.c +++ b/hw/virtio/vdpa-dev.c @@ -104,7 +104,6 @@ static void vhost_vdpa_device_realize(DeviceState *dev,= Error **errp) v->dev.vqs =3D vqs; v->dev.vq_index =3D 0; v->dev.vq_index_end =3D v->dev.nvqs; - v->dev.backend_features =3D 0; v->started =3D false; =20 ret =3D vhost_vdpa_get_iova_range(v->vhostfd, &iova_range); diff --git a/hw/virtio/virtio-qmp.c b/hw/virtio/virtio-qmp.c index 3b6377cf0d2..e514a4797e3 100644 --- a/hw/virtio/virtio-qmp.c +++ b/hw/virtio/virtio-qmp.c @@ -788,8 +788,6 @@ VirtioStatus *qmp_x_query_virtio_status(const char *pat= h, Error **errp) qmp_decode_features(vdev->device_id, hdev->features); status->vhost_dev->acked_features =3D qmp_decode_features(vdev->device_id, hdev->acked_features); - status->vhost_dev->backend_features =3D - qmp_decode_features(vdev->device_id, hdev->backend_features); status->vhost_dev->protocol_features =3D qmp_decode_protocols(hdev->protocol_features); status->vhost_dev->max_queues =3D hdev->max_queues; diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index 38800a7156b..d6afde8b5dd 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -99,16 +99,9 @@ struct vhost_dev { * * @features: available features provided by the backend * @acked_features: final negotiated features with front-end driver - * - * @backend_features: this is used in a couple of places to either - * store VHOST_USER_F_PROTOCOL_FEATURES to apply to - * VHOST_USER_SET_FEATURES or VHOST_NET_F_VIRTIO_NET_HDR. Its - * future use should be discouraged and the variable retired as - * its easy to confuse with the VirtIO backend_features. */ uint64_t features; uint64_t acked_features; - uint64_t backend_features; =20 /** * @protocol_features: is the vhost-user only feature set by --=20 2.48.1