@@ -116,7 +116,6 @@ uint64_t memory_device_get_free_addr(MachineState *ms, const uint64_t *hint,
address_space_start = ms->device_memory->base;
address_space_end = address_space_start +
memory_region_size(&ms->device_memory->mr);
- g_assert(QEMU_ALIGN_UP(address_space_start, align) == address_space_start);
g_assert(address_space_end >= address_space_start);
memory_device_check_addable(ms, size, errp);
@@ -149,7 +148,7 @@ uint64_t memory_device_get_free_addr(MachineState *ms, const uint64_t *hint,
return 0;
}
} else {
- new_addr = address_space_start;
+ new_addr = QEMU_ALIGN_UP(address_space_start, align);
}
/* find address range that will fit new memory device */
The start of the address space does not have to be aligned for the search. Handle this case explicitly when starting the search for a new address. Signed-off-by: David Hildenbrand <david@redhat.com> --- hw/mem/memory-device.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)