From 1e32685272ff1932b9ca022db8717720fc901d0e Mon Sep 17 00:00:00 2001 From: tangbinzy Date: Mon, 6 Nov 2023 06:17:47 +0000 Subject: [PATCH] tpm_crb: mark command buffer as dirty on request completion mainline inclusion commit e37a0ef4605e5d2041785ff3fc89ca6021faf7a0 category: bugfix --------------------------------------------------------------- At the moment, there doesn't seems to be any way to know that QEMU made modification to the command buffer. This is potentially an issue on Xen while migrating a guest, as modification to the buffer after the migration as started could be ignored and not transfered to the destination. Mark the memory region of the command buffer as dirty once a request is completed. Signed-off-by: Anthony PERARD Reviewed-by: Stefan Berger Signed-off-by: Stefan Berger Message-id: 20220411144749.47185-1-anthony.perard@citrix.com Signed-off-by: tangbinzy --- hw/tpm/tpm_crb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/tpm/tpm_crb.c b/hw/tpm/tpm_crb.c index 58ebd1469c..c05972736a 100644 --- a/hw/tpm/tpm_crb.c +++ b/hw/tpm/tpm_crb.c @@ -196,6 +196,7 @@ static void tpm_crb_request_completed(TPMIf *ti, int ret) ARRAY_FIELD_DP32(s->regs, CRB_CTRL_STS, tpmSts, 1); /* fatal error */ } + memory_region_set_dirty(&s->cmdmem, 0, CRB_CTRL_CMD_SIZE); } static enum TPMVersion tpm_crb_get_version(TPMIf *ti) -- 2.27.0