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 <anthony.per...@citrix.com> > 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