From 7cb1c5e1416de9a09180f0930d2a216c77e8cdbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 30 Jan 2020 16:01:10 +0000 Subject: [PATCH 07/15] tpm-ppi: page-align PPI RAM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RH-Author: Marc-André Lureau Message-id: <20200130160110.126086-1-marcandre.lureau@redhat.com> Patchwork-id: 93600 O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH] tpm-ppi: page-align PPI RAM Bugzilla: 1787444 RH-Acked-by: Dr. David Alan Gilbert RH-Acked-by: Laszlo Ersek RH-Acked-by: Philippe Mathieu-Daudé post-copy migration fails on destination with error such as: 2019-12-26T10:22:44.714644Z qemu-kvm: ram_block_discard_range: Unaligned start address: 0x559d2afae9a0 Use qemu_memalign() to constrain the PPI RAM memory alignment. Cc: qemu-stable@nongnu.org Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Stefan Berger Signed-off-by: Stefan Berger Message-id: 20200103074000.1006389-3-marcandre.lureau@redhat.com BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1787444 Brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=26122940 (cherry picked from commit 71e415c8a75c130875f14d6b2136825789feb297) Signed-off-by: Marc-André Lureau Signed-off-by: Danilo C. L. de Paula --- hw/tpm/tpm_ppi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/tpm/tpm_ppi.c b/hw/tpm/tpm_ppi.c index ff31459..6d9c1a3 100644 --- a/hw/tpm/tpm_ppi.c +++ b/hw/tpm/tpm_ppi.c @@ -43,7 +43,8 @@ void tpm_ppi_reset(TPMPPI *tpmppi) void tpm_ppi_init(TPMPPI *tpmppi, struct MemoryRegion *m, hwaddr addr, Object *obj) { - tpmppi->buf = g_malloc0(HOST_PAGE_ALIGN(TPM_PPI_ADDR_SIZE)); + tpmppi->buf = qemu_memalign(qemu_real_host_page_size, + HOST_PAGE_ALIGN(TPM_PPI_ADDR_SIZE)); memory_region_init_ram_device_ptr(&tpmppi->ram, obj, "tpm-ppi", TPM_PPI_ADDR_SIZE, tpmppi->buf); vmstate_register_ram(&tpmppi->ram, DEVICE(obj)); -- 1.8.3.1