memory: Flush coalesced MMIO on mapping and state changes

Flush pending coalesced MMIO before performing mapping or state changes
that could affect the event orderings or route the buffered requests to
a wrong region.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
diff --git a/memory.c b/memory.c
index 4deeeac..4f3ade0 100644
--- a/memory.c
+++ b/memory.c
@@ -733,6 +733,7 @@
 
 void memory_region_transaction_begin(void)
 {
+    qemu_flush_coalesced_mmio_buffer();
     ++memory_region_transaction_depth;
 }