get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2224381,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2224381/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260417105618.3621-5-magnuskulke@linux.microsoft.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/1.2/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": "<20260417105618.3621-5-magnuskulke@linux.microsoft.com>",
    "list_archive_url": null,
    "date": "2026-04-17T10:55:48",
    "name": "[04/34] accel/accel-irq: add AccelRouteChange abstraction",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "cf4a402d42b9142c633b5d6a74dbc6d945c4584b",
    "submitter": {
        "id": 90753,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/90753/?format=api",
        "name": "Magnus Kulke",
        "email": "magnuskulke@linux.microsoft.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260417105618.3621-5-magnuskulke@linux.microsoft.com/mbox/",
    "series": [
        {
            "id": 500310,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/500310/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=500310",
            "date": "2026-04-17T10:55:44",
            "name": "Add migration support to the MSHV accelerator",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/500310/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2224381/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2224381/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 (1024-bit key;\n unprotected) header.d=linux.microsoft.com header.i=@linux.microsoft.com\n header.a=rsa-sha256 header.s=default header.b=RIZwG9bh;\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=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from lists1p.gnu.org (lists1p.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 4fxsKk6jV5z1yD3\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 17 Apr 2026 20:57:46 +1000 (AEST)",
            "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wDgsN-0000Le-G3; Fri, 17 Apr 2026 06:56:43 -0400",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <magnuskulke@linux.microsoft.com>)\n id 1wDgsM-0000LE-NC\n for qemu-devel@nongnu.org; Fri, 17 Apr 2026 06:56:42 -0400",
            "from linux.microsoft.com ([13.77.154.182])\n by eggs.gnu.org with esmtp (Exim 4.90_1)\n (envelope-from <magnuskulke@linux.microsoft.com>) id 1wDgsK-0001Vc-OC\n for qemu-devel@nongnu.org; Fri, 17 Apr 2026 06:56:42 -0400",
            "from DESKTOP-TUU1E5L.fritz.box (p5086d620.dip0.t-ipconnect.de\n [80.134.214.32])\n by linux.microsoft.com (Postfix) with ESMTPSA id 9D32D20B7135;\n Fri, 17 Apr 2026 03:56:36 -0700 (PDT)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.11.0 linux.microsoft.com 9D32D20B7135",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;\n s=default; t=1776423399;\n bh=gdJ6bc0jDPbL1vpVuF0aTcfrjU8S2va52X+iE755j4U=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=RIZwG9bhgESNWloKmcgz7NfweWpVExJR0h8Tjc9jy1Xo+J+wu3KEP7mmiFJbSGQQc\n nxGKDWZfGCBup1rLIAC4XCBdMcGAfyXQwA4Fc3ssINOOwnOrCkBcUOnB1VJRwI2kwV\n qu9Pk5SWrToUFroAJiiK4JP2hw4VDssS8tASS31E=",
        "From": "Magnus Kulke <magnuskulke@linux.microsoft.com>",
        "To": "qemu-devel@nongnu.org",
        "Cc": "kvm@vger.kernel.org, Magnus Kulke <magnuskulke@microsoft.com>,\n Wei Liu <liuwe@microsoft.com>, \"Michael S. Tsirkin\" <mst@redhat.com>,\n\t=?utf-8?q?C=C3=A9dric_Le_Goater?= <clg@redhat.com>,\n Zhao Liu <zhao1.liu@intel.com>,\n Richard Henderson <richard.henderson@linaro.org>,\n Paolo Bonzini <pbonzini@redhat.com>, Wei Liu <wei.liu@kernel.org>,\n Magnus Kulke <magnuskulke@linux.microsoft.com>,\n Alex Williamson <alex@shazbot.org>,\n Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, =?utf-8?q?Philippe_Mathieu-D?=\n\t=?utf-8?q?aud=C3=A9?= <philmd@linaro.org>,\n Marcelo Tosatti <mtosatti@redhat.com>",
        "Subject": "[PATCH 04/34] accel/accel-irq: add AccelRouteChange abstraction",
        "Date": "Fri, 17 Apr 2026 12:55:48 +0200",
        "Message-Id": "<20260417105618.3621-5-magnuskulke@linux.microsoft.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20260417105618.3621-1-magnuskulke@linux.microsoft.com>",
        "References": "<20260417105618.3621-1-magnuskulke@linux.microsoft.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Received-SPF": "pass client-ip=13.77.154.182;\n envelope-from=magnuskulke@linux.microsoft.com; helo=linux.microsoft.com",
        "X-Spam_score_int": "-42",
        "X-Spam_score": "-4.3",
        "X-Spam_bar": "----",
        "X-Spam_report": "(-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,\n SPF_HELO_PASS=-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 <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": "The accelerated irqchip routines use a record of changes to batch\nchanges when programming routes.\n\nCurrently this mechanism is coupled to the KVM accelerator, this change\nintroduces an abstraction that replaces KVMRouteChange and keeps a\npointer to an abstract AccelState instead of the concrete type,\nconverting the state where necessary.\n\nThis is done to further align the irqchip programming in the MSHV\naccelerator with the existing KVM code in QEMU. Subsequent commits will\nintroduce AccelRouteChange to the MSHV accelerator code.\n\nSigned-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>\n---\n accel/accel-irq.c           |  4 ++--\n accel/kvm/kvm-all.c         |  6 +++---\n accel/stubs/kvm-stub.c      |  2 +-\n hw/misc/ivshmem-pci.c       |  2 +-\n hw/vfio/pci.c               |  2 +-\n hw/virtio/virtio-pci.c      |  3 +--\n include/accel/accel-route.h | 17 +++++++++++++++++\n include/system/accel-irq.h  |  5 +++--\n include/system/kvm.h        | 21 ++++++++++-----------\n include/system/mshv.h       |  1 +\n target/i386/kvm/kvm.c       |  2 +-\n 11 files changed, 41 insertions(+), 24 deletions(-)\n create mode 100644 include/accel/accel-route.h",
    "diff": "diff --git a/accel/accel-irq.c b/accel/accel-irq.c\nindex 7f864e35c4..0aa04c033d 100644\n--- a/accel/accel-irq.c\n+++ b/accel/accel-irq.c\n@@ -16,7 +16,7 @@\n #include \"system/mshv.h\"\n #include \"system/accel-irq.h\"\n \n-int accel_irqchip_add_msi_route(KVMRouteChange *c, int vector, PCIDevice *dev)\n+int accel_irqchip_add_msi_route(AccelRouteChange *c, int vector, PCIDevice *dev)\n {\n #ifdef CONFIG_MSHV_IS_POSSIBLE\n     if (mshv_msi_via_irqfd_enabled()) {\n@@ -42,7 +42,7 @@ int accel_irqchip_update_msi_route(int vector, MSIMessage msg, PCIDevice *dev)\n     return -ENOSYS;\n }\n \n-void accel_irqchip_commit_route_changes(KVMRouteChange *c)\n+void accel_irqchip_commit_route_changes(AccelRouteChange *c)\n {\n #ifdef CONFIG_MSHV_IS_POSSIBLE\n     if (mshv_msi_via_irqfd_enabled()) {\ndiff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c\nindex 92af42503b..4e4234beff 100644\n--- a/accel/kvm/kvm-all.c\n+++ b/accel/kvm/kvm-all.c\n@@ -2359,11 +2359,11 @@ int kvm_irqchip_send_msi(KVMState *s, MSIMessage msg)\n     return kvm_vm_ioctl(s, KVM_SIGNAL_MSI, &msi);\n }\n \n-int kvm_irqchip_add_msi_route(KVMRouteChange *c, int vector, PCIDevice *dev)\n+int kvm_irqchip_add_msi_route(AccelRouteChange *c, int vector, PCIDevice *dev)\n {\n     struct kvm_irq_routing_entry kroute = {};\n     int virq;\n-    KVMState *s = c->s;\n+    KVMState *s = KVM_STATE(c->accel);\n     MSIMessage msg = {0, 0};\n \n     if (pci_available && dev) {\n@@ -2506,7 +2506,7 @@ int kvm_irqchip_send_msi(KVMState *s, MSIMessage msg)\n     abort();\n }\n \n-int kvm_irqchip_add_msi_route(KVMRouteChange *c, int vector, PCIDevice *dev)\n+int kvm_irqchip_add_msi_route(AccelRouteChange *c, int vector, PCIDevice *dev)\n {\n     return -ENOSYS;\n }\ndiff --git a/accel/stubs/kvm-stub.c b/accel/stubs/kvm-stub.c\nindex c4617caac6..32b4b07403 100644\n--- a/accel/stubs/kvm-stub.c\n+++ b/accel/stubs/kvm-stub.c\n@@ -44,7 +44,7 @@ int kvm_on_sigbus(int code, void *addr)\n     return 1;\n }\n \n-int kvm_irqchip_add_msi_route(KVMRouteChange *c, int vector, PCIDevice *dev)\n+int kvm_irqchip_add_msi_route(AccelRouteChange *c, int vector, PCIDevice *dev)\n {\n     return -ENOSYS;\n }\ndiff --git a/hw/misc/ivshmem-pci.c b/hw/misc/ivshmem-pci.c\nindex c987eebb98..aa8f271755 100644\n--- a/hw/misc/ivshmem-pci.c\n+++ b/hw/misc/ivshmem-pci.c\n@@ -424,7 +424,7 @@ static void ivshmem_add_kvm_msi_virq(IVShmemState *s, int vector,\n                                      Error **errp)\n {\n     PCIDevice *pdev = PCI_DEVICE(s);\n-    KVMRouteChange c;\n+    AccelRouteChange c;\n     int ret;\n \n     IVSHMEM_DPRINTF(\"ivshmem_add_kvm_msi_virq vector:%d\\n\", vector);\ndiff --git a/hw/vfio/pci.c b/hw/vfio/pci.c\nindex 1945751ffd..79c503c8ae 100644\n--- a/hw/vfio/pci.c\n+++ b/hw/vfio/pci.c\n@@ -51,7 +51,7 @@\n #include \"vfio-helpers.h\"\n \n /* Protected by BQL */\n-static KVMRouteChange vfio_route_change;\n+static AccelRouteChange vfio_route_change;\n \n static void vfio_disable_interrupts(VFIOPCIDevice *vdev);\n static void vfio_mmap_set_enabled(VFIOPCIDevice *vdev, bool enabled);\ndiff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c\nindex bcab2d18b8..5010572784 100644\n--- a/hw/virtio/virtio-pci.c\n+++ b/hw/virtio/virtio-pci.c\n@@ -869,7 +869,7 @@ static int kvm_virtio_pci_vq_vector_use(VirtIOPCIProxy *proxy,\n     int ret;\n \n     if (irqfd->users == 0) {\n-        KVMRouteChange c = kvm_irqchip_begin_route_changes(kvm_state);\n+        AccelRouteChange c = kvm_irqchip_begin_route_changes(kvm_state);\n         ret = accel_irqchip_add_msi_route(&c, vector, &proxy->pci_dev);\n         if (ret < 0) {\n             return ret;\n@@ -2695,4 +2695,3 @@ static void virtio_pci_register_types(void)\n }\n \n type_init(virtio_pci_register_types)\n-\ndiff --git a/include/accel/accel-route.h b/include/accel/accel-route.h\nnew file mode 100644\nindex 0000000000..07fac27e2a\n--- /dev/null\n+++ b/include/accel/accel-route.h\n@@ -0,0 +1,17 @@\n+/*\n+ * Accelerator MSI route change tracking\n+ *\n+ * SPDX-License-Identifier: GPL-2.0-or-later\n+ */\n+\n+#ifndef ACCEL_ROUTE_H\n+#define ACCEL_ROUTE_H\n+\n+#include \"qemu/accel.h\"\n+\n+typedef struct AccelRouteChange {\n+    AccelState *accel;\n+    int changes;\n+} AccelRouteChange;\n+\n+#endif /* ACCEL_ROUTE_H */\ndiff --git a/include/system/accel-irq.h b/include/system/accel-irq.h\nindex a2caa06f54..a148920711 100644\n--- a/include/system/accel-irq.h\n+++ b/include/system/accel-irq.h\n@@ -25,9 +25,10 @@ static inline bool accel_irqchip_is_split(void)\n     return mshv_msi_via_irqfd_enabled() || kvm_irqchip_is_split();\n }\n \n-int accel_irqchip_add_msi_route(KVMRouteChange *c, int vector, PCIDevice *dev);\n+int accel_irqchip_add_msi_route(AccelRouteChange *c, int vector,\n+                                PCIDevice *dev);\n int accel_irqchip_update_msi_route(int vector, MSIMessage msg, PCIDevice *dev);\n-void accel_irqchip_commit_route_changes(KVMRouteChange *c);\n+void accel_irqchip_commit_route_changes(AccelRouteChange *c);\n void accel_irqchip_commit_routes(void);\n void accel_irqchip_release_virq(int virq);\n int accel_irqchip_add_irqfd_notifier_gsi(EventNotifier *n, EventNotifier *rn,\ndiff --git a/include/system/kvm.h b/include/system/kvm.h\nindex 5fa33eddda..ccf90b8341 100644\n--- a/include/system/kvm.h\n+++ b/include/system/kvm.h\n@@ -18,6 +18,7 @@\n \n #include \"exec/memattrs.h\"\n #include \"qemu/accel.h\"\n+#include \"accel/accel-route.h\"\n #include \"qom/object.h\"\n \n #ifdef COMPILING_PER_TARGET\n@@ -183,11 +184,6 @@ extern KVMState *kvm_state;\n typedef struct Notifier Notifier;\n typedef struct NotifierWithReturn NotifierWithReturn;\n \n-typedef struct KVMRouteChange {\n-     KVMState *s;\n-     int changes;\n-} KVMRouteChange;\n-\n /* external API */\n \n unsigned int kvm_get_max_memslots(void);\n@@ -466,7 +462,7 @@ void kvm_init_cpu_signals(CPUState *cpu);\n \n /**\n  * kvm_irqchip_add_msi_route - Add MSI route for specific vector\n- * @c:      KVMRouteChange instance.\n+ * @c:      AccelRouteChange instance.\n  * @vector: which vector to add. This can be either MSI/MSIX\n  *          vector. The function will automatically detect whether\n  *          MSI/MSIX is enabled, and fetch corresponding MSI\n@@ -475,20 +471,23 @@ void kvm_init_cpu_signals(CPUState *cpu);\n  *          as @NULL, an empty MSI message will be inited.\n  * @return: virq (>=0) when success, errno (<0) when failed.\n  */\n-int kvm_irqchip_add_msi_route(KVMRouteChange *c, int vector, PCIDevice *dev);\n+int kvm_irqchip_add_msi_route(AccelRouteChange *c, int vector, PCIDevice *dev);\n int kvm_irqchip_update_msi_route(KVMState *s, int virq, MSIMessage msg,\n                                  PCIDevice *dev);\n void kvm_irqchip_commit_routes(KVMState *s);\n \n-static inline KVMRouteChange kvm_irqchip_begin_route_changes(KVMState *s)\n+static inline AccelRouteChange kvm_irqchip_begin_route_changes(KVMState *s)\n {\n-    return (KVMRouteChange) { .s = s, .changes = 0 };\n+    return (AccelRouteChange) {\n+        .accel = ACCEL(s),\n+        .changes = 0,\n+    };\n }\n \n-static inline void kvm_irqchip_commit_route_changes(KVMRouteChange *c)\n+static inline void kvm_irqchip_commit_route_changes(AccelRouteChange *c)\n {\n     if (c->changes) {\n-        kvm_irqchip_commit_routes(c->s);\n+        kvm_irqchip_commit_routes(KVM_STATE(c->accel));\n         c->changes = 0;\n     }\n }\ndiff --git a/include/system/mshv.h b/include/system/mshv.h\nindex 75286baf16..1e96b3a606 100644\n--- a/include/system/mshv.h\n+++ b/include/system/mshv.h\n@@ -21,6 +21,7 @@\n #include \"qapi/qapi-types-common.h\"\n #include \"system/memory.h\"\n #include \"accel/accel-ops.h\"\n+#include \"accel/accel-route.h\"\n \n #ifdef COMPILING_PER_TARGET\n #ifdef CONFIG_MSHV\ndiff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c\nindex 9e352882c8..478a5573cd 100644\n--- a/target/i386/kvm/kvm.c\n+++ b/target/i386/kvm/kvm.c\n@@ -6678,7 +6678,7 @@ void kvm_arch_init_irq_routing(KVMState *s)\n     kvm_gsi_routing_allowed = true;\n \n     if (kvm_irqchip_is_split()) {\n-        KVMRouteChange c = kvm_irqchip_begin_route_changes(s);\n+        AccelRouteChange c = kvm_irqchip_begin_route_changes(s);\n         int i;\n \n         /* If the ioapic is in QEMU and the lapics are in KVM, reserve\n",
    "prefixes": [
        "04/34"
    ]
}