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