get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2196151/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2196151,
    "url": "http://patchwork.ozlabs.org/api/patches/2196151/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260212234602.338131-2-pierrick.bouvier@linaro.org/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api",
        "name": "QEMU Development",
        "link_name": "qemu-devel",
        "list_id": "qemu-devel.nongnu.org",
        "list_email": "qemu-devel@nongnu.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<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-devel/patch/20260212234602.338131-2-pierrick.bouvier@linaro.org/mbox/",
    "series": [
        {
            "id": 492041,
            "url": "http://patchwork.ozlabs.org/api/series/492041/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=492041",
            "date": "2026-02-12T23:45:59",
            "name": "hw/virtio/virtio-access.h: remove target specific code",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/492041/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2196151/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2196151/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (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-devel-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 4fBsQn4lLhz1xxM\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 13 Feb 2026 10:46:57 +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-devel-bounces@nongnu.org>)\n\tid 1vqgO2-0004i2-5P; 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-0004gQ-Dj\n for qemu-devel@nongnu.org; Thu, 12 Feb 2026 18:46:14 -0500",
            "from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435])\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-0008B7-HW\n for qemu-devel@nongnu.org; Thu, 12 Feb 2026 18:46:13 -0500",
            "by mail-pf1-x435.google.com with SMTP id\n d2e1a72fcca58-82318b640beso207908b3a.0\n for <qemu-devel@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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SF4s7/xU2IwVRoiREy\n BGk",
        "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::435;\n envelope-from=pierrick.bouvier@linaro.org; helo=mail-pf1-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,\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=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 <qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>",
        "List-Post": "<mailto:qemu-devel@nongnu.org>",
        "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>",
        "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"
    },
    "content": "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"
    ]
}