From nobody Fri Mar 27 02:25:17 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=1772744844; cv=none; d=zohomail.com; s=zohoarc; b=l+QaK/lDi+YTW/v4flkqeVtQTGm5uENKwlqj3JrSb1PoPfNfjwbYSF2OoQKCeZzSQJN+BfkwTBH6n9GaVtEZCXTu5UTTmqA1n7PHimq8Fi8OxZaNTj55vZTvUZlmSrjJQM5Hg3Mua1xecyeomw4B/h9TVy8NE0abCtPrdZJQ+nk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772744844; 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=fjVg4k8L5YS0+fbIU3cK5+QxAukvdu0K3zvehSjPnuA=; b=nuVp+1DvdzhEMKkWAgQ/vnJFCAj7QWCaUIGqrnGUd+DBXJUP7r1MMjk1e9Y4o6XJHL15zbEtBL5p2Mpa5l17KwTB21ltQ7mIRAU3Vg01FesDViBywVGVsXSkPxO5Z5Jtr0hkYGOZChWZqR0XKCMMFTLAoGTh2rjOFH2Zt3F29cM= 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 1772744844237285.49722134196134; Thu, 5 Mar 2026 13:07:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vyFuZ-0000nD-99; Thu, 05 Mar 2026 16:07:11 -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 1vyFuX-0000md-Gs for qemu-devel@nongnu.org; Thu, 05 Mar 2026 16:07:09 -0500 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vyFuV-0008O2-KX for qemu-devel@nongnu.org; Thu, 05 Mar 2026 16:07:09 -0500 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-2ae43042ea7so58419915ad.0 for ; Thu, 05 Mar 2026 13:07:07 -0800 (PST) Received: from pc.taild8403c.ts.net (216-71-219-44.dyn.novuscom.net. [216.71.219.44]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2adfb6b5813sm236992505ad.63.2026.03.05.13.07.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2026 13:07:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772744826; x=1773349626; 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=fjVg4k8L5YS0+fbIU3cK5+QxAukvdu0K3zvehSjPnuA=; b=w4SYJPnouxRNhZslUmRzOsubpAkJLfmsMmD2vrctjfKB/2o/nHEjnh7IEMfNu4rQk0 3AOVovjGhKg6ZU9CYqLdrr3zzHRp8P7DsdB3JNOKpYnmGpCcbUWStsBiNS2q00TdDVBW UTjRk3/ohnx6xmZll4esNXfobPcq7EJRyTTdP6Ec67AH8T/7kyFPfQUFPZCSzl0SJULf Ike3KzuL3qstdABBo+sHJpB48M3z4803Mua4i34HUZGm/rHGpEq/qxGLczdpz1rOhsBB /lCYBSDQ3pZSwDYWhrmlERnd5L+Vd/SEUXlXrhqTuePdsECXL+sRAR1xadfMR29nlsqZ uQlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772744826; x=1773349626; 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=fjVg4k8L5YS0+fbIU3cK5+QxAukvdu0K3zvehSjPnuA=; b=rnodWLK50MGEJi1t1RNr55vnodPLwbuZgPQqTQB4hlYe6VkKNg/CRbS7ofHizYBqlR taOoWbMvJybHnCkV0sAYK6iBMRQQJZVheXDgjVhhTXWHlKMBC3wEeNU+NkLGKpKUxmVF N+T5goeOe1JSNgFP0zSuIYdvPXTTSa+L583OfPsrLsyYlyVflXjqZCncf0l8EPFJAlLz PPEddxxdugOfgbCNHeZjG0Rzk8goWsJlMMpBEGyHALr8QDnFUK7xZ6nIRKmWWDxLhyW8 2Bu3reXeiOWSdi4o4aHgY+Bsym+12eiF/0tfdb3mdzQbykmKjWLC0Yu9a4OQIqgxVG7A lrmA== X-Gm-Message-State: AOJu0YxfKmp7rTirgt3PQhB0DD8p1jj0FFgiOQrAn57vpQSgGdjqDmWY Mi6v8CkWyVVSafBLa0Oh2I1KjHM573q4uolH/RituhjQWTUwqHJiOtlo0XZFKCfybNb6Ufq4lUR +WqMK X-Gm-Gg: ATEYQzxhpW+6QHwamct8t+Bucru3if5sDAOSt5Fbt80Ms5YIMyxTDvKxn7D9YN99PHm +HuMczsgsOj4IyaxN5RFTNPB5vjJmYZqOo6+G+31dJiLwhNLr+ljE4JF/4qZ5pbWaQ/8RehbhfO tHEo06E9OSU0wcenNs3uLkVWyBr+POEJ2q+xqtUM5rvlf1vtVQGfCydQ0YKPSCCKkQs40urB7dN RaJk6NNCzzn5FB796agdl765tfhrNLLsn19a3BZC419IU4E7wZgghKUGF0ty6TBZZyZTYcn5AGP a87V/+VPA4eK+tCU5Ohy82KUUOgRcOURQ9nfMtEDDSIYPwXRlUnFLfvJfBStnCftKu/7DC1mDm8 I2RKnRx+b/ooWuGfURPAYmN/etpklcbS5a+Njv62hXmVa8ky/UaFAh503Jvpg/VaCYZzHHSqaxE si1JHcUy5gqZsHoC3UZgcMSeHLtO7ar3jcA5/RPc5oMg7GF2mKjaOVMPschaENFCY/LdOrRQD79 kZE X-Received: by 2002:a17:902:ce02:b0:2ae:7f6d:78a4 with SMTP id d9443c01a7336-2ae7f6d78c1mr12440495ad.56.1772744825937; Thu, 05 Mar 2026 13:07:05 -0800 (PST) From: Pierrick Bouvier To: qemu-devel@nongnu.org, peter.maydell@linaro.org, richard.henderson@linaro.org, pbonzini@redhat.com, stefanha@redhat.com Cc: pierrick.bouvier@linaro.org Subject: [PULL 1/6] hw/virtio: Add virtio_vdev_is_legacy() Date: Thu, 5 Mar 2026 13:06:51 -0800 Message-ID: <20260305210656.2140206-2-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260305210656.2140206-1-pierrick.bouvier@linaro.org> References: <20260305210656.2140206-1-pierrick.bouvier@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=2607:f8b0:4864:20::631; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x631.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: 1772744845718154100 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: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Link: https://lore.kernel.org/qemu-devel/20260225041948.52929-2-philmd@lina= ro.org Signed-off-by: Pierrick Bouvier --- 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 0f5654f459e..bcab2d18b80 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.47.3 From nobody Fri Mar 27 02:25:17 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=1772744860; cv=none; d=zohomail.com; s=zohoarc; b=S/rAVoBrUSW6FdJAyu5+TB0T6K6NaxLzExqA/RguTfGpkr1npj3BFQL0jZcLoSNTvspX4S8jryXRHa3OfA//C3zX8toyyhXnmZOjNX/pql/uefpK5WxUymWv2cK4ECARiWJzSvvg1yVvu/yzHMHdyxwMMpbmvZKDYO8dTOLesqo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772744860; 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=QAo6ofbgTbHTQLqhku7tbhHK2r8k4onc7bjEitYzIus=; b=etC8IB+z59ObAm7FsVMjOPV4PSnxPzSSRBFEpDj/zERC7zBxNre/6aV4SMAQQA+FFlHSnYG9RJj0NptOPXdsi2PZuBWPPmoQBzPbJN5ajw/WEHQ5Z+9LP9DFwOUOiPmdobb+l4X/EFF2wqTxs3+8vjOwFsTy/cdRufvSwLqR7TU= 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 1772744860415340.36682349773855; Thu, 5 Mar 2026 13:07:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vyFuZ-0000na-Vm; Thu, 05 Mar 2026 16:07:12 -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 1vyFuY-0000n3-Bw for qemu-devel@nongnu.org; Thu, 05 Mar 2026 16:07:10 -0500 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vyFuW-0008O7-Aw for qemu-devel@nongnu.org; Thu, 05 Mar 2026 16:07:10 -0500 Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-b6ce6d1d3dcso2992739a12.3 for ; Thu, 05 Mar 2026 13:07:07 -0800 (PST) Received: from pc.taild8403c.ts.net (216-71-219-44.dyn.novuscom.net. [216.71.219.44]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2adfb6b5813sm236992505ad.63.2026.03.05.13.07.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2026 13:07:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772744827; x=1773349627; 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=QAo6ofbgTbHTQLqhku7tbhHK2r8k4onc7bjEitYzIus=; b=cNFXH+8wVDpCOtXCLnuorNIR+OtB0nLXlFuQvTxg7605KGam/jPVA0jjnaTBzfUuck Cf94acxGBRbcQIlDJtgal4rhEQtUoEJpKHdgZ07MdkGWZVN3M9HMY2fMf3gEpOFqCa8E OSAkSiY1U2Oy62LoF+txdqr4uqDY//5OSwp9fiwXj5BNQ0FDOqRzkwK3OKy88LyKeOFp PimrOUvEmR7icgumysND5phfhoVAuOaoJhYbBI0wh+CNMp3e0eVw/TNKre39XWFICzbK RIwfDUjD0pALoo5iQ/9P+fI34ix+wzi3/r7DLU2Z2YOGL9Mra7W8BzXq6DFb/GbeQ31/ dWrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772744827; x=1773349627; 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=QAo6ofbgTbHTQLqhku7tbhHK2r8k4onc7bjEitYzIus=; b=w5w7Nbiy0XdOJ4axrGE9Y92jRtxR7gwN0WbSsViWCr5ANOWxVXbkMYMZAsJuWTIg/6 /RpLAje6WdJ9l/Ds4x89uszpKOWmPu2xAvvV/uX5VtTvX2aLJYFQa0+mTChaocDXA4mB M51Y9Z3exv66oiV3bJB851BTvyPZJrKVeqZC9N0QGhCgPYiSLLdEvfMGaC6szbAqDxSx F0Z6jwUGGE5LpmQ7VACTuQ7+y1qn99U6ZxmNwtUsbCfJR/22DW4ohCsjcR7GD16LoPt3 7hE83esXoWxkTsYQ72INl+9/Ga+lBTfIvhWKzuzne8Ox66jd/mew/IxJnb0aSs0/2p4v D/Ew== X-Gm-Message-State: AOJu0YzPQcRaRxI243NN1Cn2W1Qi0HjC1hty9vTE0Uylc1Ig26Ykm+pq NK8w0cYM1Nz03ehjeY5KP2iKYxgkH9sz6Nrv+oHkk9eKNxOW6S03+PNUGwkPtY6xdXsLLBtjyvG Xr/Us X-Gm-Gg: ATEYQzyFw3cHQcVPuvTlgJhb827M0Bh1ij0Vp9ZL9YnlPAa10yt7xnU4H1i+YZXD8H0 Q0VttD8KcVHTzwhyyUfzxZFlTedMehqpLU+1mdfsi7Ni9sVFSiL4uYB7AhNRm888UlUhcno6xXC yJi0cwYzMxF1Oh+jd/ciZ3sGa2mJPhk1ihMqXDyMT8jTlDx9LFh9FOGHPn5EZabK3iz6A964va4 QIp/uRtAqcGi0Jt1KJAebYve7S7NLFLeCX5WYo//kmpPZOLeBx0WZwwq1f5SBIccQI1mLQdReOr ONjUzkMgGQ77RpT5yW/6XQxSMRcmmw/uRDpB3v2YgKthQDNc8H18NTjeAb9nVmiHYI8i2TsBJuw 2RYD77Zz7Mx7e3G/02eveUnygZBf5gY318QGXM9iTQx8MtI41hr+E6lowSNs17TFbpuoz9cVaJZ V3jVj1hXcW14PqiF4V2ZaneT2IcapwJAOak4BGTwsf5nfGy2lG66umjAv2iakupROV54W42qQ8a WXp X-Received: by 2002:a17:903:1a67:b0:2ae:478f:2e2 with SMTP id d9443c01a7336-2ae6ab0f4a6mr59455985ad.27.1772744826834; Thu, 05 Mar 2026 13:07:06 -0800 (PST) From: Pierrick Bouvier To: qemu-devel@nongnu.org, peter.maydell@linaro.org, richard.henderson@linaro.org, pbonzini@redhat.com, stefanha@redhat.com Cc: pierrick.bouvier@linaro.org Subject: [PULL 2/6] hw/virtio: Simplify virtio_access_is_big_endian() Date: Thu, 5 Mar 2026 13:06:52 -0800 Message-ID: <20260305210656.2140206-3-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260305210656.2140206-1-pierrick.bouvier@linaro.org> References: <20260305210656.2140206-1-pierrick.bouvier@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=2607:f8b0:4864:20::52f; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pg1-x52f.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: 1772744861900158501 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. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Stefan Hajnoczi Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Link: https://lore.kernel.org/qemu-devel/20260225041948.52929-3-philmd@lina= ro.org Signed-off-by: Pierrick Bouvier --- 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.47.3 From nobody Fri Mar 27 02:25:17 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=1772744855; cv=none; d=zohomail.com; s=zohoarc; b=Rstebj8QVWJvgK0WVmSBgbP+W3KYGkLFjeRs17rhCrx4EWUyvxC/ZTXc5hzGyPml0bg+ruhKqCJQDPfNM1CFXU05D5pFUFurdc169WezPVH/Y+MD9La3bV6vfhEl0pHae0i6y4mLqKnHAeKoKIsi290oaTr14HujU1OSCqjxbvg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772744855; 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=nkGRHnWZzEkpTkOUXW6elzMRnuyLVvfMOFl+6+n7Ots=; b=RsaM6waDCjM1/lnhiXb0Qz2MH7Se8OYmG/8ysctqB5h2Hnv0/pBKaEdUTs1A/dUMfgxQlz1AZTl4tkTldMufbbA2XCFU1qDRpBeOz+Vdhn6MaCCwP/LhikiHcqfKolebrS3SbMvB/GhZiZxZSJSwAHESDSqMLxAjvaZTk69lJSo= 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 1772744855052290.71046345502214; Thu, 5 Mar 2026 13:07:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vyFua-0000nx-OY; Thu, 05 Mar 2026 16:07:12 -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 1vyFuZ-0000nC-68 for qemu-devel@nongnu.org; Thu, 05 Mar 2026 16:07:11 -0500 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vyFuX-0008OI-DU for qemu-devel@nongnu.org; Thu, 05 Mar 2026 16:07:10 -0500 Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-c70f91776fcso3376641a12.0 for ; Thu, 05 Mar 2026 13:07:09 -0800 (PST) Received: from pc.taild8403c.ts.net (216-71-219-44.dyn.novuscom.net. [216.71.219.44]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2adfb6b5813sm236992505ad.63.2026.03.05.13.07.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2026 13:07:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772744828; x=1773349628; 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=nkGRHnWZzEkpTkOUXW6elzMRnuyLVvfMOFl+6+n7Ots=; b=BPWZdLYLN+z8L2dLtYXsSQtmODF1IhCTtJIVtrq+doxfju2DbXaEnab7Vb4csEvo3x onO17OhoDHROuc/jYke/Y2LFvSLvIpxRpH1lG4iHyocWnHsLgaLlObLKcI6LlVIX5iri ICexotW2lWeKpciBhWEDecUhMug8KzoAsr+ZWZPIb26j1J674/25Ovj5gWbIyi/wcx8t CzZLFYDfMjUcv9MIzdaU0Dmi0QfSVfOqMCku1iFlmSxXA7+IQkrev4mAz0sxAl2tRAgm 98SNMEZ9CAbTv2FLtuaHDKGx5AAJGx0fxKtkGlPWoTu6QpG6b8nmiEl/M4wREGAV91Ps wJqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772744828; x=1773349628; 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=nkGRHnWZzEkpTkOUXW6elzMRnuyLVvfMOFl+6+n7Ots=; b=i2UxSccTaFOrB88aUXqoszqGGN5I+GAgZpGAoNUI7mc6DEQgVPjxskWMWjnggN4ACE dRuhH5kfjFcT97NStsf91ZQQhvz8/IOkzsI17AzOV2v/uI1Vfg/BvSw6EnC73PKvNuSM tKqM3EPNlcWiGO/5zHC9JT9wqElcUyieBMfP7CHUXPu/2MW2jLVcLh0Z3bkk8VzVnTWV tlmO89yWu+62VFzTaRX4bw4b+FQdJQHrH/F6d2RCHKr07ehaEDF4Eo426rVVDIAZBgzd qE5nt/PUJKr1bRKyQ/PEeOaKmn8DmREvWl6nHaIGvL6GDs2kzCe201MAiN9Q86i55hTI c+Wg== X-Gm-Message-State: AOJu0Yx04ob569ycFKOg8JfX8VlTxV/vZIMEARQVzmVQPjNoUjEBQ5i4 2wj4xnE3njvrfoFeJn0zykUeZtFQqKDtyC/NWp03okZSO2BlTolUsDTcJPLaHv2JRhvO42+Z1Q2 PlGur X-Gm-Gg: ATEYQzxFTMMlb29rxF8MRS584NK3C60RtpuEXfpo15/O8CjU9smUdBMQKOr8XOvD9as /ImVz9kUKxVfMXaz3j2cJsJ4uxS4qsW0E8NJ2OMEAORkuhh6KxuicaonYNzfHHZnfKQai6vmF6g wlR9HbC57YEDw4DWyP4tUhhbigbCamk3n4Q0b23FsNwH4wPmjHBkMoHMs+r+d85dGXlxDU9MK0V /BuvXc/tYpZ2CRkLRevjNJZ1/8SN6LLXK+lOtGcXiAbiTPwAOsA4e5JasYZXZS6Fu+6IOl+N03H O7AeihJfDvUnmpfOl02w8sH6N7SmE6eAU4FOKrje+fgf9vYIAgIf/HDfrU4ABO+/0Avy8yCXt07 /bGrmJmb1Q54HpHSgI4uZLGFunUhe7A2yRuDc98noN/A9vyRQS8s5asT316B2CA6MP7ET7rcO3F 7PwXD2nyWBeqsGU1ejVCWVowuqJnQ2s/DDK7lBWONr26SVEmfnGLWAWFkEDPPgpq6WqChirSmVb Qzq X-Received: by 2002:a17:903:390f:b0:2ae:7eda:765e with SMTP id d9443c01a7336-2ae8015ad19mr9460815ad.17.1772744827836; Thu, 05 Mar 2026 13:07:07 -0800 (PST) From: Pierrick Bouvier To: qemu-devel@nongnu.org, peter.maydell@linaro.org, richard.henderson@linaro.org, pbonzini@redhat.com, stefanha@redhat.com Cc: pierrick.bouvier@linaro.org Subject: [PULL 3/6] hw/virtio: Inline virtio_access_is_big_endian() Date: Thu, 5 Mar 2026 13:06:53 -0800 Message-ID: <20260305210656.2140206-4-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260305210656.2140206-1-pierrick.bouvier@linaro.org> References: <20260305210656.2140206-1-pierrick.bouvier@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=2607:f8b0:4864:20::533; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pg1-x533.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: 1772744857972154100 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Stefan Hajnoczi Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Link: https://lore.kernel.org/qemu-devel/20260225041948.52929-4-philmd@lina= ro.org Signed-off-by: Pierrick Bouvier --- 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.47.3 From nobody Fri Mar 27 02:25:17 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=1772744884; cv=none; d=zohomail.com; s=zohoarc; b=eUxvCTzSHaNBSq9CPUMvETPZl9N8FMF8uPLcM7hlboo3f/SJ57rJJ8Dgm0kcdsKg1w3Il0vvoXiEfJ6S565TYCM4w3g+oSYuX9Rak8fVW2AEdKc0WToLuR2BXsHgPeao8/L2d4qO2pIxCXKLeioCZ3ZF5SHpH2w0jlJGdQx+YiE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772744884; 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=76kT1LLbzqR90+aCRQBHop//yXjVEoX7825LzBvy7WA=; b=RTuadm+wqd9qe4QWLF5//GGhdlqibsaWcqoZIJsNem3xJ/4MEMdA3W8mmOPbhR7Kmapg6tkcwa4AUs4nL7tQ7ulYHD1DPRkXRE8Bp4Uamyn5XEPz1SKaeyoH6jY96zzm/d7lBvzLOnZYBAQ3nlJ6LnlnOri6HsCZSg6NC9iFl54= 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 1772744884685528.9396708712776; Thu, 5 Mar 2026 13:08:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vyFub-0000oG-I5; Thu, 05 Mar 2026 16:07:13 -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 1vyFua-0000nb-Ao for qemu-devel@nongnu.org; Thu, 05 Mar 2026 16:07:12 -0500 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vyFuY-0008Ob-Ka for qemu-devel@nongnu.org; Thu, 05 Mar 2026 16:07:12 -0500 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-2ae3a2f6007so41761545ad.2 for ; Thu, 05 Mar 2026 13:07:10 -0800 (PST) Received: from pc.taild8403c.ts.net (216-71-219-44.dyn.novuscom.net. [216.71.219.44]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2adfb6b5813sm236992505ad.63.2026.03.05.13.07.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2026 13:07:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772744829; x=1773349629; 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=76kT1LLbzqR90+aCRQBHop//yXjVEoX7825LzBvy7WA=; b=PKpCaYS+wTXlnrM6OY0kI28q87K/qIvr604w61uJUyTj9TfoF2XgdppwNsuooBDNlO BHV/+aM5gAxLUGK7mP3p3R9k0smI6cI4mR87jXm9hqxtMiKTgb+ceMPAlshuqbl96zdp W7AIHwzEHYc92qUSRBLyrmFsSmxC3laJojh1Y4bwwi9xXZWZJ7yZda7ygZL/rfFV8IKQ +eJceAO9cMhmobXtOU35Oy31VzNj9VY1To62wU3NDcwCD/3eUiKpry6zeIYcQghF5hi6 E1RHykMtiEvgde2vYo6p2LpaWq7ZIBFOqQZAJRISzfQLtTyYvbZioiRpIA7gVEUU7ADd 1XVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772744829; x=1773349629; 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=76kT1LLbzqR90+aCRQBHop//yXjVEoX7825LzBvy7WA=; b=nAtlOMNXGQdgKgmRZ8dD1SMAYyxc3iwesBlVVzNn1z9Pg9AljgEhricbD9aoVCy7Rg aT8WJlGn/ernBMRp2LL08UMGl2dX9f1boKII1o2MxVfWvb9JOAjZ99lPlJQoGqjwsr/D 9KketdYq4/7S/CZkmLq7HeCKaQOoaa5BFtP/P9+rFT29z5rrqj1vE+pNC5UsxXy32wGQ 9eY+KFiGCaiE03leooRHkc+52CItFeX/x+OryTmHcuYPbJod5Ma4jsZTQnWTHYjkJ9kx z42JWrdjZkgE6R8gp4XcH8xsOGL31/1+Nf+kZMsBsabFzjV8VusQzPeUGFXyOnFYes6x GqtA== X-Gm-Message-State: AOJu0Ywi3IpbI5CkXhPjSEUPBPcGkaoShFGVsKgFebks3pxeLuFZGo2o 9Sb4jatp+Rnj3xDe2zxQpz/9e2ciQBEq0NYtU+XmGBvwVHnArqVIuJo4R4mDr+U0ph5qeEnOEl3 zdbie X-Gm-Gg: ATEYQzwr4bbPuKEoYS0lxIFA4BO1SRPjT1HdtiiQ7wcYGsMUQQCuLXn07YRf3wUupvc jqH1NPUNtqCKMy7IIOTPnLK8lmU7qLsali/iTD0ayxcB3SMjwwln+fl9tfS2pxpQyWG7nm2HizH dhyvt2BJErPuN9Vv8IIaxSWh1n5dxxU2TroLbm1BZ4UXS+aUFe6kMuwwYsTJ7bjXJ1XTSooY8fl 6Qp7TD+kwdP/s1ZoPWAalv4iKsYcZsQkJhBmfnQ+c0iF86mbjyOIeS7z2zgirleQpNwxGyHCJCi KPFjWXGLPqC5N5mTVb+xErA36G8Hc73Br0TICX2mQpTKiAHXETfkn3VJUtssHavbH1RGI+c9rRS xJ81OdPuF7fTGXVgifCvjgUZpS2BwI4yx3q2EmgjYXrcal44alK/miMh3YujCQv7Rzil67Nps9+ ivtwZGczxqLfnyAGZTmCpXRK0Q0/DFSh0Dv5labexxPujJ8dm74j/mGqg9pjELqt+tUpGaVycvZ 3ZT X-Received: by 2002:a17:902:dac3:b0:2ae:62c8:771a with SMTP id d9443c01a7336-2ae6aa04b60mr63022585ad.5.1772744828913; Thu, 05 Mar 2026 13:07:08 -0800 (PST) From: Pierrick Bouvier To: qemu-devel@nongnu.org, peter.maydell@linaro.org, richard.henderson@linaro.org, pbonzini@redhat.com, stefanha@redhat.com Cc: pierrick.bouvier@linaro.org Subject: [PULL 4/6] hw/virtio/vhost-user: make compilation unit common Date: Thu, 5 Mar 2026 13:06:54 -0800 Message-ID: <20260305210656.2140206-5-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260305210656.2140206-1-pierrick.bouvier@linaro.org> References: <20260305210656.2140206-1-pierrick.bouvier@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=2607:f8b0:4864:20::62c; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x62c.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: 1772744886014158500 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. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/qemu-devel/20260225041948.52929-5-philmd@lina= ro.org Signed-off-by: Pierrick Bouvier --- 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 6675b63ce65..ae33d403cf7 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.47.3 From nobody Fri Mar 27 02:25:17 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=1772744855; cv=none; d=zohomail.com; s=zohoarc; b=eQCAmWPWwAq1j/8MBE8eGGKtDsFrvBslu/xYubFwcUwFyc9VQtO9MM6kDE5QZXgR7QcWYs42mmls/c8MNHXGeRf7o9mTm4XJ+VWgzx05u2q/BbMfkpz4Y9VRspCP2vT64q5uXHBdIITS0LUoevmspd2nVVgAhpykQg2DgKXgeqY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772744855; 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=VhJRBCoqCgIyiXf8YnzTETE2bKHQan9QnCheNmzknqw=; b=fE1USQtrJCJwlaImxd0fIskblmoxE5v4F8kV0nAQW3HSM77SowXnLTqoCbimTv9tKP4SwBO2klRwsqrQSY1TT1+aRIg8vqQNSEHIjPTMbUm9KL++WCjQelUESjbj3MSHrJ+kV0Lxewgm3HO7dhsZJlRMKMeC/r277ecXHK9kcR4= 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 1772744855089906.9494540615268; Thu, 5 Mar 2026 13:07:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vyFuj-0000qy-9v; Thu, 05 Mar 2026 16:07:21 -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 1vyFub-0000oI-TQ for qemu-devel@nongnu.org; Thu, 05 Mar 2026 16:07:13 -0500 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vyFuZ-0008Os-Kw for qemu-devel@nongnu.org; Thu, 05 Mar 2026 16:07:13 -0500 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-2addb31945aso61666765ad.1 for ; Thu, 05 Mar 2026 13:07:11 -0800 (PST) Received: from pc.taild8403c.ts.net (216-71-219-44.dyn.novuscom.net. [216.71.219.44]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2adfb6b5813sm236992505ad.63.2026.03.05.13.07.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2026 13:07:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772744830; x=1773349630; 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=VhJRBCoqCgIyiXf8YnzTETE2bKHQan9QnCheNmzknqw=; b=Cjw68aXpOq8dhCFRm/qRhPnHP7y6lwxqY4cFzRAbT+13fjzTIvjeUs3XZ4D3Lag2+Z GhpxNWyFaSaNp4EE4RnXSGBmW3/jKY6y0HFTPFuNPjE+U7lW7UbzR/pm7cg8sN2bnWkv sXWCjCdyXjqZiF2CcqF5vgnMQK29waQ4BMs/9xhgmCnsdcn1MOgd/wcPwzi/km0dfxUC 5/qfy2SZ+hDCfzhzVEj8Trcq2LzmgrgQtgVkX3Q0APZnRShfyrVb2azwJDSaVJfnkhV0 24xCFWTCoKib+buoE9WkoHEXNYJaL8GmJ9HoG6F86HnnkbGXPdEjCXL0zN3meetuWD0H 0c6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772744830; x=1773349630; 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=VhJRBCoqCgIyiXf8YnzTETE2bKHQan9QnCheNmzknqw=; b=PxKFGiY/GRxFq9M49v0yH7Mn7TO8YL04zL22wrI532412HIRNyALjj3KU7zYcfRtW2 VIGIDGEEPRA9xN9EpkIiUkxqPsygjb1gGABsGbWSzLY7Rh8JgoFrF3xSw2Ed/mHlw2vd LA8s4oYcpz5csRP60gtVYH79YPKjcL5De93yggTqEO2dYS7oY8lA2c0BcaVt2kMvdMOk 7ZERUC0UyJNomQaPbj+HMQJyqTL9dPelIsoOUH1ihDDmcqNHF+EAfIzkwnHBzanNOx27 mue8eH9gDm7oAgV6ykkn5lYzhDtx+ZJ6pxvU599wKSSd1jeoEk+2ZvMaorT6Q8Fn5+1i 6Nhw== X-Gm-Message-State: AOJu0YyxX9+RzfqdpB/EPd24JPrBtSCR8huQLUEnh9LaK4QBwhD0TYBJ ujDM2dDEHiCGNnfeuFKioXoo9MFmTHeQJ2UE9oAyd//P45sb+ifjZ7MLIcE4tFQA6dh4r5twGRR SGI8t X-Gm-Gg: ATEYQzxRbanQ0IceDTSB6VBWEm3y3UVYrWJzVf+4YO98I6fr4VtfTOM7Su8UfaS/kli 0NZHGdbO9OEyBHqERImNFpMQiA/ULhxGY5rvodFMra5E76jCRhLL7vwX5glYLFoeVFEEled5DsK pMPhlEBMonCdshUuYWsoAr7MY5oEV/e92BwW9v4EvllpiYVGcPAZkLfE6chwkAyuJxTbqmoVI5V cR4vEaq6S75ispuvuWyqrfTF1wNF1mfSp/CZZOv6cEIjxo3yPK9nZ6dSxpaa476i6d5G1i38Zy2 P3ajWIsiZRKJDDb0KtadNVEReyPCpqHFJBIMXMbu/qbcMl5hHnhHhfQOd2VLBqDl2nfFagNXanZ 92ZQ3EqgA/scpNziex6Faqgjsh6yVNPsPMPcJI4KBAcsyYMOPaqOVZpV+GsQCgEeQvJHrWygiBa lPj6Q+xDG/6IR1b60O4FqxbNFQxLbNl1kO3siT1HdDGG1aiUw7j5C11qXKNwRzvz1wAdzw5no5U Sgm X-Received: by 2002:a17:903:32c3:b0:2ae:5628:a18a with SMTP id d9443c01a7336-2ae6a9df8a0mr79589545ad.2.1772744829989; Thu, 05 Mar 2026 13:07:09 -0800 (PST) From: Pierrick Bouvier To: qemu-devel@nongnu.org, peter.maydell@linaro.org, richard.henderson@linaro.org, pbonzini@redhat.com, stefanha@redhat.com Cc: pierrick.bouvier@linaro.org Subject: [PULL 5/6] hw/virtio/virtio-qmp: make compilation unit common Date: Thu, 5 Mar 2026 13:06:55 -0800 Message-ID: <20260305210656.2140206-6-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260305210656.2140206-1-pierrick.bouvier@linaro.org> References: <20260305210656.2140206-1-pierrick.bouvier@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=2607:f8b0:4864:20::632; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x632.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: 1772744858134154100 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: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/qemu-devel/20260225041948.52929-6-philmd@lina= ro.org Signed-off-by: Pierrick Bouvier --- 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 ae33d403cf7..20356fba812 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.47.3 From nobody Fri Mar 27 02:25:17 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=1772744884; cv=none; d=zohomail.com; s=zohoarc; b=jjnlqTk6QAOHtECRNbcbiaEedEhSg9/CAgAoui4LpsxKaXCKo2dkyQk2Z3SovwnJ4kNWODZ8t9AhKJl0CQeiM7IBekF5HmNHZCHUy4VHIWcPqpE+NkrRRzdkXkxvI0SBTW3rcLpzlSYsOX1Tv8RXgYMXb/BpV3zPYS071tagp7A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772744884; 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=5idQi/OC8e82sVj6JCkzA1Vc/e1PnMuVGtyHxi+4wLA=; b=FQp9+zkvmlm3cd44h476Py7Ra3ZCYG8EVs5k1EuhzPP9jgFCbx+a3OaReBZfq8RldaCQXxNwC5761d/9c/xf52pwCupbyNMNXGSmO6STodZTKLynN2tem4w0FM7WLJswclxGAiUXKROg60t6HntJuXzrJ6iiZO3PA6o6CdLdUCs= 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 1772744884689124.36953027195932; Thu, 5 Mar 2026 13:08:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vyFum-0000rr-FB; Thu, 05 Mar 2026 16:07:24 -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 1vyFuc-0000oh-Gq for qemu-devel@nongnu.org; Thu, 05 Mar 2026 16:07:19 -0500 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vyFua-0008P4-K6 for qemu-devel@nongnu.org; Thu, 05 Mar 2026 16:07:14 -0500 Received: by mail-pg1-x52e.google.com with SMTP id 41be03b00d2f7-c738a4231a2so551234a12.2 for ; Thu, 05 Mar 2026 13:07:12 -0800 (PST) Received: from pc.taild8403c.ts.net (216-71-219-44.dyn.novuscom.net. [216.71.219.44]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2adfb6b5813sm236992505ad.63.2026.03.05.13.07.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2026 13:07:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772744831; x=1773349631; 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=5idQi/OC8e82sVj6JCkzA1Vc/e1PnMuVGtyHxi+4wLA=; b=c29F3Ch7s/zAx7NAJCfpwCILHdmR9dLWFiXR9tFpEIiYYgoaXfLbEtMVs+tppB2Dfw FkOm+MCFEOsf9xJC8rPapB7m3/NxcTXzQfGVdyuAmFn0xTzAbUaN3GEMzE/PUjPMQHHB amAZg7MVHKCbEOsEY7gfM2QSIXLQtRx6xIqRE5WZQQfGBVdG8rnqdFPB31H2jnAnFxmu RNT4xmEZQehtcJcQ1M2/BEwhoe9apCBgw7u43Kcw1fQj+p+9d2q7tO8qoeRE52Alw9YY n0kbT6pGvEU3MJuP+y8hOHT0B2JYYfYj3zawdrZXn1N/fwGdbKbpqu5xPrWqg4X5KznZ rwgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772744831; x=1773349631; 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=5idQi/OC8e82sVj6JCkzA1Vc/e1PnMuVGtyHxi+4wLA=; b=PR7TBYeymOvHY2a0mUA3GLw7ku3ftncwCRWZrPH8J8QxRAK1mtTPvdbLnUeXWKsFb+ jHYCKAQXavCxMdzXhR3KvqLxoS9LwPiiS99v+nGZwWSOTGuv05uMtDbHlIS9tKWvfVFK fhov1R1A2AFFi0xHrXiBO1PqKVA/5I66AvA2SbOYij/7UiX6y5MKo/uFV8EtAmzFXd+5 9vpyDp8vCFkX355sbOWFupj8gvEphrBjrG8IIaAb1jf+c8ddWCqc7vPk3huAb0iQUu7w 3ZBx8qmJgZB90jL9olly+rmUOa/F+w7R65tUFKuNhgkJL1lH3qtlyXaugPVTwzK/Ojre ycFQ== X-Gm-Message-State: AOJu0YxClu1V+D/atq1+mrCikHhYZCfdAzvSLqzL+dXPqNgtPBmkrzAk dGHrX1uzlQJzEuDZAdNXjX8MhsdXsO17XlRCMYwf9n+QBbWW5ZihzxEq0zXKUL/G0USXrRkypyi gL6KC X-Gm-Gg: ATEYQzxU2xCNAjcujCEUM1tzoOXdb82cx9zgMJ5+R5T8izXO4kgHkU5QZBjPX6UWQ3N 5n7etEqySTEyEOOT5SMP/4V/duW21nL5NI7hTlyvUCViXk9Cz9tOnkYXwov3N7cZ9Qn4xJFtbwE FtP0G0/eLTGUpGWoUxH69Htb4W2MPBqFy3t8+p55/4XItGzSrThjU30jDw8iufioNkmOA/4QJ7f i1hAn1kdsuClvAV1CMiDngchei4wszIsPjYpOdpX0/HYQlOaI4cF1m7SxT0nCxtY7HLzHwlOwsk brQPx8MAoF0ckFQ06pXUbEcm6O7emtjjpNYGt17cjtkVN8EyZbdOPjx5cpLbWHPKLjxf4Xx3kKA vpAsQUWF4aTQUDDtc74EAWZPSw92Ypo/q/ZrafkXVgcldU71MK5KYnt7FnrwrTpK9VyagG289ob etP+W2oGLd88KvxV23MgoWwrzMAYzHHMxyi2cn93mbOp6n93C2+DVZbkVaZKxGQY2CF+xDDnsiu xXF X-Received: by 2002:a17:903:1b4b:b0:2ae:670e:309f with SMTP id d9443c01a7336-2ae80214c90mr9586505ad.34.1772744831037; Thu, 05 Mar 2026 13:07:11 -0800 (PST) From: Pierrick Bouvier To: qemu-devel@nongnu.org, peter.maydell@linaro.org, richard.henderson@linaro.org, pbonzini@redhat.com, stefanha@redhat.com Cc: pierrick.bouvier@linaro.org Subject: [PULL 6/6] hw/virtio/: make all compilation units common Date: Thu, 5 Mar 2026 13:06:56 -0800 Message-ID: <20260305210656.2140206-7-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260305210656.2140206-1-pierrick.bouvier@linaro.org> References: <20260305210656.2140206-1-pierrick.bouvier@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=2607:f8b0:4864:20::52e; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pg1-x52e.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: 1772744886376154100 Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/qemu-devel/20260225041948.52929-7-philmd@lina= ro.org Signed-off-by: Pierrick Bouvier --- 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 913eaedbc52..056c75b4c7c 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 20356fba812..821366f5e90 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 @@ -55,10 +54,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]) @@ -100,5 +99,4 @@ system_ss.add(when: ['CONFIG_VIRTIO_MD', 'CONFIG_VIRTIO_= PCI'], =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.47.3