get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2195828,
    "url": "http://patchwork.ozlabs.org/api/patches/2195828/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260212062522.99565-4-anisinha@redhat.com/",
    "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": "<20260212062522.99565-4-anisinha@redhat.com>",
    "list_archive_url": null,
    "date": "2026-02-12T06:24:47",
    "name": "[v4,03/31] hw/accel: add a per-accelerator callback to change VM accelerator handle",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "540be60f683123a27b17dde4c970bc55b1cced85",
    "submitter": {
        "id": 86030,
        "url": "http://patchwork.ozlabs.org/api/people/86030/?format=api",
        "name": "Ani Sinha",
        "email": "anisinha@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260212062522.99565-4-anisinha@redhat.com/mbox/",
    "series": [
        {
            "id": 491935,
            "url": "http://patchwork.ozlabs.org/api/series/491935/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=491935",
            "date": "2026-02-12T06:24:45",
            "name": "Introduce support for confidential guest reset (x86)",
            "version": 4,
            "mbox": "http://patchwork.ozlabs.org/series/491935/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2195828/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2195828/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=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=cP9E2Q/6;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=google header.b=hRb+BmHc;\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 4fBQMP6Fg2z1xvb\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 12 Feb 2026 17:27:29 +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 1vqQ9C-0007Zo-AU; Thu, 12 Feb 2026 01:25:54 -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 <anisinha@redhat.com>)\n id 1vqQ98-0007ZX-Dn\n for qemu-devel@nongnu.org; Thu, 12 Feb 2026 01:25:50 -0500",
            "from us-smtp-delivery-124.mimecast.com ([170.10.133.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <anisinha@redhat.com>)\n id 1vqQ96-0005CZ-QA\n for qemu-devel@nongnu.org; Thu, 12 Feb 2026 01:25:50 -0500",
            "from mail-pj1-f71.google.com (mail-pj1-f71.google.com\n [209.85.216.71]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-232-JwjOEMXTNNCiBsdiSpp4oQ-1; Thu, 12 Feb 2026 01:25:46 -0500",
            "by mail-pj1-f71.google.com with SMTP id\n 98e67ed59e1d1-354bc535546so5945613a91.3\n for <qemu-devel@nongnu.org>; Wed, 11 Feb 2026 22:25:46 -0800 (PST)",
            "from rhel9-box.lan ([122.164.27.113])\n by smtp.googlemail.com with ESMTPSA id\n 98e67ed59e1d1-3567e7d95d8sm4894122a91.2.2026.02.11.22.25.42\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 11 Feb 2026 22:25:44 -0800 (PST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1770877548;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=pHG3b4cYl6HI67xkeHbu34Z6D7hlRIGcfFnOo5hYIvQ=;\n b=cP9E2Q/6pst2irkWygASgIITGWU+YpRnjYt4x14x3KD8d1R0/yg4TE5W+J2V4dwMgt8zzs\n LwQO05vu9a4RkbsPjEsAyXOY6tvdIYgg2rjTww+9/GAVxpfvgoexyPTFNlLO0K9CZfE6TR\n HGezEqe04ouhAKcDqxh6KUV6tg4vrDE=",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=redhat.com; s=google; t=1770877545; x=1771482345; 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=pHG3b4cYl6HI67xkeHbu34Z6D7hlRIGcfFnOo5hYIvQ=;\n b=hRb+BmHcO7v6aPdgMQLaxI2Q3xkkGvq7DL0kSQ+eHg0tQ6BIospgeAmMDCGxYcUkHy\n V8Yz554xQibGfO5TBTozUqB8J/RHXK/FU2Zh9Dm7RUM6GUIu7Bmafpjlj0P0a4ymWVo1\n Wp3pyLCW7kuvVeU2QnZ8a6QjS6ROtAagfREbPx42jsQxTqOu+v6gv1AWlNHyZpmx+SXS\n JSNx1+HGgT2qgBZAinJxfop8zk93prL6HpSgFnjh2oI9I527Hs2GrthLn54JroO9oM/a\n IyhVPLqLMmyh7JZATHvdOEjCBSSgEKTD8jjx3wg5+gWFReHR5eMxmgx/6GQ2+RcWryb+\n eLBw=="
        ],
        "X-MC-Unique": "JwjOEMXTNNCiBsdiSpp4oQ-1",
        "X-Mimecast-MFC-AGG-ID": "JwjOEMXTNNCiBsdiSpp4oQ_1770877545",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1770877545; x=1771482345;\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=pHG3b4cYl6HI67xkeHbu34Z6D7hlRIGcfFnOo5hYIvQ=;\n b=DA7AT7sYC+SsUN981OtVGCrt0M4XZVC7mB80Oncpt3TLNyZN0MAgLagsxhFysAjPPG\n immBxmKICM6LmOodEKxe8YxddPqOC35c1K9BLUSwUo4PUUNO2VDdNdOkZfGBqjrjuk7J\n D3uHHTi5Sp0vmogXqLatbdlaH85dAH93gK5QlFDw474et+0alXxgjWSQohDA4fPSD69F\n 621/0FrJdbz6eD2KaEE/oNUTrCmH2zXZOSWEAFJmsoakv0AzpuP+TEl3+BrPOF0qWTjO\n MYDOvS8bYek+cRhTceJC+cwg5miUkP2Bl4HqI36LmnCTesrReAWzgBj7tqCOHESsz9mO\n tMSQ==",
        "X-Forwarded-Encrypted": "i=1;\n AJvYcCW28v9EBclQO/6P2hsywr9unGUixGtWLFbgxBSKsTpfiS2bomJ9Y6NiOGfgZ6hM+6uIYzvvMzJfVbnW@nongnu.org",
        "X-Gm-Message-State": "AOJu0YwPvtVShfm9nh/MpoWFAvHhOQ/Cd0XuL5kXHXGOVoeY5CSl1TSK\n 6foGHnKvtaj1dHgaKTpOuCZGU51ccSDFF+Mr16k8NAeJRXnUJiRNATL15jb3EjDIUO4C/0rEKoN\n NU/xTkBqQXanTNkA/1JTxJ2/Pdlj7lSPWHcNsG76qYLeBHA8dW0/XlxIr",
        "X-Gm-Gg": "AZuq6aItbKqjb3dC+/w3MGrhonWI4GW0XtdisraOG6s4jv0OWfYZCZPXlHftbeS5Ciz\n UrHaVBSaU5bfWXNq9OO9HucI0nE/FCoTxdDszWnQV1TOWRGWO6iw0q42drDgf+lkOeGTyU2L6El\n G8oLkVauHCIQZAuI/tI0ok8XpgN5/W5GRAnCcnYH/JTO0qpRLeylNRgs9mCkodI4wS9xA320tfu\n bfNItN3wmvwh6+ZrWsUo+xa2tdFVmmhL/GSlWMe8kZqSlwXIXrEsk3qhDF9pajBZuIvR/HLwH8c\n 45gAwLfIQ0HpoqVSotlSSlNi6DuRbtkgB+IUvWIYRqOTaY1WUI2FRltoPIKEdtXHY5EtknJAD7P\n 4VsE+EVYL+25R8yLE68Nr1fGHmPVidV4URr/26obBwYATjB1LZPLrhX4=",
        "X-Received": [
            "by 2002:a17:90b:5289:b0:34f:454f:69a9 with SMTP id\n 98e67ed59e1d1-3568f41a0cdmr1587793a91.28.1770877545225;\n Wed, 11 Feb 2026 22:25:45 -0800 (PST)",
            "by 2002:a17:90b:5289:b0:34f:454f:69a9 with SMTP id\n 98e67ed59e1d1-3568f41a0cdmr1587776a91.28.1770877544747;\n Wed, 11 Feb 2026 22:25:44 -0800 (PST)"
        ],
        "From": "Ani Sinha <anisinha@redhat.com>",
        "To": "Richard Henderson <richard.henderson@linaro.org>,\n Paolo Bonzini <pbonzini@redhat.com>,\n =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>",
        "Cc": "kraxel@redhat.com, Ani Sinha <anisinha@redhat.com>, qemu-devel@nongnu.org",
        "Subject": "[PATCH v4 03/31] hw/accel: add a per-accelerator callback to change\n VM accelerator handle",
        "Date": "Thu, 12 Feb 2026 11:54:47 +0530",
        "Message-ID": "<20260212062522.99565-4-anisinha@redhat.com>",
        "X-Mailer": "git-send-email 2.42.0",
        "In-Reply-To": "<20260212062522.99565-1-anisinha@redhat.com>",
        "References": "<20260212062522.99565-1-anisinha@redhat.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Received-SPF": "pass client-ip=170.10.133.124;\n envelope-from=anisinha@redhat.com;\n helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001,\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": "When a confidential virtual machine is reset, a new guest context in the\naccelerator must be generated post reset. Therefore, the old accelerator guest\nfile handle must be closed and a new one created. To this end, a per-accelerator\ncallback, \"reset_vmfd\" is introduced that would get called when a confidential\nguest is reset. Subsequent patches will introduce specific implementation of\nthis callback for KVM accelerator.\n\nSigned-off-by: Ani Sinha <anisinha@redhat.com>\n---\n include/accel/accel-ops.h |  1 +\n system/runstate.c         | 37 ++++++++++++++++++++++++++++++++++++-\n 2 files changed, 37 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/include/accel/accel-ops.h b/include/accel/accel-ops.h\nindex 23a8c246e1..998a95ca69 100644\n--- a/include/accel/accel-ops.h\n+++ b/include/accel/accel-ops.h\n@@ -23,6 +23,7 @@ struct AccelClass {\n     AccelOpsClass *ops;\n \n     int (*init_machine)(AccelState *as, MachineState *ms);\n+    int (*reset_vmfd)(MachineState *ms);\n     bool (*cpu_common_realize)(CPUState *cpu, Error **errp);\n     void (*cpu_common_unrealize)(CPUState *cpu);\n     /* get_stats: Append statistics to @buf */\ndiff --git a/system/runstate.c b/system/runstate.c\nindex 5d58260ed5..0a74e3ade5 100644\n--- a/system/runstate.c\n+++ b/system/runstate.c\n@@ -42,6 +42,7 @@\n #include \"qapi/qapi-commands-run-state.h\"\n #include \"qapi/qapi-events-run-state.h\"\n #include \"qemu/accel.h\"\n+#include \"accel/accel-ops.h\"\n #include \"qemu/error-report.h\"\n #include \"qemu/job.h\"\n #include \"qemu/log.h\"\n@@ -509,6 +510,9 @@ void qemu_system_reset(ShutdownCause reason)\n {\n     MachineClass *mc;\n     ResetType type;\n+    AccelClass *ac = ACCEL_GET_CLASS(current_accel());\n+    bool vmfd_reset = false;\n+    int ret;\n \n     mc = current_machine ? MACHINE_GET_CLASS(current_machine) : NULL;\n \n@@ -521,6 +525,29 @@ void qemu_system_reset(ShutdownCause reason)\n     default:\n         type = RESET_TYPE_COLD;\n     }\n+\n+    /*\n+     * different accelerators implement how to close the old file handle of\n+     * the accelerator descriptor and create a new one here. Resetting\n+     * file handle is necessary to create a new confidential VM context post\n+     * VM reset.\n+     */\n+    if (!cpus_are_resettable() &&\n+        (reason == SHUTDOWN_CAUSE_GUEST_RESET ||\n+         reason == SHUTDOWN_CAUSE_HOST_QMP_SYSTEM_RESET)) {\n+        if (ac->reset_vmfd) {\n+            ret = ac->reset_vmfd(current_machine);\n+            if (ret < 0) {\n+                error_report(\"unable to reset vmfd: %s(%d)\",\n+                             strerror(-ret), ret);\n+                vm_stop(RUN_STATE_INTERNAL_ERROR);\n+            }\n+            vmfd_reset = true;\n+        } else {\n+            error_report(\"accelerator does not support reset\");\n+        }\n+    }\n+\n     if (mc && mc->reset) {\n         mc->reset(current_machine, type);\n     } else {\n@@ -543,7 +570,15 @@ void qemu_system_reset(ShutdownCause reason)\n      * it does _more_  than cpu_synchronize_all_post_reset().\n      */\n     if (cpus_are_resettable()) {\n-        cpu_synchronize_all_post_reset();\n+        if (vmfd_reset) {\n+            /*\n+             * If vmfd has changed, then vcpufds have also changed.\n+             * Need to sync full cpu state for non confidential guests.\n+             */\n+            cpu_synchronize_all_post_init();\n+        } else {\n+            cpu_synchronize_all_post_reset();\n+        }\n     }\n \n     vm_set_suspended(false);\n",
    "prefixes": [
        "v4",
        "03/31"
    ]
}