Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2196156/?format=api
{ "id": 2196156, "url": "http://patchwork.ozlabs.org/api/patches/2196156/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-ppc/patch/20260212234602.338131-2-pierrick.bouvier@linaro.org/", "project": { "id": 69, "url": "http://patchwork.ozlabs.org/api/projects/69/?format=api", "name": "QEMU powerpc development", "link_name": "qemu-ppc", "list_id": "qemu-ppc.nongnu.org", "list_email": "qemu-ppc@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260212234602.338131-2-pierrick.bouvier@linaro.org>", "list_archive_url": null, "date": "2026-02-12T23:46:00", "name": "[1/3] hw/virtio: add virtio_vdev_is_{modern, legacy}", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "89471575286d09a19becb221a3c7be06312bbe89", "submitter": { "id": 85798, "url": "http://patchwork.ozlabs.org/api/people/85798/?format=api", "name": "Pierrick Bouvier", "email": "pierrick.bouvier@linaro.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-ppc/patch/20260212234602.338131-2-pierrick.bouvier@linaro.org/mbox/", "series": [ { "id": 492040, "url": "http://patchwork.ozlabs.org/api/series/492040/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-ppc/list/?series=492040", "date": "2026-02-12T23:46:02", "name": "hw/virtio/virtio-access.h: remove target specific code", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/492040/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2196156/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2196156/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=AFuQ0fM5;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fBsRN6JF2z1xpY\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 13 Feb 2026 10:47:28 +1100 (AEDT)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-ppc-bounces@nongnu.org>)\n\tid 1vqgO2-0004iK-9B; Thu, 12 Feb 2026 18:46:18 -0500", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <pierrick.bouvier@linaro.org>)\n id 1vqgNy-0004gP-DL\n for qemu-ppc@nongnu.org; Thu, 12 Feb 2026 18:46:14 -0500", "from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <pierrick.bouvier@linaro.org>)\n id 1vqgNu-0008B8-GK\n for qemu-ppc@nongnu.org; Thu, 12 Feb 2026 18:46:13 -0500", "by mail-pf1-x431.google.com with SMTP id\n d2e1a72fcca58-824a3509a12so217626b3a.2\n for <qemu-ppc@nongnu.org>; Thu, 12 Feb 2026 15:46:10 -0800 (PST)", "from pc.taild8403c.ts.net (216-71-219-44.dyn.novuscom.net.\n [216.71.219.44]) by smtp.gmail.com with ESMTPSA id\n 41be03b00d2f7-c6e1ac0e004sm5609936a12.6.2026.02.12.15.46.08\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 12 Feb 2026 15:46:08 -0800 (PST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1770939969; x=1771544769; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=/+sZ5I8NPsAH1XUC8CuVzuaEOJRie1BD5CLUQ6ZuKv0=;\n b=AFuQ0fM5ZxNiOy491CrM5V00UB+XHO6eC794JdyagzNShnCAvwxvxZrxivkMNuXgG6\n HevcpbSYkRTP1fTHmEFcaedOTG/le2T9Z1ymA36Gkqxkppegs4fARk7CTOmuauI7/g0A\n 7lR4sVwJjCKRP2nloKJOu0l+s5IIKiO41Z7e4cjRX7B9SgrNHON9ePsH+ia816M5EYSr\n 5HrCCX31QlIVQdJD+qBSFqgawWdy+X/fIyoNV41v/+1eN3QwU6omZQPyRF3JXnL2cxxL\n O+3L0t+kWp6FyjYOnaUjKsKW8xD5ecQUEa9op0rteAq+tgbKpQxqYJKQw96dR5fLI5Pq\n hfqA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1770939969; x=1771544769;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=/+sZ5I8NPsAH1XUC8CuVzuaEOJRie1BD5CLUQ6ZuKv0=;\n b=PvnG6dDRySj3DKWe30528WcT0ffCkiCwbQD6kV0oYnfnb74XaFMCqsyDOx1NCC33Ta\n ATWeazfYJ4TccixdEyrW15xot1vEL09rSHWDW2EsXU8/NGT+vgL87KW5eivO8ZAd0WKR\n /wMON/pm+SX1Had2QqB5KEAvZOfNxpVFjvtoVP/7gKYvsO4Fdm4yHK8IqJaRJc6tyPJ+\n SyWw/6QRQcbmzrTe4UmRKuOa4YcjV38p+OHazMEz1iEf8trDyUMNEVAZ9zsLcCpT2eqf\n WxHMREwhUQ8bYkYzFhcCCgaNdIfaNP7v6LhCqlk13NMRF3376Nqj2Lr8UWrmDACvpy9C\n PQhA==", "X-Gm-Message-State": "AOJu0YzSu+XJBGlaHoagTqHFcTOsJuII0gETYLw4R9kJAtLqEo83m47I\n +M4rTea9K9Y+IK0s5n3YDGq8v+8+6YTeKhppRzhn1ZKWKjBgUlmAYF/Jug+0FPYpQSM=", "X-Gm-Gg": "AZuq6aIECnM8GQjjlEIilrllsfIoLNuXUoTb2jm4KQnHG3gL8KmItsXjvTmn/nmu5Aj\n WU2iJsrYUuqMsgiYYuXWjcNQoA3I825zD6fjBkc+41tJGpdmzmtAe1D7S+KEAXY8rf3rShzDsHB\n gwfLjC3m5kORAvoKL92VyT21/oLz8N1U+SbXzgLmkXdgpJpjtcz++RmesLoitmc+KDTI3+KlAr4\n p3iAyHmV8IzjQUEG0EawTB3zQNtM/yrKw8Zbez2qDEDp1YuWrXc8fTSR2/+Xx8DRv7ACCaVX10l\n vbP+dJxy+PLOGz5lb6AesxAck0haoIRs6s/8gTpeBO1rq4QeaUH0YzTimbd7kK5w99+muYCOJC9\n G2T8K3WqmHn6RVDXJuoMHGZu5rt/hxiG/8XeDJK6M2b823ZsyiWi5KNIsLZ6DjQIMevEuvRAZeS\n 8mfmNKpWIV+RoOE3PLMw4q+73NdCnqVvVlZMASP7xhCJ3GLfIWNtKDMTT9G2l9sa2vKdkkAxyz+\n y8n", "X-Received": "by 2002:a05:6a20:748b:b0:38b:de3d:d530 with SMTP id\n adf61e73a8af0-39467468ae4mr419290637.72.1770939968993;\n Thu, 12 Feb 2026 15:46:08 -0800 (PST)", "From": "Pierrick Bouvier <pierrick.bouvier@linaro.org>", "To": "qemu-devel@nongnu.org", "Cc": "qemu-ppc@nongnu.org, Pierrick Bouvier <pierrick.bouvier@linaro.org>,\n Harsh Prateek Bora <harshpb@linux.ibm.com>,\n Stefano Garzarella <sgarzare@redhat.com>, Jason Wang <jasowang@redhat.com>,\n Nicholas Piggin <npiggin@gmail.com>, stefanha@redhat.com,\n richard.henderson@linaro.org, \"Michael S. Tsirkin\" <mst@redhat.com>,\n\t=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>", "Subject": "[PATCH 1/3] hw/virtio: add virtio_vdev_is_{modern, legacy}", "Date": "Thu, 12 Feb 2026 15:46:00 -0800", "Message-ID": "<20260212234602.338131-2-pierrick.bouvier@linaro.org>", "X-Mailer": "git-send-email 2.47.3", "In-Reply-To": "<20260212234602.338131-1-pierrick.bouvier@linaro.org>", "References": "<20260212234602.338131-1-pierrick.bouvier@linaro.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=2607:f8b0:4864:20::431;\n envelope-from=pierrick.bouvier@linaro.org; helo=mail-pf1-x431.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,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no", "X-Spam_action": "no action", "X-BeenThere": "qemu-ppc@nongnu.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<qemu-ppc.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-ppc>,\n <mailto:qemu-ppc-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-ppc>", "List-Post": "<mailto:qemu-ppc@nongnu.org>", "List-Help": "<mailto:qemu-ppc-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-ppc>,\n <mailto:qemu-ppc-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "This simplifies code compared to having\nvirtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1) or\n!virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1).\n\nSigned-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>\n---\n include/hw/virtio/virtio-access.h | 3 +--\n include/hw/virtio/virtio.h | 12 +++++++++++-\n hw/net/virtio-net.c | 2 +-\n hw/virtio/vhost.c | 2 +-\n hw/virtio/virtio-pci.c | 2 +-\n hw/virtio/virtio.c | 16 ++++++++--------\n 6 files changed, 23 insertions(+), 14 deletions(-)", "diff": "diff --git a/include/hw/virtio/virtio-access.h b/include/hw/virtio/virtio-access.h\nindex cd17d0c87eb..324ba907e93 100644\n--- a/include/hw/virtio/virtio-access.h\n+++ b/include/hw/virtio/virtio-access.h\n@@ -30,8 +30,7 @@ static inline bool virtio_access_is_big_endian(VirtIODevice *vdev)\n #if defined(LEGACY_VIRTIO_IS_BIENDIAN)\n return virtio_is_big_endian(vdev);\n #elif TARGET_BIG_ENDIAN\n- if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {\n- /* Devices conforming to VIRTIO 1.0 or later are always LE. */\n+ if (virtio_vdev_is_modern(vdev)) {\n return false;\n }\n return true;\ndiff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h\nindex 27cd98d2fe1..8f1e4323599 100644\n--- a/include/hw/virtio/virtio.h\n+++ b/include/hw/virtio/virtio.h\n@@ -468,9 +468,19 @@ static inline bool virtio_host_has_feature(VirtIODevice *vdev,\n return virtio_has_feature(vdev->host_features, fbit);\n }\n \n+static inline bool virtio_vdev_is_modern(const VirtIODevice *vdev)\n+{\n+ return virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1);\n+}\n+\n+static inline bool virtio_vdev_is_legacy(const VirtIODevice *vdev)\n+{\n+ return !virtio_vdev_is_modern(vdev);\n+}\n+\n static inline bool virtio_is_big_endian(VirtIODevice *vdev)\n {\n- if (!virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {\n+ if (virtio_vdev_is_legacy(vdev)) {\n assert(vdev->device_endian != VIRTIO_DEVICE_ENDIAN_UNKNOWN);\n return vdev->device_endian == VIRTIO_DEVICE_ENDIAN_BIG;\n }\ndiff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c\nindex 512a7c02c93..313d3b88400 100644\n--- a/hw/net/virtio-net.c\n+++ b/hw/net/virtio-net.c\n@@ -217,7 +217,7 @@ static void virtio_net_set_config(VirtIODevice *vdev, const uint8_t *config)\n memcpy(&netcfg, config, n->config_size);\n \n if (!virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_MAC_ADDR) &&\n- !virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1) &&\n+ virtio_vdev_is_legacy(vdev) &&\n memcmp(netcfg.mac, n->mac, ETH_ALEN)) {\n memcpy(n->mac, netcfg.mac, ETH_ALEN);\n qemu_format_nic_info_str(qemu_get_queue(n->nic), n->mac);\ndiff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c\nindex 52801c1796b..70a112242b0 100644\n--- a/hw/virtio/vhost.c\n+++ b/hw/virtio/vhost.c\n@@ -1168,7 +1168,7 @@ static void vhost_log_stop(MemoryListener *listener,\n */\n static inline bool vhost_needs_vring_endian(VirtIODevice *vdev)\n {\n- if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {\n+ if (virtio_vdev_is_modern(vdev)) {\n return false;\n }\n #if HOST_BIG_ENDIAN\ndiff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c\nindex 1e8f90df34e..6126187a164 100644\n--- a/hw/virtio/virtio-pci.c\n+++ b/hw/virtio/virtio-pci.c\n@@ -1449,7 +1449,7 @@ static bool virtio_pci_queue_enabled(DeviceState *d, int n)\n VirtIOPCIProxy *proxy = VIRTIO_PCI(d);\n VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);\n \n- if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {\n+ if (virtio_vdev_is_modern(vdev)) {\n return proxy->vqs[n].enabled;\n }\n \ndiff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c\nindex 77ca54e5206..b0987e66d5b 100644\n--- a/hw/virtio/virtio.c\n+++ b/hw/virtio/virtio.c\n@@ -2279,7 +2279,7 @@ int virtio_set_status(VirtIODevice *vdev, uint8_t val)\n trace_virtio_set_status(vdev, val);\n int ret = 0;\n \n- if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {\n+ if (virtio_vdev_is_modern(vdev)) {\n if (!(vdev->status & VIRTIO_CONFIG_S_FEATURES_OK) &&\n val & VIRTIO_CONFIG_S_FEATURES_OK) {\n ret = virtio_validate_features(vdev);\n@@ -2365,7 +2365,7 @@ void virtio_queue_enable(VirtIODevice *vdev, uint32_t queue_index)\n * be re-enabled for new machine types only, and also after\n * being converted to LOG_GUEST_ERROR.\n *\n- if (!virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {\n+ if (virtio_vdev_is_legacy(vdev)) {\n error_report(\"queue_enable is only supported in devices of virtio \"\n \"1.0 or later.\");\n }\n@@ -2454,7 +2454,7 @@ void virtio_queue_set_align(VirtIODevice *vdev, int n, int align)\n VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);\n \n /* virtio-1 compliant devices cannot change the alignment */\n- if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {\n+ if (virtio_vdev_is_modern(vdev)) {\n error_report(\"tried to modify queue alignment for virtio-1 device\");\n return;\n }\n@@ -2753,7 +2753,7 @@ static bool virtio_device_endian_needed(void *opaque)\n VirtIODevice *vdev = opaque;\n \n assert(vdev->device_endian != VIRTIO_DEVICE_ENDIAN_UNKNOWN);\n- if (!virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {\n+ if (virtio_vdev_is_legacy(vdev)) {\n return vdev->device_endian != virtio_default_endian();\n }\n /* Devices conforming to VIRTIO 1.0 or later are always LE. */\n@@ -3228,7 +3228,7 @@ int virtio_set_features_ex(VirtIODevice *vdev, const uint64_t *features)\n }\n if (!ret) {\n if (!virtio_device_started(vdev, vdev->status) &&\n- !virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {\n+ virtio_vdev_is_legacy(vdev)) {\n vdev->start_on_kick = true;\n }\n }\n@@ -3446,7 +3446,7 @@ virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)\n }\n \n if (!virtio_device_started(vdev, vdev->status) &&\n- !virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {\n+ virtio_vdev_is_legacy(vdev)) {\n vdev->start_on_kick = true;\n }\n \n@@ -3461,7 +3461,7 @@ virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)\n * to calculate used and avail ring addresses based on the desc\n * address.\n */\n- if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {\n+ if (virtio_vdev_is_modern(vdev)) {\n virtio_init_region_cache(vdev, i);\n } else {\n virtio_queue_update_rings(vdev, i);\n@@ -4019,7 +4019,7 @@ void G_GNUC_PRINTF(2, 3) virtio_error(VirtIODevice *vdev, const char *fmt, ...)\n error_vreport(fmt, ap);\n va_end(ap);\n \n- if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {\n+ if (virtio_vdev_is_modern(vdev)) {\n vdev->status = vdev->status | VIRTIO_CONFIG_S_NEEDS_RESET;\n virtio_notify_config(vdev);\n }\n", "prefixes": [ "1/3" ] }