Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BDF50C433F5 for ; Tue, 10 May 2022 14:07:17 +0000 (UTC) Received: from localhost ([::1]:41524 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1noQWC-0002rl-P6 for qemu-devel@archiver.kernel.org; Tue, 10 May 2022 10:07:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46652) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1noQNW-0001c4-09 for qemu-devel@nongnu.org; Tue, 10 May 2022 09:58:18 -0400 Received: from esa5.hc3370-68.iphmx.com ([216.71.155.168]:58942) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1noQNS-0001jl-VD for qemu-devel@nongnu.org; Tue, 10 May 2022 09:58:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1652191094; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Kmx9wk4cMDDQPxc1uDfODGSdxjNm0ceeqq+ghc9uyG0=; b=MNZI2lZt9+PB6TvjvjxceV3wAWPsjmjTeNPy//lScOChoIrklGIQXgjq lzPK40Ktsiy5BfIpSJJOauKTeSobPfXCsSOh7FNVEdmAlwFNDZsemyEJf 6X9HL45Hsn8IMe8qd6LtqYz6RGDiJulhTIsH8rbxilGnzS/Ewa7wk5TtR k=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 70368361 X-Ironport-Server: esa5.h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B727JiLKxLsHI8gPUIDnHhilQs/u7ilp/hY7VZuTCHMEupUWLd/Rus48LmFsG3oH yV3bKO3J+FkeLSmOEH/qNdLRXhTdCRTLc2n8KR/K7/cSjeK7Ul8Upc9N5t6I9w790mU/8+Vl kyAtrhwkgSg3yGXclXaAp2hAZu2NatCQbsAFXREFT6VN7ILO+5DMI93m0MLQIQa IronPort-HdrOrdr: A9a23:8wudLKDj2vVi7EblHems55DYdb4zR+YMi2TC1yhKJyC9Vvbo8/ xG/c5rsCMc5wx9ZJhNo7y90ey7MBThHP1OkOss1NWZPDUO0VHAROoJ0WKh+UyCJ8SXzJ866U 4KSclD4bPLYmRHsQ== X-IronPort-AV: E=Sophos;i="5.91,214,1647316800"; d="scan'208";a="70368361" Date: Tue, 10 May 2022 14:58:08 +0100 To: Stefan Berger CC: , =?iso-8859-1?Q?Marc-Andr=E9?= Lureau , Eric Auger , Stefan Berger Subject: Re: [PATCH] tpm_crb: mark command buffer as dirty on request completion Message-ID: References: <20220411144749.47185-1-anthony.perard@citrix.com> <1610a1ff-435e-e286-6bd7-a820630b865d@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1610a1ff-435e-e286-6bd7-a820630b865d@linux.ibm.com> Received-SPF: pass client-ip=216.71.155.168; envelope-from=prvs=12211c048=anthony.perard@citrix.com; helo=esa5.hc3370-68.iphmx.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: Anthony PERARD From: Anthony PERARD via On Mon, Apr 11, 2022 at 12:31:01PM -0400, Stefan Berger wrote: > On 4/11/22 10:47, Anthony PERARD wrote: > > From: Anthony PERARD > The state of the registers is saved using this here: > > static const VMStateDescription vmstate_tpm_crb = { > .name = "tpm-crb", > .pre_save = tpm_crb_pre_save, > .fields = (VMStateField[]) { > VMSTATE_UINT32_ARRAY(regs, CRBState, TPM_CRB_R_MAX), > VMSTATE_END_OF_LIST(), > } > }; > > The buffer with the commands is not part of this. So likely it needs to be > marked dirty but then I am not sure whether that is going to work if the > response to a command on the CRB is only received when tpm_crb_pre_save() is > called.. Maybe this buffer would have to be save explicitly in a .save > function or also as part of vmstate_tpm_crb... ? I did some research on migration of a guest with Xen toolstack, and I think there is one last round of sending memory marked as dirty after we call "xen-save-devices-state" (with the guest suspended), that's when tpm_crb_pre_save() is called. Hopefully, when QEMU is in charge of migration, it does the same thing and there would not be a need to save the buffer in vmstate of this device. Cheers, -- Anthony PERARD