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