aboutsummaryrefslogtreecommitdiff
path: root/arch_init.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2013-08-19 17:26:52 +0300
committerMichael S. Tsirkin <mst@redhat.com>2013-08-21 00:18:39 +0300
commit0851c9f75ccb0baf28f5bf901b9ffe3c91fcf969 (patch)
tree87334710c73cdace76979bd9762c7eb35fd843b2 /arch_init.c
parentc0b4cc1f9f4df9d7459dc778e64f00a4e781fd88 (diff)
arch_init: align MR size to target page size
Migration code assumes that each MR is a multiple of TARGET_PAGE_SIZE: MR size is divided by TARGET_PAGE_SIZE, so if it isn't migration never completes. But this isn't really required for regions set up with memory_region_init_ram, since that calls qemu_ram_alloc which aligns size up using TARGET_PAGE_ALIGN. Align MR size up to full target page sizes, this way migration completes even if we create a RAM MR which is not a full target page size. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'arch_init.c')
-rw-r--r--arch_init.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch_init.c b/arch_init.c
index 68a7ab784f..ac8eb593c9 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -342,7 +342,8 @@ ram_addr_t migration_bitmap_find_and_reset_dirty(MemoryRegion *mr,
{
unsigned long base = mr->ram_addr >> TARGET_PAGE_BITS;
unsigned long nr = base + (start >> TARGET_PAGE_BITS);
- unsigned long size = base + (int128_get64(mr->size) >> TARGET_PAGE_BITS);
+ uint64_t mr_size = TARGET_PAGE_ALIGN(memory_region_size(mr));
+ unsigned long size = base + (mr_size >> TARGET_PAGE_BITS);
unsigned long next;