Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2195849/?format=api
{ "id": 2195849, "url": "http://patchwork.ozlabs.org/api/patches/2195849/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260212062522.99565-30-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-30-anisinha@redhat.com>", "list_archive_url": null, "date": "2026-02-12T06:25:13", "name": "[v4,29/31] kvm/clock: add support for confidential guest reset", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "7443f2af557a8ee165119d59a809b4641823b3f8", "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-30-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/2195849/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2195849/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=EAHInAtM;\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=kUnNFuxZ;\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 4fBQPK0WF6z1xvb\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 12 Feb 2026 17:29:09 +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 1vqQBL-0001xW-7U; Thu, 12 Feb 2026 01:28:07 -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 1vqQAf-0000Wj-K2\n for qemu-devel@nongnu.org; Thu, 12 Feb 2026 01:27:27 -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 1vqQAe-0005N8-42\n for qemu-devel@nongnu.org; Thu, 12 Feb 2026 01:27:25 -0500", "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-294-ul1nktETPOCk9CrqhzWFfg-1; Thu, 12 Feb 2026 01:27:21 -0500", "by mail-pj1-f69.google.com with SMTP id\n 98e67ed59e1d1-354bc535546so5947833a91.3\n for <qemu-devel@nongnu.org>; Wed, 11 Feb 2026 22:27:20 -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.27.16\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 11 Feb 2026 22:27:19 -0800 (PST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1770877642;\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=ampkMXpvZM0Uh9Dio1wYKLx68wPyoO/FMFpvVez+X64=;\n b=EAHInAtMfLUqLNU60tFKgQkAMG7PEI1+kHgdqzg4vJs0WtSEAh4lECZoHMb9eePqhcS3KO\n JbJnek5B2oT4Y97JqNgD5uD3xZrKcOhyIXD7Snz4rvSzrxkATMsPZam9dSHlT8r915PAlL\n z4lYGZ53N9oWwUsq5xky8Wunhbj4JYs=", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=redhat.com; s=google; t=1770877640; x=1771482440; 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=ampkMXpvZM0Uh9Dio1wYKLx68wPyoO/FMFpvVez+X64=;\n b=kUnNFuxZdVe+YcJhZAmfxiabz+UT5yea43Dk47tw9n8F0SglIquhsREk/Dc8w53/ti\n yYDl53usb3k5THgMNxgzEGQ6Yh7snLDQGrkp1gzY5Dy/V7V+s0T4d8NV1QPJrAcAxUUT\n /vQlwAIfC9aodDl7THLPmmHCcHwO+V1f9rUxQJl/3KX0sEkXhlQ2TGCcXrSvFu3AhCxl\n bVClEBlwM7BKrxTqdlK0OLpaDHMKdvsP+S7VYs4FdCpruIxVOCKMiOhyFawHVrv79mAz\n c8IaiB2MXSJcMqyPYHkrib3/PkRba0XAfCEmqVJEUPtm2uangNx7DDuoDdCpkd5L/Ayp\n UgBw==" ], "X-MC-Unique": "ul1nktETPOCk9CrqhzWFfg-1", "X-Mimecast-MFC-AGG-ID": "ul1nktETPOCk9CrqhzWFfg_1770877640", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1770877640; x=1771482440;\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=ampkMXpvZM0Uh9Dio1wYKLx68wPyoO/FMFpvVez+X64=;\n b=JUqH7vI6mfno8WP43u9x9h9E7bNluu4hpxKG6T5ixPVBbFgVT+b25zs+8ajjvm2Opv\n GOxNvmbbzH0xnfWojNYo/rmv2osginqNiLE9/YP409nnUapaz3j39tLF3mIKfKM1Fe85\n dE59Ky8ZQOrq0BP2BIPYKzY7i48t30W+pBdoKZkAMPM+Ogqd7lQtcyhKUPkUjQakt3A9\n E8cFVomdEjej/sCgcNXRmOfYSh+RQ5G2vEGHyWLJe6Tho4XfY3JfdZhbX/KYZUW5MZHA\n j8KLRUuVxu9eYGHgibS+Ej+H9HnufI8antud3S646G/frBfa0nYzJ4wbnhleMdJrmr5z\n JKDg==", "X-Forwarded-Encrypted": "i=1;\n AJvYcCXV/Y0x7FzSNwB5o9axdnSZeoHukKvLdo35+JLWHAUw7L9WkbZrH1pQqnMJCWclNmtr5lFoTmhkyabQ@nongnu.org", "X-Gm-Message-State": "AOJu0YzSo4xnP+V1mQzS13US91w7fkL8c/kEKlLrLsu/K5rhW8vXLZJT\n wREB4O/EuK+63qQ/x9qhmNGHrad/ZHJAYoLCthGEMStUs6p9KQB2bhL/FfrEMOQmcsTe8ZGhmTa\n A+ZCr6QdXSwGz4Ik560HadgJwad/afSBuDn8ejqspH/wbBZBYeq8BVs/7", "X-Gm-Gg": "AZuq6aIQElMcD7LFvIbK+piTart4rWtBcuiiBuj8g8p+rbJUQiK/oJ2qCQ19px2L60g\n ya1R97DiXIE4vFuTGvOUQd5FQLpfO3I+Krte9Yl602ssAh446CX09SzA0dxKh9gWI3yqOdEOfCF\n 4zS0pIhI8IfudgVziipagd1+MiZ9psJCHC5zIjfFly0ioFiVh2szcCB3WgfQRIMSP2j5RJFDQI1\n ushv8kggzrXmPXKfGbv9GXeX4RVnfOUYgdlCjmx7ugYfYYjcYinHuaK89pYyFZkZQ9VGl++vCjl\n QY5xSDjqiYUyuRg6tVnLYJPOjCxYSaxlPkR24wDnZ+1xt+R0Dy+01jtYTPkTcbMw0iMUwSuRERg\n XN4nzwGQR9jQHS9hMt+zeolR9bG5up2BxgjZK4XcRFTxWzcPJQzFgFSk=", "X-Received": [ "by 2002:a17:90b:520e:b0:341:8491:472a with SMTP id\n 98e67ed59e1d1-3568f2e017fmr1860998a91.4.1770877639783;\n Wed, 11 Feb 2026 22:27:19 -0800 (PST)", "by 2002:a17:90b:520e:b0:341:8491:472a with SMTP id\n 98e67ed59e1d1-3568f2e017fmr1860982a91.4.1770877639375;\n Wed, 11 Feb 2026 22:27:19 -0800 (PST)" ], "From": "Ani Sinha <anisinha@redhat.com>", "To": "\"Michael S. Tsirkin\" <mst@redhat.com>,\n Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,\n Paolo Bonzini <pbonzini@redhat.com>,\n Richard Henderson <richard.henderson@linaro.org>,\n Eduardo Habkost <eduardo@habkost.net>", "Cc": "kraxel@redhat.com, Ani Sinha <anisinha@redhat.com>, qemu-devel@nongnu.org", "Subject": "[PATCH v4 29/31] kvm/clock: add support for confidential guest reset", "Date": "Thu, 12 Feb 2026 11:55:13 +0530", "Message-ID": "<20260212062522.99565-30-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": "Confidential guests change the KVM VM file descriptor upon reset and also create\nnew VCPU file descriptors against the new KVM VM file descriptor. We need to\nsave the clock state from kvm before KVM VM file descriptor changes and restore\nit after. Also after VCPU file descriptors changed, we must call\nKVM_KVMCLOCK_CTRL on the VCPU file descriptor to inform KVM that the VCPU is\nin paused state.\n\nSigned-off-by: Ani Sinha <anisinha@redhat.com>\n---\n hw/i386/kvm/clock.c | 59 +++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 59 insertions(+)", "diff": "diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c\nindex aba6842a22..10d34254f0 100644\n--- a/hw/i386/kvm/clock.c\n+++ b/hw/i386/kvm/clock.c\n@@ -50,6 +50,9 @@ struct KVMClockState {\n /* whether the 'clock' value was obtained in a host with\n * reliable KVM_GET_CLOCK */\n bool clock_is_reliable;\n+\n+ NotifierWithReturn kvmclock_vcpufd_change_notifier;\n+ NotifierWithReturn kvmclock_vmfd_change_notifier;\n };\n \n struct pvclock_vcpu_time_info {\n@@ -63,6 +66,9 @@ struct pvclock_vcpu_time_info {\n uint8_t pad[2];\n } __attribute__((__packed__)); /* 32 bytes */\n \n+static int kvmclock_set_clock(NotifierWithReturn *notifier,\n+ void *data, Error** errp);\n+\n static uint64_t kvmclock_current_nsec(KVMClockState *s)\n {\n CPUState *cpu = first_cpu;\n@@ -219,6 +225,54 @@ static void kvmclock_vm_state_change(void *opaque, bool running,\n }\n }\n \n+static int kvmclock_save_clock(NotifierWithReturn *notifier,\n+ void *data, Error** errp)\n+{\n+ if (!((VmfdChangeNotifier *)data)->pre) {\n+ return 0;\n+ }\n+ KVMClockState *s = container_of(notifier, KVMClockState,\n+ kvmclock_vmfd_change_notifier);\n+ kvm_update_clock(s);\n+ return 0;\n+}\n+\n+static int kvmclock_set_clock(NotifierWithReturn *notifier,\n+ void *data, Error** errp)\n+{\n+ struct kvm_clock_data clock_data = {};\n+ CPUState *cpu;\n+ int ret;\n+ KVMClockState *s = container_of(notifier, KVMClockState,\n+ kvmclock_vcpufd_change_notifier);\n+ int cap_clock_ctrl = kvm_check_extension(kvm_state, KVM_CAP_KVMCLOCK_CTRL);\n+\n+ if (!s->clock_is_reliable) {\n+ uint64_t pvclock_via_mem = kvmclock_current_nsec(s);\n+ /* saved clock value before vmfd change is not reliable */\n+ if (pvclock_via_mem) {\n+ s->clock = pvclock_via_mem;\n+ }\n+ }\n+\n+ clock_data.clock = s->clock;\n+ ret = kvm_vm_ioctl(kvm_state, KVM_SET_CLOCK, &clock_data);\n+ if (ret < 0) {\n+ fprintf(stderr, \"KVM_SET_CLOCK failed: %s\\n\", strerror(-ret));\n+ abort();\n+ }\n+\n+ if (!cap_clock_ctrl) {\n+ return 0;\n+ }\n+ CPU_FOREACH(cpu) {\n+ run_on_cpu(cpu, do_kvmclock_ctrl, RUN_ON_CPU_NULL);\n+ }\n+\n+ return 0;\n+}\n+\n+\n static void kvmclock_realize(DeviceState *dev, Error **errp)\n {\n KVMClockState *s = KVM_CLOCK(dev);\n@@ -230,7 +284,12 @@ static void kvmclock_realize(DeviceState *dev, Error **errp)\n \n kvm_update_clock(s);\n \n+ s->kvmclock_vcpufd_change_notifier.notify = kvmclock_set_clock;\n+ s->kvmclock_vmfd_change_notifier.notify = kvmclock_save_clock;\n+\n qemu_add_vm_change_state_handler(kvmclock_vm_state_change, s);\n+ kvm_vcpufd_add_change_notifier(&s->kvmclock_vcpufd_change_notifier);\n+ kvm_vmfd_add_change_notifier(&s->kvmclock_vmfd_change_notifier);\n }\n \n static bool kvmclock_clock_is_reliable_needed(void *opaque)\n", "prefixes": [ "v4", "29/31" ] }