Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2226173/?format=api
{ "id": 2226173, "url": "http://patchwork.ozlabs.org/api/patches/2226173/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260422103018.123608-7-armenon@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": "<20260422103018.123608-7-armenon@redhat.com>", "list_archive_url": null, "date": "2026-04-22T10:30:14", "name": "[v5,06/10] hw/tpm: Add support for VM migration with TPM CRB chunking", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "9cfbb36c7050132fca6df1af04fa8a00a60d7103", "submitter": { "id": 91136, "url": "http://patchwork.ozlabs.org/api/people/91136/?format=api", "name": "Arun Menon", "email": "armenon@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260422103018.123608-7-armenon@redhat.com/mbox/", "series": [ { "id": 500964, "url": "http://patchwork.ozlabs.org/api/series/500964/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=500964", "date": "2026-04-22T10:30:14", "name": "hw/tpm: CRB chunking capability to handle PQC", "version": 5, "mbox": "http://patchwork.ozlabs.org/series/500964/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2226173/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2226173/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=DpvBnVA3;\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=Qce0hFww;\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 4g0wWC47B3z1yHB\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 20:31:34 +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 1wFUrY-0006nt-00; Wed, 22 Apr 2026 06:31:20 -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 <armenon@redhat.com>)\n id 1wFUrW-0006n8-AQ\n for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:31:18 -0400", "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 <armenon@redhat.com>)\n id 1wFUrQ-0006zz-Ee\n for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:31:17 -0400", "from mail-pj1-f69.google.com (mail-pj1-f69.google.com\n [209.85.216.69]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-324-DGL65jU2NcOYnDvPN2NfKg-1; Wed, 22 Apr 2026 06:31:05 -0400", "by mail-pj1-f69.google.com with SMTP id\n 98e67ed59e1d1-354490889b6so8014941a91.3\n for <qemu-devel@nongnu.org>; Wed, 22 Apr 2026 03:31:05 -0700 (PDT)", "from fedora.armenon-thinkpadp16vgen1.bengluru.csb ([49.36.110.202])\n by smtp.gmail.com with ESMTPSA id\n 41be03b00d2f7-c7976f920e1sm12589666a12.2.2026.04.22.03.30.57\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 22 Apr 2026 03:31:03 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1776853871;\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=+nQzf/D0K64i/5OlXj6ts+ZQEQEq47laODMb54sHduo=;\n b=DpvBnVA3cQpLU4WFDtLJzw00cIzJSy+Pcqh0EZCFLO9jJNb0YnHEm4nlqtQlxEGNPiwU3O\n OLplxaLu8TPEfLvl5rSk6LVWC14aKQBS7kqqAzbach0ws1frnobmBvwqrqB7AcGPz3rttJ\n Sk7xgLW3XWgoWDLNTwovmxE8MtFF4jA=", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=redhat.com; s=google; t=1776853864; x=1777458664; 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=+nQzf/D0K64i/5OlXj6ts+ZQEQEq47laODMb54sHduo=;\n b=Qce0hFwwJKq1RxoF34MKnqzE/Maerx3M1aCzHCwOqN+yKUnhtCypB/LGNafkDCXt3Y\n keRuh65NFB82LkP1FnrUKPCSkkA/rYHude3JphfCT7cJa8ab9qSSae8oQRGbZ03i2/IU\n x59ivul+qXYRmRNDNKMNQqK2MqoEyITldXCzUUIR4baS5YeEdbfng+vDP30BH+/rAw3v\n 2/08WZHzmDi9Lyk1ZGySAQdfiJSwR4+mz9NqsYH6diLtMXn9zxLjopvqjy5fFffoG05F\n fp/pkRTwoBtxb1dzYZ5oN0yP8AuOAFmhQL0eHdIQNR4j9CKSPyzB9I4MMYnjM4oWyV+o\n 0rgQ==" ], "X-MC-Unique": "DGL65jU2NcOYnDvPN2NfKg-1", "X-Mimecast-MFC-AGG-ID": "DGL65jU2NcOYnDvPN2NfKg_1776853865", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776853864; x=1777458664;\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=+nQzf/D0K64i/5OlXj6ts+ZQEQEq47laODMb54sHduo=;\n b=kdIe6XiUmSnjdqmzg1GdNb5aXG/YpZHdjdTur8LELofrVt+MK9yetm4GOPS8L0T7KS\n qufgJUsqW9dA/doshIZ4hQ+uxVA1sOxrN9A6vq2jSHhaEzd+mZYSrMIwxXLShYZhbosA\n DlOM4LTxL3Gw8fa3mcz87bTKWgpugUH1uTxfRYNE+vMEe/kD9ji++QXFIAoN29AJWia+\n LJSLVPOHMQedzd4Kmc9hF9/x3aThx+OeJCMXiH0TBBA9Iugb0QOuG8mPmCZx/NVLUrG5\n rdeoW//ZK2SKxi7a4JPJ0K8oAbYrroeQIvgWAiq+Zxpx2m6XkUscUcId74K1daq9o20b\n fQmA==", "X-Gm-Message-State": "AOJu0YxN2KhkmHshXh33vj261tQt/rHue5sheUTroQubezO+IHSAnarS\n iID5syqOuWLWytlYhL/kXHcJBGf8xSzSWIvG/cuUNzGCrgU8XofeLcOYKZ4UVhGW2qltA2S/FIJ\n +TNHbzYjF98b8IOy1cY+aS0y82uXzYFz4LLA5qo5V6yqihV/pY0xiKay3hMJIpgNhc1MP9y8JXa\n MSaj3eaN9nWFeSj5OQ/s5J21jaivpu44sy4qp8K6E=", "X-Gm-Gg": "AeBDievUUIWT3Ou1wN7f6YDzFEH8XfTZAS4KA9EhhmarM2knMrg/JB6peeb7Toyb9fF\n NQZdVRYoRr4ti0OKKXoNeQKzFd8c7r4vxgfcut3lRaZsMNBkVFHILEc56X9gxutxwza5bWrbNPS\n mxPXdYTSUDrh//Tp+mFC43ZKGMATuYlA5aoQDr8kSJlGHNUX4WITA3t1Gbub+7LGugDKSvKMjjH\n g1m6pqCWnuCodvc6Y/4wPqVPvi/5PNJdivG1d5X98ch8yLja9hIkvMmjPwdkg0t8KNSwWCMMEFJ\n Gw8V+X/JX6kXotqssI3Wzle0fcWZ8dsnwr/qOMFE+JVDCL2M+N1bJ6YMoTBMkZwTFmtz9zCAPXZ\n KURJ/g1WWpf8sFG/lwwh0AH2pDR4/J8oCbHwgeY3pm3pomX+hJKCqpU5Fnoz9xGhBWXq5AhtxpQ\n ==", "X-Received": [ "by 2002:a17:90b:5543:b0:35f:b227:db86 with SMTP id\n 98e67ed59e1d1-361403af6a5mr22338597a91.2.1776853864438;\n Wed, 22 Apr 2026 03:31:04 -0700 (PDT)", "by 2002:a17:90b:5543:b0:35f:b227:db86 with SMTP id\n 98e67ed59e1d1-361403af6a5mr22338531a91.2.1776853863655;\n Wed, 22 Apr 2026 03:31:03 -0700 (PDT)" ], "From": "Arun Menon <armenon@redhat.com>", "To": "qemu-devel@nongnu.org", "Cc": "Zhao Liu <zhao1.liu@intel.com>,\n Stefan Berger <stefanb@linux.vnet.ibm.com>,\n Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,\n Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>,\n Fabiano Rosas <farosas@suse.de>, Igor Mammedov <imammedo@redhat.com>,\n marcandre.lureau@redhat.com,\n =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>,\n \"Michael S. Tsirkin\" <mst@redhat.com>, Yanan Wang <wangyanan55@huawei.com>,\n Ani Sinha <anisinha@redhat.com>, Arun Menon <armenon@redhat.com>", "Subject": "[PATCH v5 06/10] hw/tpm: Add support for VM migration with TPM CRB\n chunking", "Date": "Wed, 22 Apr 2026 16:00:14 +0530", "Message-ID": "<20260422103018.123608-7-armenon@redhat.com>", "X-Mailer": "git-send-email 2.53.0", "In-Reply-To": "<20260422103018.123608-1-armenon@redhat.com>", "References": "<20260422103018.123608-1-armenon@redhat.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=170.10.133.124; envelope-from=armenon@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, SPF_HELO_PASS=-0.001,\n 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": "From: Arun Menon <armenon@redhat.com>\n\n- Add subsection in VMState for TPM CRB with the newly introduced\n command and response buffer GByteArrays, along with a needed callback,\n so that newer QEMU only sends the buffers if it is necessary.\n- Implement a migration blocker to prevent migration of the VM if the\n user manually enables chunking capability, cap-chunk, but the machine\n type does not support it, using a new hw_compat property called\n allow_chunk_migration.\n- Add a post_load_errp hook so that during a migration, the buffers are\n validated before destination VM is started.\n\nSigned-off-by: Arun Menon <armenon@redhat.com>\n---\n hw/core/machine.c | 1 +\n hw/tpm/tpm_crb.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 72 insertions(+)", "diff": "diff --git a/hw/core/machine.c b/hw/core/machine.c\nindex 6d27cf69a2..b590af0125 100644\n--- a/hw/core/machine.c\n+++ b/hw/core/machine.c\n@@ -40,6 +40,7 @@\n \n GlobalProperty hw_compat_11_0[] = {\n { \"tpm-crb\", \"cap-chunk\", \"off\"},\n+ { \"tpm-crb\", \"x-allow-chunk-migration\", \"off\"},\n };\n const size_t hw_compat_11_0_len = G_N_ELEMENTS(hw_compat_11_0);\n \ndiff --git a/hw/tpm/tpm_crb.c b/hw/tpm/tpm_crb.c\nindex 29370d6f49..23e6948aee 100644\n--- a/hw/tpm/tpm_crb.c\n+++ b/hw/tpm/tpm_crb.c\n@@ -24,6 +24,7 @@\n #include \"hw/pci/pci_ids.h\"\n #include \"hw/acpi/tpm.h\"\n #include \"migration/vmstate.h\"\n+#include \"migration/blocker.h\"\n #include \"system/tpm_backend.h\"\n #include \"system/tpm_util.h\"\n #include \"system/reset.h\"\n@@ -51,6 +52,8 @@ struct CRBState {\n TPMPPI ppi;\n \n bool cap_chunk;\n+ bool allow_chunk_migration;\n+ Error *migration_blocker;\n };\n typedef struct CRBState CRBState;\n \n@@ -353,12 +356,63 @@ static int tpm_crb_pre_save(void *opaque)\n return 0;\n }\n \n+static bool tpm_crb_chunk_needed(void *opaque)\n+{\n+ CRBState *s = opaque;\n+\n+ if (!s->allow_chunk_migration) {\n+ return false;\n+ }\n+\n+ return ((s->command_buffer && s->command_buffer->len > 0) ||\n+ (s->response_buffer && s->response_buffer->len > 0));\n+}\n+\n+static bool tpm_crb_chunk_post_load(void *opaque, int version_id, Error **errp)\n+{\n+ CRBState *s = opaque;\n+\n+ if (!s->response_buffer || !s->command_buffer) {\n+ error_setg(errp, \"tpm-crb: Internal buffers are not allocated\");\n+ return false;\n+ }\n+ if (s->response_offset > s->response_buffer->len) {\n+ error_setg(errp, \"tpm-crb: Invalid response \"\n+ \"offset %\" PRIu32 \" in migration stream\",\n+ s->response_offset);\n+ return false;\n+ }\n+ if (s->response_buffer->len > s->be_buffer_size ||\n+ s->command_buffer->len > s->be_buffer_size) {\n+ error_setg(errp, \"tpm-crb: Buffer sizes exceed backend capacity\");\n+ return false;\n+ }\n+ return true;\n+}\n+\n+static const VMStateDescription vmstate_tpm_crb_chunk = {\n+ .name = \"tpm-crb/chunk\",\n+ .version_id = 0,\n+ .needed = tpm_crb_chunk_needed,\n+ .post_load_errp = tpm_crb_chunk_post_load,\n+ .fields = (const VMStateField[]) {\n+ VMSTATE_GBYTEARRAY(command_buffer, CRBState, 0),\n+ VMSTATE_GBYTEARRAY(response_buffer, CRBState, 0),\n+ VMSTATE_UINT32(response_offset, CRBState),\n+ VMSTATE_END_OF_LIST()\n+ }\n+};\n+\n static const VMStateDescription vmstate_tpm_crb = {\n .name = \"tpm-crb\",\n .pre_save = tpm_crb_pre_save,\n .fields = (const VMStateField[]) {\n VMSTATE_UINT32_ARRAY(regs, CRBState, TPM_CRB_R_MAX),\n VMSTATE_END_OF_LIST(),\n+ },\n+ .subsections = (const VMStateDescription * const []) {\n+ &vmstate_tpm_crb_chunk,\n+ NULL,\n }\n };\n \n@@ -366,6 +420,8 @@ static const Property tpm_crb_properties[] = {\n DEFINE_PROP_TPMBE(\"tpmdev\", CRBState, tpmbe),\n DEFINE_PROP_BOOL(\"ppi\", CRBState, ppi_enabled, true),\n DEFINE_PROP_BOOL(\"cap-chunk\", CRBState, cap_chunk, true),\n+ DEFINE_PROP_BOOL(\"x-allow-chunk-migration\", CRBState,\n+ allow_chunk_migration, true),\n };\n \n static void tpm_crb_reset(void *dev)\n@@ -422,6 +478,7 @@ static void tpm_crb_reset(void *dev)\n static void tpm_crb_realize(DeviceState *dev, Error **errp)\n {\n CRBState *s = CRB(dev);\n+ int ret;\n \n if (!tpm_find()) {\n error_setg(errp, \"at most one TPM device is permitted\");\n@@ -431,6 +488,15 @@ static void tpm_crb_realize(DeviceState *dev, Error **errp)\n error_setg(errp, \"'tpmdev' property is required\");\n return;\n }\n+ if (s->cap_chunk && !s->allow_chunk_migration) {\n+ error_setg(&s->migration_blocker,\n+ \"The tpm-crb device does not support chunk migration with \"\n+ \"machine version less than 11.1\");\n+ ret = migrate_add_blocker_normal(&s->migration_blocker, errp);\n+ if (ret < 0) {\n+ return;\n+ }\n+ }\n \n memory_region_init_io(&s->mmio, OBJECT(s), &tpm_crb_memory_ops, s,\n \"tpm-crb-mmio\", sizeof(s->regs));\n@@ -463,6 +529,11 @@ static void tpm_crb_unrealize(DeviceState *dev)\n \n g_clear_pointer(&s->command_buffer, g_byte_array_unref);\n g_clear_pointer(&s->response_buffer, g_byte_array_unref);\n+\n+ if (s->migration_blocker) {\n+ migrate_del_blocker(&s->migration_blocker);\n+ error_free(s->migration_blocker);\n+ }\n }\n \n static void tpm_crb_class_init(ObjectClass *klass, const void *data)\n", "prefixes": [ "v5", "06/10" ] }