From nobody Sun Apr 12 05:51:25 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1771993225; cv=none; d=zohomail.com; s=zohoarc; b=BDpaoU9BQTXinEss4h2cLUXoMbbol/GRJaW7sTgnLYRaRTHBsOE+9MSvuRBsGtekWV6Sfj3i2Mwq9kqZKZdvet07dwQrfmx6q1r9sOrjCv+AC1xUBfS5KkmSMXrNEJQRz4sWqdTyk5+1jJGtAJ/ngwM8Ba7Ny4rrbrDQpvF/+ac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771993225; h=Content-Type: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=dXcG9vkcojZNmdSMtnTvaH9pWnFqc8b8gh2qy0TXg9Y=; b=U7LqP3qt++XLq3rXAs8rhu2X4gpR5/GLklLO1QuqD0IKXEzX+Lmck8QrTp4BRLyNXmkNBPaodC9R9JnqO1Xd+pJI5ywVxJx359N9uckEDa3Z8wO46tP2+xLaIjoR7SdHOZ295lTgYWwcJmGPCZU6S0jxC5J+VbLBQCFH/euuirM= 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 1771993225610414.1620148880087; Tue, 24 Feb 2026 20:20:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vv6NW-0005F6-O6; Tue, 24 Feb 2026 23:20:02 -0500 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 1vv6NV-0005Ed-JF for qemu-devel@nongnu.org; Tue, 24 Feb 2026 23:20:01 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vv6NT-0004Xf-TK for qemu-devel@nongnu.org; Tue, 24 Feb 2026 23:20:01 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-483770e0b25so55507525e9.0 for ; Tue, 24 Feb 2026 20:19:59 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-483bfcbf8b6sm2074655e9.20.2026.02.24.20.19.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 24 Feb 2026 20:19:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1771993198; x=1772597998; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dXcG9vkcojZNmdSMtnTvaH9pWnFqc8b8gh2qy0TXg9Y=; b=MQ+obc9NUW0NEbBN5KOYI2ivDPN5c2f4n0Mf+9edobAU/LGcN4L0vcEu/RqldhIUGE UPgDovZj9+xPolpjjrNB2VBmfDep7zSZQ5qI8avZEkL+oLD78+10wTBHc8jKkhLZQSvD lcgE7vuA84K963UfSLiE5eseFE9HdQ+OcqTWixdCd6EtENJo5DANLIF4cOhnNZw/JGtz 0VJSAKMQunF4da/BMNeDN8N0txNzBmRqKrkZTOFxdK4lRYo7WNMK6HpEzxU5lmnZjEOJ 0bXbe7IP0kod0pYRrmb9O7oJVkOzlYyJnXHgeSi2jeUJCJjBQ6HXtvzv1xKeiQdZiy64 Df5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771993198; x=1772597998; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=dXcG9vkcojZNmdSMtnTvaH9pWnFqc8b8gh2qy0TXg9Y=; b=LPIiLG1kDFGDoDOpvKCfN1J6wygctejFhXuxD54owR1hsu5FV/PSYyT402My+eGEXJ UyH3+C0RYeLrFoMaB2AK4Rx7B/JdhZunBIL7cOjlwhnODHpJ0Af+sKzJB6jq/zUChSIP iw7NBtxXwDApqvNXjXaabYDL0FlctV+5IL3a+H/sZn8xIh3C3i0Ed0okc81tECqj/Wfm VHdvPONwafbwEIYlwceuwc3vaU0MkEMrIWGto/uubp3l86wtWmLF5+yY9wQF2qMKG/R7 nKAySQVkC9qIiNW3KFHAyceQub9qrjbKKwk/0qNr+/G0cRLvPZ4qjjbD6181eWvNDSEU sphA== X-Forwarded-Encrypted: i=1; AJvYcCWH6/ffCYCMbFOsaHJJNGyAmWBIXVRPJKu1AR6rHrjLROatNuVG4ePqUkesHvL5QFNUKC8Xwuabs1kH@nongnu.org X-Gm-Message-State: AOJu0Yyz+0G8E15E/kLd9672AW+oQwKdLlQCpfVEtGa+VrmGOb0xcbML SUgkZNOG0+xqSfpzHvzjQBMsZwOT/E2Nih6s7pPbcP4rBfc/arccueYjqXjEaf4LzEM= X-Gm-Gg: ATEYQzxCVRU+2420mbExvBl0rOkLsSGyqi+raU1MycNPmiRvLOCmDs0R2bHrGeKGvan PLQp67j2/SfXLgXoOeec+FTQ93HZvSVqZGxdi5kTnluwTSWo08SnHgrXlOf/jb6RZfsdFtgobCs gt+FvceQQyi7BLBrGlnCW/RLY4nC5kk+JOeTTgOLSGByc6gUUqca0KKmUmzZ6AMVF66LkDux282 AtXVYLjCWPH6XEgV7/8y06SWFt7Dzr3oaUKBg75rT2c+CsjZs37MPVYjMfxmUF4h9mzaGPmxSVW Q4CUg5OZ73k5BQ0kP7DZfPaE6xoCEC3J8Myyh+w8kazivagpUTskSFRU1cvKKC5bfRm4y2XDpVe LmzMS0QpXElbBkyQEKGye9YvHiUekAZc8Z9FWwahnXXIwZHveqlxV6+KLgKT5j9wQFVjKrJoNxX 8fc4Xtbsh56yx7Z29qsU9dSPWz5pLB85cno4nslhQgt6ErHT+LI176MTNAY6agEiglphKw/d5d X-Received: by 2002:a05:600c:5020:b0:483:6f37:1b56 with SMTP id 5b1f17b1804b1-483a95fb268mr238008685e9.10.1771993198332; Tue, 24 Feb 2026 20:19:58 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Stefan Hajnoczi , Pierrick Bouvier , qemu-devel@nongnu.org Cc: Paolo Bonzini , BALATON Zoltan , Jason Wang , Stefano Garzarella , Fam Zheng , Hanna Reitz , Kevin Wolf , "Michael S. Tsirkin" , Christian Schoenebeck , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-block@nongnu.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Greg Kurz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 1/6] hw/virtio: Add virtio_vdev_is_legacy() Date: Wed, 25 Feb 2026 05:19:42 +0100 Message-ID: <20260225041948.52929-2-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260225041948.52929-1-philmd@linaro.org> References: <20260225041948.52929-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.google.com 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, RCVD_IN_DNSWL_NONE=-0.0001, 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: qemu development 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 @linaro.org) X-ZM-MESSAGEID: 1771993227917158500 From: Pierrick Bouvier This simplifies code compared to having virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1) or !virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1). Acked-by: Stefan Hajnoczi Signed-off-by: Pierrick Bouvier Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- include/hw/virtio/virtio-access.h | 2 +- include/hw/virtio/virtio.h | 7 ++++++- hw/virtio/vhost.c | 12 +++++------- hw/virtio/virtio-pci.c | 6 +++--- hw/virtio/virtio.c | 8 ++++---- 5 files changed, 19 insertions(+), 16 deletions(-) diff --git a/include/hw/virtio/virtio-access.h b/include/hw/virtio/virtio-a= ccess.h index b58fb6ed7ea..b8aa7a520f5 100644 --- a/include/hw/virtio/virtio-access.h +++ b/include/hw/virtio/virtio-access.h @@ -30,7 +30,7 @@ static inline bool virtio_access_is_big_endian(VirtIODevi= ce *vdev) #if defined(LEGACY_VIRTIO_IS_BIENDIAN) return virtio_vdev_is_big_endian(vdev); #elif TARGET_BIG_ENDIAN - if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) { + if (!virtio_vdev_is_legacy(vdev)) { /* Devices conforming to VIRTIO 1.0 or later are always LE. */ return false; } diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index 9dd93cf965a..42d20899390 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -468,9 +468,14 @@ static inline bool virtio_host_has_feature(VirtIODevic= e *vdev, return virtio_has_feature(vdev->host_features, fbit); } =20 +static inline bool virtio_vdev_is_legacy(const VirtIODevice *vdev) +{ + return !virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1); +} + static inline bool virtio_vdev_is_big_endian(const VirtIODevice *vdev) { - if (!virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) { + if (virtio_vdev_is_legacy(vdev)) { assert(vdev->device_endian !=3D VIRTIO_DEVICE_ENDIAN_UNKNOWN); return vdev->device_endian =3D=3D VIRTIO_DEVICE_ENDIAN_BIG; } diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index b4cdb7762f9..b9dc4ed13ba 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1168,14 +1168,12 @@ static void vhost_log_stop(MemoryListener *listener, */ static inline bool vhost_needs_vring_endian(VirtIODevice *vdev) { - if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) { - return false; + if (virtio_vdev_is_legacy(vdev)) { + return vdev->device_endian =3D=3D (HOST_BIG_ENDIAN + ? VIRTIO_DEVICE_ENDIAN_LITTLE + : VIRTIO_DEVICE_ENDIAN_BIG); } -#if HOST_BIG_ENDIAN - return vdev->device_endian =3D=3D VIRTIO_DEVICE_ENDIAN_LITTLE; -#else - return vdev->device_endian =3D=3D VIRTIO_DEVICE_ENDIAN_BIG; -#endif + return false; } =20 static int vhost_virtqueue_set_vring_endian_legacy(struct vhost_dev *dev, diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index c7b5a79b936..31b566c6ae3 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1449,11 +1449,11 @@ static bool virtio_pci_queue_enabled(DeviceState *d= , int n) VirtIOPCIProxy *proxy =3D VIRTIO_PCI(d); VirtIODevice *vdev =3D virtio_bus_get_device(&proxy->bus); =20 - if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) { - return proxy->vqs[n].enabled; + if (virtio_vdev_is_legacy(vdev)) { + return virtio_queue_enabled_legacy(vdev, n); } =20 - return virtio_queue_enabled_legacy(vdev, n); + return proxy->vqs[n].enabled; } =20 static int virtio_pci_add_mem_cap(VirtIOPCIProxy *proxy, diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index e9d55329525..c0c4599b586 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -2753,7 +2753,7 @@ static bool virtio_device_endian_needed(void *opaque) VirtIODevice *vdev =3D opaque; =20 assert(vdev->device_endian !=3D VIRTIO_DEVICE_ENDIAN_UNKNOWN); - if (!virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) { + if (virtio_vdev_is_legacy(vdev)) { return vdev->device_endian !=3D virtio_default_endian(); } /* Devices conforming to VIRTIO 1.0 or later are always LE. */ @@ -3460,10 +3460,10 @@ virtio_load(VirtIODevice *vdev, QEMUFile *f, int ve= rsion_id) * to calculate used and avail ring addresses based on the desc * address. */ - if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) { - virtio_init_region_cache(vdev, i); - } else { + if (virtio_vdev_is_legacy(vdev)) { virtio_queue_update_rings(vdev, i); + } else { + virtio_init_region_cache(vdev, i); } =20 if (virtio_vdev_has_feature(vdev, VIRTIO_F_RING_PACKED)) { --=20 2.52.0 From nobody Sun Apr 12 05:51:25 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1771993262; cv=none; d=zohomail.com; s=zohoarc; b=dC1wNFR/rup8JSsV8NCkHw+l7jnXJQaydB28NFfWElJMXZh8UCD+X4oXviSlfzu8loc2JA7ks2mBaTGoP8h2AmE8EwHJiR5ipSblKnxso6KCbs5nNz8hDRao93+j0bFJJCEaeLdyxY/N/drUd4ZVVNCzg/GLAdsrEJm7q4sBEzE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771993262; h=Content-Type: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=FyyQGCdvNlXMpJGQDM6PgsdMvaL+DbEDtXb1NotW1AQ=; b=YF/+CSjYDEQk5ZlnEXbkZRL+PdvJ7J/w7Nb0wIp1HDxrp0cG11eOuQnIOpD3gHgFHjMnB3T6CMSK15SYUK4vki4ypFisrnlFtbW8ovv1ePbPz58/4ydH7uzwxBVsXGsha2ZPK2Xkmkl+qM39/iXCkgOHGvRgt2z6eehgjnl40UU= 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 1771993262941474.4241564563056; Tue, 24 Feb 2026 20:21:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vv6Ne-0005QH-7F; Tue, 24 Feb 2026 23:20:10 -0500 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 1vv6Nd-0005Og-1U for qemu-devel@nongnu.org; Tue, 24 Feb 2026 23:20:09 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vv6Nb-0004kJ-AC for qemu-devel@nongnu.org; Tue, 24 Feb 2026 23:20:08 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-48375f10628so40005565e9.1 for ; Tue, 24 Feb 2026 20:20:06 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-483bfb1390bsm3827485e9.1.2026.02.24.20.20.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 24 Feb 2026 20:20:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1771993206; x=1772598006; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FyyQGCdvNlXMpJGQDM6PgsdMvaL+DbEDtXb1NotW1AQ=; b=NP2gotJckQwxITjfT3XSlST6if4nnYzub+acOaJ0FwVxNaq0MMcuDbBhXy5qNf1qCT aMnn8thVxP2koFtTR8CyH6jxutukjkHiflR+8FalQitlOt1JIzjXzX3HZNr/1qk263p1 epmLzioMUj2DnlJj6OwPD5TpE0FK39Yr0OJjX8b5KadLmEF1xiGJw0g4Fd9SGndfh4X7 3vJqHNoY21DZcDhb7fRKEbBOyW82EirB3EoxNe9NJfCGt0739SZsdx8z9jxGCvV17KpS 1s3i7+fa5lbZeBZzdXTEaZHJ0LbEm0SZ+ZLvnNr5uuV6jFjAlE998WCISV7PXyIsU9BY I6Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771993206; x=1772598006; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=FyyQGCdvNlXMpJGQDM6PgsdMvaL+DbEDtXb1NotW1AQ=; b=eT6EQrYZxT346FYoRsY+B+ahbgiBgPiof5bBdBH82MIAobz4JTG5eBU2eR2totpfMX Ha1cakSYXhPtdfutv27jVoNKDcjO5smpnYvQUlvw3U9jVMd9P82KBnpkTS5uXQncloaL oQV+c/P25pqk0t5jI2Bk/jAzHqztR+icDydjWwGpsc47a+j03xUp61a2a07UkrP11RcZ Y9r+D7ah+9AEXZOJmC1te/2/tR+41zhqV7JPMDVCKaBOmOMP/CRNst3uZXgx4AF3br4v mfG4Jwm4R8ojOoN+Ec7j+SlT0cWNWw8z89DfzsLEsU4D6nxeNyB8ltNjh7RCAOlkK2xe 1Gkw== X-Forwarded-Encrypted: i=1; AJvYcCXXjXBWbBr8SWGm7CES6MrCuHGGS4VZ2/VNUxcbJKaG6BE8QW3e1gk+jqWgn8r/xkcJjTMzWP/2xYi6@nongnu.org X-Gm-Message-State: AOJu0YxfWdltlPnVGXlvxenb6O+5G0hFH12IY8lHAmkNgNdAPUKTGF1M tuhY5ljBy8zRuEeyW/bFPspaipltoQ/PX+nHgyEOBYOzar8lkDx2qERSew5lu7xAn9w= X-Gm-Gg: ATEYQzxBz/WoZzxzhRBkn1gW0nrCXa0KFKBnqqWU9Nb99ZSbO7QLv2aBQFdpKCMznpm 6g1PqgeegbFiq4bwYgkLiDtDttEKlQqZ4JSXc0vM99FEP5++Ohb3F9VTF+A/sY9j4t8vjziMtia Bu7Mp8f3z/3JBM8h2MGqmGPqLCm2SGln8qU6F+1bf3svkLi12K31hnnphLh854AEcj4IOV8Oknp nzekF8MH8rwnNqrImy0JoM3msbXjo/HfU0H38J88VSCHkQmzcCAhcm2guyIwbCrfQzEN7ZmBF2K fUGIqmTNvXejdXN4yNyUknJAkM1uOiJOkaeSsACrs5lZUZ04GiASpXw6qLjqFb86y2wOBtoLn26 CHFx0DkCRxFcTrr0P7G4yJCSHfABSANF/HGouAC3INUOA8aNLadt4KHVHpx9h/xrCWP+KVbPtbf Lg0gnGtUPVDhVNif1gqvc88n7hnY9zWbCVM+/wYZt3BI18Iy5VmiifeekU0ga8/X0ZsT+u0We7+ gzLU6i2ZAM= X-Received: by 2002:a05:600c:1c22:b0:483:79ad:f3b9 with SMTP id 5b1f17b1804b1-483a95eada4mr249411955e9.28.1771993205837; Tue, 24 Feb 2026 20:20:05 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Stefan Hajnoczi , Pierrick Bouvier , qemu-devel@nongnu.org Cc: Paolo Bonzini , BALATON Zoltan , Jason Wang , Stefano Garzarella , Fam Zheng , Hanna Reitz , Kevin Wolf , "Michael S. Tsirkin" , Christian Schoenebeck , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-block@nongnu.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Greg Kurz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 2/6] hw/virtio: Simplify virtio_access_is_big_endian() Date: Wed, 25 Feb 2026 05:19:43 +0100 Message-ID: <20260225041948.52929-3-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260225041948.52929-1-philmd@linaro.org> References: <20260225041948.52929-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.google.com 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @linaro.org) X-ZM-MESSAGEID: 1771993265372158500 From: Pierrick Bouvier Thanks to previous refactoring, we can see more easily it is strictly equivalent to always call virtio_vdev_is_big_endian. static inline bool virtio_vdev_is_big_endian(VirtIODevice *vdev) { if (virtio_vdev_is_legacy(vdev)) { assert(vdev->device_endian !=3D VIRTIO_DEVICE_ENDIAN_UNKNOWN); return vdev->device_endian =3D=3D VIRTIO_DEVICE_ENDIAN_BIG; } /* Devices conforming to VIRTIO 1.0 or later are always LE. */ return false; } The key is to understand that vdev->device_endian is initialized as expected. It always contains cpu endianness, and not device endianness, ignoring if device is legacy or not. By default, it's initialized to vdev->device_endian =3D virtio_default_endian(), which matches target default endianness. Then, on virtio_reset, it will be initialized with current_cpu endianness (if there is one current_cpu). void virtio_reset() { ... if (current_cpu) { /* Guest initiated reset */ vdev->device_endian =3D virtio_current_cpu_endian(); } else { /* System reset */ vdev->device_endian =3D virtio_default_endian(); } Now, we can see how existing virtio_access_is_big_endian is equivalent to virtio_vdev_is_big_endian. Let's break the existing function in its 3 variants, and compare that to virtio_vdev_is_big_endian. static inline bool virtio_access_is_big_endian(VirtIODevice *vdev) - #if defined(LEGACY_VIRTIO_IS_BIENDIAN) return virtio_vdev_is_big_endian(vdev); This is the exact replacement we did, so equivalent. - #elif TARGET_BIG_ENDIAN if (!virtio_vdev_is_legacy(vdev)) { return false; } return true; we know target_is_big_endian(), so vdev->device_endian =3D=3D VIRTIO_DEVICE_ENDIAN_BIG. if (virtio_vdev_is_legacy(vdev)) { return VIRTIO_DEVICE_ENDIAN_BIG =3D=3D VIRTIO_DEVICE_ENDIAN_BIG; } return false; It's written in opposite style compared to existing code (if legacy vs if modern), but it's strictly equivalent. - #else return false; we know !target_is_big_endian(), so vdev->device_endian =3D=3D VIRTIO_DEVICE_ENDIAN_LITTLE. if virtio_vdev_is_legacy(vdev) { return VIRTIO_DEVICE_ENDIAN_LITTLE =3D=3D VIRTIO_DEVICE_ENDIAN_BIG; } return false; So it always return false, as expected. Signed-off-by: Pierrick Bouvier Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Stefan Hajnoczi Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- include/hw/virtio/virtio-access.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/include/hw/virtio/virtio-access.h b/include/hw/virtio/virtio-a= ccess.h index b8aa7a520f5..e3148c23881 100644 --- a/include/hw/virtio/virtio-access.h +++ b/include/hw/virtio/virtio-access.h @@ -21,23 +21,9 @@ #include "hw/virtio/virtio.h" #include "hw/virtio/virtio-bus.h" =20 -#if defined(TARGET_PPC64) || defined(TARGET_ARM) -#define LEGACY_VIRTIO_IS_BIENDIAN 1 -#endif - static inline bool virtio_access_is_big_endian(VirtIODevice *vdev) { -#if defined(LEGACY_VIRTIO_IS_BIENDIAN) return virtio_vdev_is_big_endian(vdev); -#elif TARGET_BIG_ENDIAN - if (!virtio_vdev_is_legacy(vdev)) { - /* Devices conforming to VIRTIO 1.0 or later are always LE. */ - return false; - } - return true; -#else - return false; -#endif } =20 static inline void virtio_stw_p(VirtIODevice *vdev, void *ptr, uint16_t v) --=20 2.52.0 From nobody Sun Apr 12 05:51:25 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1771993262; cv=none; d=zohomail.com; s=zohoarc; b=UmgZQZsrri+bBJ4CBKrfjTJSH9lU8yXBZrVrwnHiGppZZ6nFfTTvsYiWc1GZi/tD7953Y1oAiTFs9nDy3junNaQa9WKll6nCnqNOk19PftNsrrc4P+JSGqTozEhVho9VKXJCuOWsjwGCE+QIODht5WBrr/xgi9G5ZIMM64FcJ6c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771993262; h=Content-Type: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=NqTpTGJG4svOAEeffctm6QW7VYZ7AcyiuZ79wbqVmIA=; b=lD0bFYDJ72lRj/wb8fM9CzqOv9AVa6wZze5ltrVI9+MA2t9XoELQRr/MMKISQfMqzWtZUwbgpfouBBWb81B14NGAIEg7DNMWi+ZmzivTUmm/FFTlGwLHf/RXuMxN8InLJPuptv4Ltialhfmukz/23aRJGVOVGDNgEWC3VvJv2zs= 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 1771993262930599.5625615507477; Tue, 24 Feb 2026 20:21:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vv6Nn-0005cG-OH; Tue, 24 Feb 2026 23:20:19 -0500 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 1vv6Nl-0005bi-Cx for qemu-devel@nongnu.org; Tue, 24 Feb 2026 23:20:17 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vv6Nj-0004qQ-Ke for qemu-devel@nongnu.org; Tue, 24 Feb 2026 23:20:17 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4807068eacbso48445675e9.2 for ; Tue, 24 Feb 2026 20:20:15 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-483bfecb8basm1913585e9.32.2026.02.24.20.20.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 24 Feb 2026 20:20:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1771993214; x=1772598014; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NqTpTGJG4svOAEeffctm6QW7VYZ7AcyiuZ79wbqVmIA=; b=fyImABZUsxbp0OBhuVmdpNGfAQLpwgq8UmJNKBykWRmkEXFErgldslHTT0WNCds9jX OSm17wFfAzWMkckKsbGmtuajR6dXUQ/b+cQdy1axdL+fBwTf68yVqDixkwq4kuSyIVXZ BE58kaixkWrk4UlEEavNgCDrJ3r9aD+GqxuGa5M9up7iwp3tT0rVnB5D04pbKu1a+zL4 86tc4/YAXUfelTKG2krOS2jaFSuNpWUMGNDhY3Ls7K8YLBzSTZbihe0zlK9cHA4PLTxF Tp1MDnqoXa+IpPn22X+bpTRWF8tktQfpb40yLPXrDnuS4vMhXUmTuoHOgJ8U1Psgl/nt JKNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771993214; x=1772598014; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=NqTpTGJG4svOAEeffctm6QW7VYZ7AcyiuZ79wbqVmIA=; b=CYZ5ZP8YqLL4CRT9Iw8tcDZ5AyGsGlTwa6mD5O1p9HX6qRKglwJHjwYRwFwEE6MvLj 5QhVFrqC5OlvR+h3IkuNQWC4CpMHHb32IZVzEHr5LVkM57K8g31qWLhOT3sSQMXOk4J6 2rlzMLcdMmGUH5QX/gpIsJfMMwphdRU3fLT+xZ1PUlIXcLvZ76ZLdkabGC/YBA4XShh2 Q+xwj6WgS2h+Tz/k82Znrm/cdd9zPjSD8sGfZoWLYwC9JFNu7bvUpv/QHaDAhy0TQSPI 6aHSVWe/mvSukutVQAZyd8ELOmSp5SFR8uBCtds7eW4bv/jFIzThHIGU8F1HjbYJCntH JYZw== X-Forwarded-Encrypted: i=1; AJvYcCX93UzbMMpuyC01/ZsHTGuq6/6zknismNxQKIoup8C4ELbksWWb99YqcLUKTOB8n9xo7YLfBS8vkVuj@nongnu.org X-Gm-Message-State: AOJu0Yx9fkMwvxZdTPo7tLLmCFMe50C5s7XlS8FtAbGFvOvWjXCiL6ui n7KpRb+wA8InEa4+go9oQWgiRnX8Jf8KNCNHj9LRVO6blU94rTjLPzqZkO2z0/z7CCs= X-Gm-Gg: ATEYQzzWh25KEfNMCSAOBmJkwEZ0hfa+W1pe+b3wu3SIV2gVhVHwEg4x8UE0L2H+2QF rkwlY5kq9+509eqK+KQfM42XrLNqUht4IUAFDn9alZY3K27MqtZma6VTLRLxIccNGxOgHILVgc7 A1/320asLYxFTM8iIigAI9nwcv1tc2HuwJJNqIhavNyUgoNwtl564wRTnkY+DmegJxE/PtWnOlG qWCpzzR8iYDe+FPOYdVuxET6z8ImUlD/qFm7Ctbwi89lJixbeoTOVD2U1j1OXhT+iuLqpul/H4K YVEPktL+iJ140MhA8opKIiPOFyyDNg5prcm9rvL2acLvQJwvDKMvYHVns4ZBLtrd8Xgm7uHT+8b /vjyoLx/EcbEI/HU+nVRQZSuHtMmaM9dX4ydHNfzF1nvYhqZHxHpKnwtdnvXw4ac13VwBF0JIAt Qn7xXEFjqI0kVQvXMQs5tyFmmIVeObbquZMBQyA+N95oywY0BmEdiam+Vse0OR4rlk0z4N2HmXX KLzGURdzcg= X-Received: by 2002:a05:600c:6990:b0:483:6a8d:b2f9 with SMTP id 5b1f17b1804b1-483a95aa328mr247738895e9.5.1771993213936; Tue, 24 Feb 2026 20:20:13 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Stefan Hajnoczi , Pierrick Bouvier , qemu-devel@nongnu.org Cc: Paolo Bonzini , BALATON Zoltan , Jason Wang , Stefano Garzarella , Fam Zheng , Hanna Reitz , Kevin Wolf , "Michael S. Tsirkin" , Christian Schoenebeck , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-block@nongnu.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Greg Kurz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 3/6] hw/virtio: Inline virtio_access_is_big_endian() Date: Wed, 25 Feb 2026 05:19:44 +0100 Message-ID: <20260225041948.52929-4-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260225041948.52929-1-philmd@linaro.org> References: <20260225041948.52929-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.google.com 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @linaro.org) X-ZM-MESSAGEID: 1771993263395158500 From: Pierrick Bouvier Signed-off-by: Pierrick Bouvier Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Stefan Hajnoczi Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- include/hw/virtio/virtio-access.h | 29 ++++++++++++----------------- hw/virtio/virtio.c | 4 ++-- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/include/hw/virtio/virtio-access.h b/include/hw/virtio/virtio-a= ccess.h index e3148c23881..506be642c9f 100644 --- a/include/hw/virtio/virtio-access.h +++ b/include/hw/virtio/virtio-access.h @@ -21,14 +21,9 @@ #include "hw/virtio/virtio.h" #include "hw/virtio/virtio-bus.h" =20 -static inline bool virtio_access_is_big_endian(VirtIODevice *vdev) -{ - return virtio_vdev_is_big_endian(vdev); -} - static inline void virtio_stw_p(VirtIODevice *vdev, void *ptr, uint16_t v) { - if (virtio_access_is_big_endian(vdev)) { + if (virtio_vdev_is_big_endian(vdev)) { stw_be_p(ptr, v); } else { stw_le_p(ptr, v); @@ -37,7 +32,7 @@ static inline void virtio_stw_p(VirtIODevice *vdev, void = *ptr, uint16_t v) =20 static inline void virtio_stl_p(VirtIODevice *vdev, void *ptr, uint32_t v) { - if (virtio_access_is_big_endian(vdev)) { + if (virtio_vdev_is_big_endian(vdev)) { stl_be_p(ptr, v); } else { stl_le_p(ptr, v); @@ -46,7 +41,7 @@ static inline void virtio_stl_p(VirtIODevice *vdev, void = *ptr, uint32_t v) =20 static inline void virtio_stq_p(VirtIODevice *vdev, void *ptr, uint64_t v) { - if (virtio_access_is_big_endian(vdev)) { + if (virtio_vdev_is_big_endian(vdev)) { stq_be_p(ptr, v); } else { stq_le_p(ptr, v); @@ -55,7 +50,7 @@ static inline void virtio_stq_p(VirtIODevice *vdev, void = *ptr, uint64_t v) =20 static inline int virtio_lduw_p(VirtIODevice *vdev, const void *ptr) { - if (virtio_access_is_big_endian(vdev)) { + if (virtio_vdev_is_big_endian(vdev)) { return lduw_be_p(ptr); } else { return lduw_le_p(ptr); @@ -64,7 +59,7 @@ static inline int virtio_lduw_p(VirtIODevice *vdev, const= void *ptr) =20 static inline int virtio_ldl_p(VirtIODevice *vdev, const void *ptr) { - if (virtio_access_is_big_endian(vdev)) { + if (virtio_vdev_is_big_endian(vdev)) { return ldl_be_p(ptr); } else { return ldl_le_p(ptr); @@ -73,7 +68,7 @@ static inline int virtio_ldl_p(VirtIODevice *vdev, const = void *ptr) =20 static inline uint64_t virtio_ldq_p(VirtIODevice *vdev, const void *ptr) { - if (virtio_access_is_big_endian(vdev)) { + if (virtio_vdev_is_big_endian(vdev)) { return ldq_be_p(ptr); } else { return ldq_le_p(ptr); @@ -83,9 +78,9 @@ static inline uint64_t virtio_ldq_p(VirtIODevice *vdev, c= onst void *ptr) static inline uint16_t virtio_tswap16(VirtIODevice *vdev, uint16_t s) { #if HOST_BIG_ENDIAN - return virtio_access_is_big_endian(vdev) ? s : bswap16(s); + return virtio_vdev_is_big_endian(vdev) ? s : bswap16(s); #else - return virtio_access_is_big_endian(vdev) ? bswap16(s) : s; + return virtio_vdev_is_big_endian(vdev) ? bswap16(s) : s; #endif } =20 @@ -97,9 +92,9 @@ static inline void virtio_tswap16s(VirtIODevice *vdev, ui= nt16_t *s) static inline uint32_t virtio_tswap32(VirtIODevice *vdev, uint32_t s) { #if HOST_BIG_ENDIAN - return virtio_access_is_big_endian(vdev) ? s : bswap32(s); + return virtio_vdev_is_big_endian(vdev) ? s : bswap32(s); #else - return virtio_access_is_big_endian(vdev) ? bswap32(s) : s; + return virtio_vdev_is_big_endian(vdev) ? bswap32(s) : s; #endif } =20 @@ -111,9 +106,9 @@ static inline void virtio_tswap32s(VirtIODevice *vdev, = uint32_t *s) static inline uint64_t virtio_tswap64(VirtIODevice *vdev, uint64_t s) { #if HOST_BIG_ENDIAN - return virtio_access_is_big_endian(vdev) ? s : bswap64(s); + return virtio_vdev_is_big_endian(vdev) ? s : bswap64(s); #else - return virtio_access_is_big_endian(vdev) ? bswap64(s) : s; + return virtio_vdev_is_big_endian(vdev) ? bswap64(s) : s; #endif } =20 diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index c0c4599b586..22d798e6cdd 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -222,7 +222,7 @@ static inline uint16_t virtio_lduw_phys_cached(VirtIODe= vice *vdev, MemoryRegionCache *cache, hwaddr pa) { - if (virtio_access_is_big_endian(vdev)) { + if (virtio_vdev_is_big_endian(vdev)) { return lduw_be_phys_cached(cache, pa); } return lduw_le_phys_cached(cache, pa); @@ -232,7 +232,7 @@ static inline void virtio_stw_phys_cached(VirtIODevice = *vdev, MemoryRegionCache *cache, hwaddr pa, uint16_t value) { - if (virtio_access_is_big_endian(vdev)) { + if (virtio_vdev_is_big_endian(vdev)) { stw_be_phys_cached(cache, pa, value); } else { stw_le_phys_cached(cache, pa, value); --=20 2.52.0 From nobody Sun Apr 12 05:51:25 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1771993285; cv=none; d=zohomail.com; s=zohoarc; b=fO9/gWGwOzpChOaKAxIGtXa6kG2NFwLfH3JNrOvs4Sdy3A3khujkK3ByxqATpWt6i5T7LuiOi97phdiNHthe+/MueIfnVkM4sI5h6yPIRFeVY8mVgVEbs0uPvAoH7m+gsbD3/IP8/9umVRLQ+Dia/kLntGT8q6FFxd3CjkZd+AI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771993285; h=Content-Type: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=k79VTLfU5Oa87plgJB989pAwTzMW5t41mAFF8XhFDE4=; b=fJFmm5zvaYVwWzwhuK40sESn/Ix2/+4iKkc877R/uflTYseqc62Jc6HadSG3IUWhZP8Z1uR7A8A8/ZQRlFH7A+AmHzf4ySr2UyQfb9Aq5wmCIy+gHBZVHPiWZC8sIIOOlKwQ2wkDatzpeNQsq9Rmh9ehZTKRcKs+Spd0WNwUOko= 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 1771993285568458.2486755018331; Tue, 24 Feb 2026 20:21:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vv6Nu-0005iZ-AY; Tue, 24 Feb 2026 23:20:26 -0500 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 1vv6Ns-0005fD-NB for qemu-devel@nongnu.org; Tue, 24 Feb 2026 23:20:25 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vv6Nq-0004va-Uy for qemu-devel@nongnu.org; Tue, 24 Feb 2026 23:20:24 -0500 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-4398ebdf520so197916f8f.0 for ; Tue, 24 Feb 2026 20:20:22 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43970c09897sm31982953f8f.17.2026.02.24.20.20.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 24 Feb 2026 20:20:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1771993221; x=1772598021; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=k79VTLfU5Oa87plgJB989pAwTzMW5t41mAFF8XhFDE4=; b=wk7ploge/aBXI353DpltErVG3bvu8FKUnZ/9Bj8F/YHhjuvd1+kaI2gAX3EwTPQFB/ 6FvSQ4Sv2S0DN3PhEcyg1CL2hL7KhONZclZXquW6nU0oM6MglOUJfqMKNRGQ1ALP8s0i wYn4NtmBUTS4ufLa0rTHucSGFmwCr4apHgkgqVFFDA5HfEXvDtV2DwwWVCrQefiwzlnH 1Ixd5cf3FFdIwLCMhR/NjDgCpRUZDw8hnUjsIEkoTAU5zpMKAvjsK3y0Oi+/jaL88SyJ siRYRATzrGLzRfmcI/W+i0Hc9uRzX/J4Dge6jNvuzU4fy9JGCJixVFduEZlZV7YNRKIq FOqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771993221; x=1772598021; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=k79VTLfU5Oa87plgJB989pAwTzMW5t41mAFF8XhFDE4=; b=bnp7jwl5b/oZhzla7t8SUuj9XHfpIdcg/sDy+N36xDVzR2xeOYxVr3WSarIcXd6E3M WYfFtZCqSpw0W95VppriRwxQvXZ4TrxTDOU448pbPi7ojBrUPYotaaMwqC3tHjPXMhoS dn52Im33BjC5ARHuyDYhJsk85ugDqmxmnmxMy7nkNrmCkyPnY3S8wgT82MnHvVQKO6TN oomrpkydKcKFiWs1SC8g17AuEBZK/UD6SCvEwWdd655J7Xob66eM7ovWFs3k2/1n/+o4 PEFzg7sK1qelsSZsNMxRs20iolZBCzn5UhvBPPV7/pi7CUFNDKQooCC8LyuiPa4Z7F+2 TZ3g== X-Forwarded-Encrypted: i=1; AJvYcCV4gJMkczZ+mAzY9szIBzay7WBC4Z2jSdKu/4lETfGNYbRMjOfsJtetNAl9mmI2uYtbfiGapwjjhUhl@nongnu.org X-Gm-Message-State: AOJu0Yx1TDp2saCU3mJN/TQy3Q765aP9j0IVtb9gZC0Ur/Qi0SODX7sQ WxjXHpFvW7qSxoU0xER2dpRb+8wR/XP2dEoq5kIrhSRmGFYC8AUqNjotfsh2Yost2ik= X-Gm-Gg: ATEYQzxDstg2iLvuyWUj4aVloFia1Sr6EFOe2iesHFWPhVksAJFnkHertE4XmPwnhYo AMQ1qnmkQTpFO5Wx7lvPHT+P/7NjLb4q49upHWv6Y/PC3ue9EuI5V89PfTqQZ6zmCUvAWcO9TRM 7XPyEumLYzAH//dHBWJjvLIyh4tMSjjWRemqEikn7q45POOdu1fYypUe/Bhz6OnzapDb5i3l4KJ 6NpA/l2ADoNs420djIyln29YsaaD2x4eZ7HeAWT3Tc8VrYcMhbc25bwPqV+RtfhNxd2CW74r81+ K0Hs6Rx72fcbJzwKrEOgvpnZb3o+D14j1cwOz9Xheh7eqWU63QYOvnNIPrGD9+x+RwWDeU1cBG2 fHu595YT5Ic3v48wdxcHtQm23G6XTckcNxLkosHWpodOHWN09E7oJCM7hAo7MLvJUx9v3wTdZsH DdEFgqVwDvwQE9e+N5dF+D6A6s8Zmo+P0tSNzjQRqEFk42OJbOVXBo7T2aOkom/QTiO/jqzryO X-Received: by 2002:a05:600c:530d:b0:483:78e7:ce15 with SMTP id 5b1f17b1804b1-483bd76b9e1mr33624425e9.13.1771993221119; Tue, 24 Feb 2026 20:20:21 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Stefan Hajnoczi , Pierrick Bouvier , qemu-devel@nongnu.org Cc: Paolo Bonzini , BALATON Zoltan , Jason Wang , Stefano Garzarella , Fam Zheng , Hanna Reitz , Kevin Wolf , "Michael S. Tsirkin" , Christian Schoenebeck , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-block@nongnu.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Greg Kurz , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 4/6] hw/virtio/vhost-user: make compilation unit common Date: Wed, 25 Feb 2026 05:19:45 +0100 Message-ID: <20260225041948.52929-5-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260225041948.52929-1-philmd@linaro.org> References: <20260225041948.52929-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.google.com 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @linaro.org) X-ZM-MESSAGEID: 1771993287446158500 From: Pierrick Bouvier PPC architectures use a custom value for VHOST_USER_MAX_RAM_SLOTS (32 instead of 512). vhost_user struct and several functions use VHOST_USER_MAX_RAM_SLOTS to define stack allocated buffers. To avoid changing all functions to use heap allocated buffers, we keep this max, and simply add a target_base_ppc() conditional for the single place where size really matters. Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/virtio/vhost-user.c | 11 ++++------- hw/virtio/meson.build | 3 +-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index bb8f8eab77e..a8907cca74e 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -44,13 +44,8 @@ #define VHOST_USER_F_PROTOCOL_FEATURES 30 #define VHOST_USER_BACKEND_MAX_FDS 8 =20 -#if defined(TARGET_PPC) || defined(TARGET_PPC64) -#include "hw/ppc/spapr.h" -#define VHOST_USER_MAX_RAM_SLOTS SPAPR_MAX_RAM_SLOTS - -#else +#include "hw/ppc/spapr_common.h" #define VHOST_USER_MAX_RAM_SLOTS 512 -#endif =20 /* * Maximum size of virtio device config space @@ -2287,7 +2282,9 @@ static int vhost_user_backend_init(struct vhost_dev *= dev, void *opaque, return -EINVAL; } =20 - u->user->memory_slots =3D MIN(ram_slots, VHOST_USER_MAX_RAM_SL= OTS); + const uint64_t vhost_user_max_ram_slots =3D target_base_ppc() ? + SPAPR_MAX_RAM_SLOTS : VHOST_USER_MAX_RAM_SLOTS; + u->user->memory_slots =3D MIN(ram_slots, vhost_user_max_ram_sl= ots); } } =20 diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build index 3af34ef9321..4cc8c208a45 100644 --- a/hw/virtio/meson.build +++ b/hw/virtio/meson.build @@ -17,8 +17,7 @@ if have_vhost system_virtio_ss.add(files('vhost.c')) system_virtio_ss.add(files('vhost-backend.c', 'vhost-iova-tree.c')) if have_vhost_user - # fixme - this really should be generic - specific_virtio_ss.add(files('vhost-user.c')) + system_virtio_ss.add(files('vhost-user.c')) system_virtio_ss.add(files('vhost-user-base.c')) =20 # MMIO Stubs --=20 2.52.0 From nobody Sun Apr 12 05:51:25 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1771993275; cv=none; d=zohomail.com; s=zohoarc; b=iaGAYTepmOpbr3WGP1Ej2SOtA8rl+MbPEKFJKjQOF/Wbhw9GONhAFkJcqwlxh148YdMyjNu4NQXQJbYXmed91tem5F8jq4XOnYtmMH3/u+YpjqYWQEeQSgCJ7pgSuKlsMdmBGnNCSDUSUyReryBhy6FeaivPSl9OkDjzIfGx3bs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771993275; h=Content-Type: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=uX1FPeHuwfIRyCOFhrMGA3zM+5rnndDVpp29DXM8wPk=; b=AhD05rZviKJBWJAiBXbkmrjGENxBfPiru5QMmsOS1GnjYdil4xZ0qvqkewv9DIht8M42eGc8VYrIjVYwQ2MbR3tiUQwiG7Xxk8e+PGVsM1f4u5p7fZpajUHknE/HI1fV+PssKXaIjqG0ZrFytT4StHGYQJf1hEp+dUbWvQolxzg= 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 177199327552980.88729606673678; Tue, 24 Feb 2026 20:21:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vv6O4-00063O-9O; Tue, 24 Feb 2026 23:20:36 -0500 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 1vv6O0-0005sj-Ma for qemu-devel@nongnu.org; Tue, 24 Feb 2026 23:20:33 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vv6Ny-0004xq-8B for qemu-devel@nongnu.org; Tue, 24 Feb 2026 23:20:32 -0500 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-43767807cf3so4621659f8f.1 for ; Tue, 24 Feb 2026 20:20:29 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43970c00768sm29950682f8f.10.2026.02.24.20.20.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 24 Feb 2026 20:20:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1771993229; x=1772598029; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uX1FPeHuwfIRyCOFhrMGA3zM+5rnndDVpp29DXM8wPk=; b=eQU7HelrH249M6ZAD4pf6W0aNPmHK20t4uNp70weiVlVjhUANR51uzwMzcCtLvA4Vv CcE++WjkqYNAH8wKPGwLKGSzNU45nORMCnkkrNUjROxCzDMWH0Qq+2DgHiFa5AylHpxE pskjl2l5dYDdzZ/ZY8PqIfc2xihyYwxWJydcO404+vI7BUSPvMXGRvkOSIPC8MC6vTBJ U/DOkUfZtjekOmGLsGeJEwVlTciKBz8hwQgJRdy1P4OlATlcgjyDikz95eZGiP/QqTDG 6PaEiXKm9m/crMrk8HzAXngFOoVo2UTUM1sjovvtnNjT8NoGBJpBK+DZ7oOzxSdN/1pZ SwfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771993229; x=1772598029; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=uX1FPeHuwfIRyCOFhrMGA3zM+5rnndDVpp29DXM8wPk=; b=KgKknGjenMoI1clcRysrD+jZzQsSCU4cBGTT1fwzERWcehL8JOZVb3t5IwoivVnhZV eL6GkrUXCD2nzBGZgWIv0iTmaZVuUiBmDxZSiZCReSdLvENHYIqWdxabHS/7fhIrZrk5 Inkr52Ak5hGQ/63Ai6H++rEGVcVpsOGfKVcgXxo+zQnJrqi0iWEU6BTWnzEr14oAbLfM geY/TZUYvxfhilIk1zu8mDvDpw5xVx/9pfoHjh7FWa1d5yMPX8Ta5ufKcjjz0aR9K9Wi QrX43Is+UNEArZT2LCzISXsI3JInV3HVRc13FuckjQRqndXWqV1R5Rvs9IUnMSIMuROh rBIw== X-Forwarded-Encrypted: i=1; AJvYcCXm6zKDohzNbfl9HPWrTFBGUHEe/PxSfFrcoYjgRucTBAI0n9p2JG79nJRvwOQbiXfJOfren+Wf7CV7@nongnu.org X-Gm-Message-State: AOJu0Yzv/B1UUViX+sb5TPAWjCV8W8fgssQHD/n4WVXMS/Dk6/nDVDdK vWlj2qcJfCEB1mPvjVm1eLd2OQMVabLP+l9ciEy4HVSKDN9O9TMbRvHsGUGePv293nY= X-Gm-Gg: ATEYQzzCZYupgmdT2YWsii62ugEZCqIYh7lJTcKR5PDv3U+lxn5e9ahCdjp1gz3qVwj uzaZ2av083gFNId27aIad2TMFZYOjzaIVNF2ZdlmC6xjLFNE1Aqwy1VTZDQfh6vWIDq6RlhlGTA 0Mg9utnohafSKWbOtW88eqX7EflzyB9DX9f4eKnU+jZKjcFkB4XQOvPtA9nmrUMgPVVLgNYvr2p N4C4iyYbM5jDoi836nwbs0DVlgBTSXoCivEqtsiiP9i2ahBDQr0QkbDTvingr9HWVsdM7dSnjzD X95mawpExXow2fMHT4AFV93/OFFrtPErCdh0f88m1FGTxD9GA4GWbW9wYZfuCh4kVqp07aAvrrg AsaOlybL5Q95NoBdAvXxyOWGY+0HRZE8BDB3AJaAdAfRQS7jjzhZe7KNoO5LDSvrJU9+7b1mvm0 +mh8mCcTh2zOmbHiGeGO6OuvUUMnU69lk30VO5NMrytOhBlOxzwNh1WtobbZ3pYXTos4qJ05zU X-Received: by 2002:a5d:5f83:0:b0:439:8580:18e with SMTP id ffacd0b85a97d-4398fb3b6f6mr1239976f8f.55.1771993228651; Tue, 24 Feb 2026 20:20:28 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Stefan Hajnoczi , Pierrick Bouvier , qemu-devel@nongnu.org Cc: Paolo Bonzini , BALATON Zoltan , Jason Wang , Stefano Garzarella , Fam Zheng , Hanna Reitz , Kevin Wolf , "Michael S. Tsirkin" , Christian Schoenebeck , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-block@nongnu.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Greg Kurz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 5/6] hw/virtio/virtio-qmp: make compilation unit common Date: Wed, 25 Feb 2026 05:19:46 +0100 Message-ID: <20260225041948.52929-6-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260225041948.52929-1-philmd@linaro.org> References: <20260225041948.52929-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::435; envelope-from=philmd@linaro.org; helo=mail-wr1-x435.google.com 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, RCVD_IN_DNSWL_NONE=-0.0001, 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: qemu development 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 @linaro.org) X-ZM-MESSAGEID: 1771993277579158500 From: Pierrick Bouvier All compile time conditionals have no impact at runtime, since they are representing only possible features for devices present at runtime. In case they are not present, associated features table will never be used. In case they are present but some features are not, matching bits will never be enabled, so those entries will be unused. Thus, simply expose everything and call it a day. Signed-off-by: Pierrick Bouvier Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- hw/virtio/virtio-qmp.c | 70 ------------------------------------------ hw/virtio/meson.build | 2 +- 2 files changed, 1 insertion(+), 71 deletions(-) diff --git a/hw/virtio/virtio-qmp.c b/hw/virtio/virtio-qmp.c index 968299fda0c..f9cdca50d99 100644 --- a/hw/virtio/virtio-qmp.c +++ b/hw/virtio/virtio-qmp.c @@ -33,21 +33,17 @@ #include "standard-headers/linux/virtio_vsock.h" #include "standard-headers/linux/virtio_gpio.h" =20 -#include CONFIG_DEVICES - #define FEATURE_ENTRY(name, desc) (qmp_virtio_feature_map_t) \ { .virtio_bit =3D name, .feature_desc =3D desc } =20 /* Virtio transport features mapping */ static const qmp_virtio_feature_map_t virtio_transport_map[] =3D { /* Virtio device transport features */ -#ifndef VIRTIO_CONFIG_NO_LEGACY FEATURE_ENTRY(VIRTIO_F_NOTIFY_ON_EMPTY, \ "VIRTIO_F_NOTIFY_ON_EMPTY: Notify when device runs out of avai= l. " "descs. on VQ"), FEATURE_ENTRY(VIRTIO_F_ANY_LAYOUT, \ "VIRTIO_F_ANY_LAYOUT: Device accepts arbitrary desc. layouts"), -#endif /* !VIRTIO_CONFIG_NO_LEGACY */ FEATURE_ENTRY(VIRTIO_F_VERSION_1, \ "VIRTIO_F_VERSION_1: Device compliant for v1 spec (legacy)"), FEATURE_ENTRY(VIRTIO_F_IOMMU_PLATFORM, \ @@ -149,7 +145,6 @@ static const qmp_virtio_feature_map_t virtio_config_sta= tus_map[] =3D { }; =20 /* virtio-blk features mapping */ -#ifdef CONFIG_VIRTIO_BLK static const qmp_virtio_feature_map_t virtio_blk_feature_map[] =3D { FEATURE_ENTRY(VIRTIO_BLK_F_SIZE_MAX, \ "VIRTIO_BLK_F_SIZE_MAX: Max segment size is size_max"), @@ -173,7 +168,6 @@ static const qmp_virtio_feature_map_t virtio_blk_featur= e_map[] =3D { "VIRTIO_BLK_F_SECURE_ERASE: Secure erase supported"), FEATURE_ENTRY(VIRTIO_BLK_F_ZONED, \ "VIRTIO_BLK_F_ZONED: Zoned block devices"), -#ifndef VIRTIO_BLK_NO_LEGACY FEATURE_ENTRY(VIRTIO_BLK_F_BARRIER, \ "VIRTIO_BLK_F_BARRIER: Request barriers supported"), FEATURE_ENTRY(VIRTIO_BLK_F_SCSI, \ @@ -183,7 +177,6 @@ static const qmp_virtio_feature_map_t virtio_blk_featur= e_map[] =3D { FEATURE_ENTRY(VIRTIO_BLK_F_CONFIG_WCE, \ "VIRTIO_BLK_F_CONFIG_WCE: Cache writeback and writethrough mod= es " "supported"), -#endif /* !VIRTIO_BLK_NO_LEGACY */ FEATURE_ENTRY(VHOST_F_LOG_ALL, \ "VHOST_F_LOG_ALL: Logging write descriptors supported"), FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \ @@ -191,10 +184,8 @@ static const qmp_virtio_feature_map_t virtio_blk_featu= re_map[] =3D { "negotiation supported"), { -1, "" } }; -#endif =20 /* virtio-serial features mapping */ -#ifdef CONFIG_VIRTIO_SERIAL static const qmp_virtio_feature_map_t virtio_serial_feature_map[] =3D { FEATURE_ENTRY(VIRTIO_CONSOLE_F_SIZE, \ "VIRTIO_CONSOLE_F_SIZE: Host providing console size"), @@ -204,10 +195,8 @@ static const qmp_virtio_feature_map_t virtio_serial_fe= ature_map[] =3D { "VIRTIO_CONSOLE_F_EMERG_WRITE: Emergency write supported"), { -1, "" } }; -#endif =20 /* virtio-gpu features mapping */ -#ifdef CONFIG_VIRTIO_GPU static const qmp_virtio_feature_map_t virtio_gpu_feature_map[] =3D { FEATURE_ENTRY(VIRTIO_GPU_F_VIRGL, \ "VIRTIO_GPU_F_VIRGL: Virgl 3D mode supported"), @@ -227,10 +216,8 @@ static const qmp_virtio_feature_map_t virtio_gpu_featu= re_map[] =3D { "negotiation supported"), { -1, "" } }; -#endif =20 /* virtio-input features mapping */ -#ifdef CONFIG_VIRTIO_INPUT static const qmp_virtio_feature_map_t virtio_input_feature_map[] =3D { FEATURE_ENTRY(VHOST_F_LOG_ALL, \ "VHOST_F_LOG_ALL: Logging write descriptors supported"), @@ -239,10 +226,8 @@ static const qmp_virtio_feature_map_t virtio_input_fea= ture_map[] =3D { "negotiation supported"), { -1, "" } }; -#endif =20 /* virtio-net features mapping */ -#ifdef CONFIG_VIRTIO_NET static const qmp_virtio_feature_map_t virtio_net_feature_map[] =3D { FEATURE_ENTRY(VIRTIO_NET_F_CSUM, \ "VIRTIO_NET_F_CSUM: Device handling packets with partial check= sum " @@ -313,10 +298,8 @@ static const qmp_virtio_feature_map_t virtio_net_featu= re_map[] =3D { "device with same MAC addr. supported"), FEATURE_ENTRY(VIRTIO_NET_F_SPEED_DUPLEX, \ "VIRTIO_NET_F_SPEED_DUPLEX: Device set linkspeed and duplex"), -#ifndef VIRTIO_NET_NO_LEGACY FEATURE_ENTRY(VIRTIO_NET_F_GSO, \ "VIRTIO_NET_F_GSO: Handling GSO-type packets supported"), -#endif /* !VIRTIO_NET_NO_LEGACY */ FEATURE_ENTRY(VHOST_NET_F_VIRTIO_NET_HDR, \ "VHOST_NET_F_VIRTIO_NET_HDR: Virtio-net headers for RX and TX " "packets supported"), @@ -341,10 +324,8 @@ static const qmp_virtio_feature_map_t virtio_net_featu= re_map[] =3D { "header"), { -1, "" } }; -#endif =20 /* virtio-scsi features mapping */ -#ifdef CONFIG_VIRTIO_SCSI static const qmp_virtio_feature_map_t virtio_scsi_feature_map[] =3D { FEATURE_ENTRY(VIRTIO_SCSI_F_INOUT, \ "VIRTIO_SCSI_F_INOUT: Requests including read and writable dat= a " @@ -364,10 +345,8 @@ static const qmp_virtio_feature_map_t virtio_scsi_feat= ure_map[] =3D { "negotiation supported"), { -1, "" } }; -#endif =20 /* virtio/vhost-user-fs features mapping */ -#ifdef CONFIG_VHOST_USER_FS static const qmp_virtio_feature_map_t virtio_fs_feature_map[] =3D { FEATURE_ENTRY(VHOST_F_LOG_ALL, \ "VHOST_F_LOG_ALL: Logging write descriptors supported"), @@ -376,10 +355,8 @@ static const qmp_virtio_feature_map_t virtio_fs_featur= e_map[] =3D { "negotiation supported"), { -1, "" } }; -#endif =20 /* virtio/vhost-user-i2c features mapping */ -#ifdef CONFIG_VIRTIO_I2C_ADAPTER static const qmp_virtio_feature_map_t virtio_i2c_feature_map[] =3D { FEATURE_ENTRY(VIRTIO_I2C_F_ZERO_LENGTH_REQUEST, \ "VIRTIO_I2C_F_ZERO_LEGNTH_REQUEST: Zero length requests suppor= ted"), @@ -390,10 +367,8 @@ static const qmp_virtio_feature_map_t virtio_i2c_featu= re_map[] =3D { "negotiation supported"), { -1, "" } }; -#endif =20 /* virtio/vhost-vsock features mapping */ -#ifdef CONFIG_VHOST_VSOCK static const qmp_virtio_feature_map_t virtio_vsock_feature_map[] =3D { FEATURE_ENTRY(VIRTIO_VSOCK_F_SEQPACKET, \ "VIRTIO_VSOCK_F_SEQPACKET: SOCK_SEQPACKET supported"), @@ -404,10 +379,8 @@ static const qmp_virtio_feature_map_t virtio_vsock_fea= ture_map[] =3D { "negotiation supported"), { -1, "" } }; -#endif =20 /* virtio-balloon features mapping */ -#ifdef CONFIG_VIRTIO_BALLOON static const qmp_virtio_feature_map_t virtio_balloon_feature_map[] =3D { FEATURE_ENTRY(VIRTIO_BALLOON_F_MUST_TELL_HOST, \ "VIRTIO_BALLOON_F_MUST_TELL_HOST: Tell host before reclaiming " @@ -424,19 +397,15 @@ static const qmp_virtio_feature_map_t virtio_balloon_= feature_map[] =3D { "VIRTIO_BALLOON_F_REPORTING: Page reporting VQ enabled"), { -1, "" } }; -#endif =20 /* virtio-crypto features mapping */ -#ifdef CONFIG_VIRTIO_CRYPTO static const qmp_virtio_feature_map_t virtio_crypto_feature_map[] =3D { FEATURE_ENTRY(VHOST_F_LOG_ALL, \ "VHOST_F_LOG_ALL: Logging write descriptors supported"), { -1, "" } }; -#endif =20 /* virtio-iommu features mapping */ -#ifdef CONFIG_VIRTIO_IOMMU static const qmp_virtio_feature_map_t virtio_iommu_feature_map[] =3D { FEATURE_ENTRY(VIRTIO_IOMMU_F_INPUT_RANGE, \ "VIRTIO_IOMMU_F_INPUT_RANGE: Range of available virtual addrs.= " @@ -458,15 +427,11 @@ static const qmp_virtio_feature_map_t virtio_iommu_fe= ature_map[] =3D { "available"), { -1, "" } }; -#endif =20 /* virtio-mem features mapping */ -#ifdef CONFIG_VIRTIO_MEM static const qmp_virtio_feature_map_t virtio_mem_feature_map[] =3D { -#ifndef CONFIG_ACPI FEATURE_ENTRY(VIRTIO_MEM_F_ACPI_PXM, \ "VIRTIO_MEM_F_ACPI_PXM: node_id is an ACPI PXM and is valid"), -#endif /* !CONFIG_ACPI */ FEATURE_ENTRY(VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE, \ "VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE: Unplugged memory cannot = be " "accessed"), @@ -475,10 +440,8 @@ static const qmp_virtio_feature_map_t virtio_mem_featu= re_map[] =3D { "plugged when suspending+resuming"), { -1, "" } }; -#endif =20 /* virtio-rng features mapping */ -#ifdef CONFIG_VIRTIO_RNG static const qmp_virtio_feature_map_t virtio_rng_feature_map[] =3D { FEATURE_ENTRY(VHOST_F_LOG_ALL, \ "VHOST_F_LOG_ALL: Logging write descriptors supported"), @@ -487,10 +450,8 @@ static const qmp_virtio_feature_map_t virtio_rng_featu= re_map[] =3D { "negotiation supported"), { -1, "" } }; -#endif =20 /* virtio/vhost-gpio features mapping */ -#ifdef CONFIG_VHOST_USER_GPIO static const qmp_virtio_feature_map_t virtio_gpio_feature_map[] =3D { FEATURE_ENTRY(VIRTIO_GPIO_F_IRQ, \ "VIRTIO_GPIO_F_IRQ: Device supports interrupts on GPIO lines"), @@ -499,7 +460,6 @@ static const qmp_virtio_feature_map_t virtio_gpio_featu= re_map[] =3D { "negotiation supported"), { -1, "" } }; -#endif =20 #define CONVERT_FEATURES(type, map, is_status, bitmap) \ ({ \ @@ -595,96 +555,66 @@ VirtioDeviceFeatures *qmp_decode_features(uint16_t de= vice_id, =20 /* device features */ switch (device_id) { -#ifdef CONFIG_VIRTIO_SERIAL case VIRTIO_ID_CONSOLE: features->dev_features =3D CONVERT_FEATURES_EX(strList, virtio_serial_feature_map, bitmap= ); break; -#endif -#ifdef CONFIG_VIRTIO_BLK case VIRTIO_ID_BLOCK: features->dev_features =3D CONVERT_FEATURES_EX(strList, virtio_blk_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VIRTIO_GPU case VIRTIO_ID_GPU: features->dev_features =3D CONVERT_FEATURES_EX(strList, virtio_gpu_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VIRTIO_NET case VIRTIO_ID_NET: features->dev_features =3D CONVERT_FEATURES_EX(strList, virtio_net_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VIRTIO_SCSI case VIRTIO_ID_SCSI: features->dev_features =3D CONVERT_FEATURES_EX(strList, virtio_scsi_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VIRTIO_BALLOON case VIRTIO_ID_BALLOON: features->dev_features =3D CONVERT_FEATURES_EX(strList, virtio_balloon_feature_map, bitma= p); break; -#endif -#ifdef CONFIG_VIRTIO_IOMMU case VIRTIO_ID_IOMMU: features->dev_features =3D CONVERT_FEATURES_EX(strList, virtio_iommu_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VIRTIO_INPUT case VIRTIO_ID_INPUT: features->dev_features =3D CONVERT_FEATURES_EX(strList, virtio_input_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VHOST_USER_FS case VIRTIO_ID_FS: features->dev_features =3D CONVERT_FEATURES_EX(strList, virtio_fs_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VHOST_VSOCK case VIRTIO_ID_VSOCK: features->dev_features =3D CONVERT_FEATURES_EX(strList, virtio_vsock_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VIRTIO_CRYPTO case VIRTIO_ID_CRYPTO: features->dev_features =3D CONVERT_FEATURES_EX(strList, virtio_crypto_feature_map, bitmap= ); break; -#endif -#ifdef CONFIG_VIRTIO_MEM case VIRTIO_ID_MEM: features->dev_features =3D CONVERT_FEATURES_EX(strList, virtio_mem_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VIRTIO_I2C_ADAPTER case VIRTIO_ID_I2C_ADAPTER: features->dev_features =3D CONVERT_FEATURES_EX(strList, virtio_i2c_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VIRTIO_RNG case VIRTIO_ID_RNG: features->dev_features =3D CONVERT_FEATURES_EX(strList, virtio_rng_feature_map, bitmap); break; -#endif -#ifdef CONFIG_VHOST_USER_GPIO case VIRTIO_ID_GPIO: features->dev_features =3D CONVERT_FEATURES_EX(strList, virtio_gpio_feature_map, bitmap); break; -#endif /* No features */ case VIRTIO_ID_9P: case VIRTIO_ID_PMEM: diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build index 4cc8c208a45..08872ba68b4 100644 --- a/hw/virtio/meson.build +++ b/hw/virtio/meson.build @@ -11,7 +11,7 @@ system_virtio_ss.add(when: 'CONFIG_VHOST_VDPA_DEV', if_tr= ue: files('vdpa-dev.c') =20 specific_virtio_ss =3D ss.source_set() specific_virtio_ss.add(files('virtio.c')) -specific_virtio_ss.add(files('virtio-qmp.c')) +system_virtio_ss.add(files('virtio-qmp.c')) =20 if have_vhost system_virtio_ss.add(files('vhost.c')) --=20 2.52.0 From nobody Sun Apr 12 05:51:25 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1771993265; cv=none; d=zohomail.com; s=zohoarc; b=dEFZE/T/OmO8dmvSeXsm26WRxHYsRrSQn+OpnM6usd6WpmK5eXPUbhI7MY/4EBey+tLQrsnlZa2dfSnGyHXYNALPlFfxOh98MvrXJQPHbewD652c79scXqwJ/jpM6aQDIyIiPnFZsAD/FnIni5EimHBtIsqMNySRnwVuUXqoBZA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771993265; h=Content-Type: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=24jaYt0AJT36PqAdhuaefwmGKsMoTDVGvqSIw9dSfEM=; b=KfbBrI8Y695wEvSAWmzpw4ffxDx0YY2pnWMwto63jn8t0fSakVljoNdKKnK+QyyYi+y6Yq0IvKS10tAjclEhh8VfSzBr4zAUJJOmsBpz7LyJKlA/XkT0FAghW1g5saJ3W1Z4/gY9rpvhheqlmbOoOkovzFEgScpleMn8re3ohNA= 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 1771993265705210.3855183065749; Tue, 24 Feb 2026 20:21:05 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vv6OA-0006J8-3b; Tue, 24 Feb 2026 23:20:42 -0500 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 1vv6O8-0006H7-Gt for qemu-devel@nongnu.org; Tue, 24 Feb 2026 23:20:40 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vv6O6-0004yx-He for qemu-devel@nongnu.org; Tue, 24 Feb 2026 23:20:40 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-48373a4bca3so37829835e9.0 for ; Tue, 24 Feb 2026 20:20:38 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-483bfb2c5a8sm2891815e9.0.2026.02.24.20.20.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 24 Feb 2026 20:20:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1771993237; x=1772598037; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=24jaYt0AJT36PqAdhuaefwmGKsMoTDVGvqSIw9dSfEM=; b=LA/iXa1e6vUIQt8RrycjVip3V0rb5EDIhwLsBOEde1ZvLcBNDOcAjkAHi+4pEZARGk WuaYVJwgnSxwB/D9p0Srb5KSfiHev9md97U9CnvzpR43+CHMP/3cTzfUlN33JzLjsL2E QVVOhBc/pvCp5KSZOI9tnopogWg2kmhCPfJApfoE/xrgTLZjIVu8JMuoS24xJjbvA5m4 VzCZi1Njcfpo49xpunHpgYDeg7sydY/SgSEEvPazeuuUxZfD6ShPIdzOhHQ6OLF+LEOZ 7S/bmLVB2IMfj+vs85/HZXtCaZcv5yJGd/lx6hO8/ZBeTbL7QmreDS1dPk7oh2EiBjhJ 7MJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771993237; x=1772598037; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=24jaYt0AJT36PqAdhuaefwmGKsMoTDVGvqSIw9dSfEM=; b=dbZ+gb8QJrW98VyEHLBsXm4ympPkpANXcZdBG9vDjytwQKjzJVI2a8kWi5h8JG3gq9 BC2MF/j4B5GSu9fZTJRvnx4iNJJCzxGeP7t7iAmZIGdNwJsPeoNaIO2mreTyMPLzAmsa 0+itTlscJguCbBkHIf8YkcXbmQhqPuREq5t0CK46CM8pMMqlSDXGuB9rcwgYTiy/HpvG EyPGWuQOnmAKkHySm9O074Sq0vp20Wjja1viiGBHpeKXiLRwCo2Cln+Fg41lWL6F6tjZ ukvrjeZOgw6I517YtofidJdfwnAwU5sPbgZcoiVBCGwEgZrDVYjPU4iec6myNuy4huQf aHDA== X-Forwarded-Encrypted: i=1; AJvYcCWnTXqVAhAjQ0nSO27m2GM9Ir7pyGf5QWQC+Msanb/mCGxPqF0MfNvFew71gRN1fxbXk9NozFSUmPni@nongnu.org X-Gm-Message-State: AOJu0Yw9oegs8h+MPssJwofAH2b9Hqy+Pwk3nMlh0P6YdoPREH4NTYGX kypbG8fI93LJenpN7TEF14XsjVEt2oqUADfsTCbJL6THuM+Nu54NcVq0pxDfzv5rewM= X-Gm-Gg: ATEYQzyowOwLh8qRGG2sQcgCokI521jRulwRS+kIG+l8I1GtqB9XGnMy6cokbGnJt2a l1KqE4EkgRnhdohitpohv1/PUVs5u++cXPtEaSCscaFMPSdy8Dyv0De6GRG9WRb0fJOc4d7qP+m bGLxnxprd5oAE+y6Yp0ga7mzqMgX9ZF+oSpe0IgJDflssXDfrSTvlG/r2/N769NQpd9kgWWs3cZ C9SE1iHKwFkdFckwoHAL0vbTvUoybN53m0CItym3Aikd+5wcU87Ps3MH8oxfNLY6z7LltSWZ1oe Uqsy14QZAsp+dfi6hl3zZPsx0onCfDKq3PYkdRcUSuqAtTaozowybsjhdRU5UR9uMfXBe9aG/GC EDiuZCmflMR5dbfrctF3aanQ350HAKBO4DxTpJ+LEW/TNNAbe3Ef3IB0cIHbSwP1LOJENP4XjxT nqsSAwPNYZwjK03v0unGcYa/m4U19AE8KSpaNsHwdpt6BCJjG8VGCqrb2dSlSNFMMN1zwylXLx X-Received: by 2002:a05:600c:310f:b0:480:1c53:2085 with SMTP id 5b1f17b1804b1-483bef53d2fmr16251755e9.19.1771993236793; Tue, 24 Feb 2026 20:20:36 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Stefan Hajnoczi , Pierrick Bouvier , qemu-devel@nongnu.org Cc: Paolo Bonzini , BALATON Zoltan , Jason Wang , Stefano Garzarella , Fam Zheng , Hanna Reitz , Kevin Wolf , "Michael S. Tsirkin" , Christian Schoenebeck , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-block@nongnu.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Greg Kurz , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 6/6] hw/virtio/: make all compilation units common Date: Wed, 25 Feb 2026 05:19:47 +0100 Message-ID: <20260225041948.52929-7-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260225041948.52929-1-philmd@linaro.org> References: <20260225041948.52929-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.google.com 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @linaro.org) X-ZM-MESSAGEID: 1771993267442158500 From: Pierrick Bouvier Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/9pfs/meson.build | 2 +- hw/block/meson.build | 4 ++-- hw/char/meson.build | 2 +- hw/net/meson.build | 2 +- hw/scsi/meson.build | 6 ++---- hw/virtio/meson.build | 12 +++++------- 6 files changed, 12 insertions(+), 16 deletions(-) diff --git a/hw/9pfs/meson.build b/hw/9pfs/meson.build index 7f4d6e3a451..91b51af838f 100644 --- a/hw/9pfs/meson.build +++ b/hw/9pfs/meson.build @@ -23,4 +23,4 @@ endif fs_ss.add(when: 'CONFIG_XEN_BUS', if_true: files('xen-9p-backend.c')) system_ss.add_all(when: 'CONFIG_FSDEV_9P', if_true: fs_ss) =20 -specific_ss.add(when: 'CONFIG_VIRTIO_9P', if_true: files('virtio-9p-device= .c')) +system_ss.add(when: 'CONFIG_VIRTIO_9P', if_true: files('virtio-9p-device.c= ')) diff --git a/hw/block/meson.build b/hw/block/meson.build index 43ed296cf47..d646323b82b 100644 --- a/hw/block/meson.build +++ b/hw/block/meson.build @@ -13,9 +13,9 @@ system_ss.add(when: 'CONFIG_SSI_M25P80', if_true: files('= m25p80_sfdp.c')) system_ss.add(when: 'CONFIG_SWIM', if_true: files('swim.c')) system_ss.add(when: 'CONFIG_XEN_BUS', if_true: files('xen-block.c')) =20 -specific_ss.add(when: 'CONFIG_VIRTIO_BLK', if_true: files('virtio-blk.c')) +system_ss.add(when: 'CONFIG_VIRTIO_BLK', if_true: files('virtio-blk.c')) system_ss.add(when: 'CONFIG_VIRTIO_BLK', if_true: files('virtio-blk-common= .c')) -specific_ss.add(when: 'CONFIG_VHOST_USER_BLK', if_true: files('vhost-user-= blk.c')) +system_ss.add(when: 'CONFIG_VHOST_USER_BLK', if_true: files('vhost-user-bl= k.c')) system_ss.add(when: 'CONFIG_VHOST_USER_BLK', if_true: files('virtio-blk-co= mmon.c')) =20 subdir('dataplane') diff --git a/hw/char/meson.build b/hw/char/meson.build index a9e1dc26c0f..fc3d7ee506f 100644 --- a/hw/char/meson.build +++ b/hw/char/meson.build @@ -17,6 +17,7 @@ system_ss.add(when: 'CONFIG_SERIAL_MM', if_true: files('s= erial-mm.c')) system_ss.add(when: 'CONFIG_SERIAL_PCI', if_true: files('serial-pci.c')) system_ss.add(when: 'CONFIG_SERIAL_PCI_MULTI', if_true: files('serial-pci-= multi.c')) system_ss.add(when: 'CONFIG_SHAKTI_UART', if_true: files('shakti_uart.c')) +system_ss.add(when: 'CONFIG_VIRTIO', if_true: files('virtio-serial-bus.c')) system_ss.add(when: 'CONFIG_VIRTIO_SERIAL', if_true: files('virtio-console= .c')) system_ss.add(when: 'CONFIG_XEN_BUS', if_true: files('xen_console.c')) system_ss.add(when: 'CONFIG_XILINX', if_true: files('xilinx_uartlite.c')) @@ -39,5 +40,4 @@ system_ss.add(when: 'CONFIG_HTIF', if_true: files('riscv_= htif.c')) system_ss.add(when: 'CONFIG_GOLDFISH_TTY', if_true: files('goldfish_tty.c'= )) =20 specific_ss.add(when: 'CONFIG_TERMINAL3270', if_true: files('terminal3270.= c')) -specific_ss.add(when: 'CONFIG_VIRTIO', if_true: files('virtio-serial-bus.c= ')) specific_ss.add(when: 'CONFIG_PSERIES', if_true: files('spapr_vty.c')) diff --git a/hw/net/meson.build b/hw/net/meson.build index 4ee09143165..ccfcdfb6526 100644 --- a/hw/net/meson.build +++ b/hw/net/meson.build @@ -46,7 +46,7 @@ specific_ss.add(when: 'CONFIG_PSERIES', if_true: files('s= papr_llan.c')) system_ss.add(when: 'CONFIG_XILINX_ETHLITE', if_true: files('xilinx_ethlit= e.c')) =20 system_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('net_rx_pkt.c')) -specific_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('virtio-net.c')) +system_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('virtio-net.c')) =20 if have_vhost_net system_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('vhost_net.c'), = if_false: files('vhost_net-stub.c')) diff --git a/hw/scsi/meson.build b/hw/scsi/meson.build index b874fe1ecdb..69fde0cf840 100644 --- a/hw/scsi/meson.build +++ b/hw/scsi/meson.build @@ -1,7 +1,6 @@ scsi_ss =3D ss.source_set() specific_scsi_ss =3D ss.source_set() virtio_scsi_ss =3D ss.source_set() -specific_virtio_scsi_ss =3D ss.source_set() =20 scsi_ss.add(files( 'emulation.c', @@ -21,10 +20,9 @@ virtio_scsi_ss.add(files('virtio-scsi-dataplane.c')) virtio_scsi_ss.add(when: 'CONFIG_VHOST_SCSI', if_true: files('vhost-scsi.c= ')) virtio_scsi_ss.add(when: 'CONFIG_VHOST_USER_SCSI', if_true: files('vhost-u= ser-scsi.c')) =20 -specific_virtio_scsi_ss.add(files('virtio-scsi.c')) -specific_virtio_scsi_ss.add(when: 'CONFIG_VHOST_SCSI_COMMON', if_true: fil= es('vhost-scsi-common.c')) +virtio_scsi_ss.add(files('virtio-scsi.c')) +virtio_scsi_ss.add(when: 'CONFIG_VHOST_SCSI_COMMON', if_true: files('vhost= -scsi-common.c')) =20 -specific_scsi_ss.add_all(when: 'CONFIG_VIRTIO_SCSI', if_true: specific_vir= tio_scsi_ss) scsi_ss.add_all(when: 'CONFIG_VIRTIO_SCSI', if_true: virtio_scsi_ss) =20 specific_scsi_ss.add(when: 'CONFIG_SPAPR_VSCSI', if_true: files('spapr_vsc= si.c')) diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build index 08872ba68b4..415e359e9fc 100644 --- a/hw/virtio/meson.build +++ b/hw/virtio/meson.build @@ -9,8 +9,7 @@ system_virtio_ss.add(when: 'CONFIG_VHOST_VSOCK_COMMON', if_= true: files('vhost-vs system_virtio_ss.add(when: 'CONFIG_VIRTIO_IOMMU', if_true: files('virtio-i= ommu.c')) system_virtio_ss.add(when: 'CONFIG_VHOST_VDPA_DEV', if_true: files('vdpa-d= ev.c')) =20 -specific_virtio_ss =3D ss.source_set() -specific_virtio_ss.add(files('virtio.c')) +system_virtio_ss.add(files('virtio.c')) system_virtio_ss.add(files('virtio-qmp.c')) =20 if have_vhost @@ -53,10 +52,10 @@ endif system_virtio_ss.add(when: 'CONFIG_VHOST_USER_VSOCK', if_true: files('vhos= t-user-vsock.c')) system_virtio_ss.add(when: 'CONFIG_VIRTIO_RNG', if_true: files('virtio-rng= .c')) =20 -specific_virtio_ss.add(when: 'CONFIG_VIRTIO_BALLOON', if_true: files('virt= io-balloon.c')) -specific_virtio_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true: files('vhost= -user-fs.c')) -specific_virtio_ss.add(when: 'CONFIG_VIRTIO_PMEM', if_true: files('virtio-= pmem.c')) -specific_virtio_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-v= sock.c')) +system_virtio_ss.add(when: 'CONFIG_VIRTIO_BALLOON', if_true: files('virtio= -balloon.c')) +system_virtio_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true: files('vhost-u= ser-fs.c')) +system_virtio_ss.add(when: 'CONFIG_VIRTIO_PMEM', if_true: files('virtio-pm= em.c')) +system_virtio_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vso= ck.c')) system_virtio_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem= .c')) system_virtio_ss.add(when: 'CONFIG_VIRTIO_NSM', if_true: files('virtio-nsm= .c')) system_virtio_ss.add(when: 'CONFIG_VIRTIO_NSM', if_true: [files('cbor-help= ers.c'), libcbor]) @@ -97,5 +96,4 @@ stub_ss.add(files('virtio-md-stubs.c')) =20 system_ss.add(files('virtio-hmp-cmds.c')) =20 -specific_ss.add_all(when: 'CONFIG_VIRTIO', if_true: specific_virtio_ss) system_ss.add(when: 'CONFIG_ACPI', if_true: files('virtio-acpi.c')) --=20 2.52.0