hostmem: Apply merge property after the memory region is initialized
JIRA: https://issues.redhat.com/browse/RHEL-58936
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=64670258
Upstream Status: Yes
Tested: Passed, no core dump on hostmem backend with merge property
The merge property of the hostmem backend can be applied even its memory
region isn't initialized. This leads to a core dump as the following
messages indicate.
host$ /usr/libexec/qemu-kvm -cpu host \
-object memory-backend-ram,id=mem0,size=4096M,merge=off
qemu-kvm: ../system/memory.c:2419: \
void *memory_region_get_ram_ptr(MemoryRegion *): Assertion `mr->ram_block' failed.
Aborted (core dumped)
Fix it by picking up the upstream commit 78c8f780d3f0 ("hostmem: Apply
merge property after the memory region is initialized") so that the
merge property won't be applied until the memory region is initialized.
Signed-off-by: Gavin Shan gshan@redhat.com