[Qemu-devel] [PULL 07/35] pam: wrap MemoryRegion initialization in a transaction

Paolo Bonzini posted 35 patches 5 years, 6 months ago
There is a newer version of this series
[Qemu-devel] [PULL 07/35] pam: wrap MemoryRegion initialization in a transaction
Posted by Paolo Bonzini 5 years, 6 months ago
This avoids a few re-rendering of the memory AddressSpace.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/pci-host/pam.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/pci-host/pam.c b/hw/pci-host/pam.c
index e361ecb7ee..aa5ecfd0c2 100644
--- a/hw/pci-host/pam.c
+++ b/hw/pci-host/pam.c
@@ -52,11 +52,13 @@ void init_pam(DeviceState *dev, MemoryRegion *ram_memory,
     memory_region_init_alias(&mem->alias[2], OBJECT(dev), "pam-pci", ram_memory,
                              start, size);
 
+    memory_region_transaction_begin();
     for (i = 0; i < 4; ++i) {
         memory_region_set_enabled(&mem->alias[i], false);
         memory_region_add_subregion_overlap(system_memory, start,
                                             &mem->alias[i], 1);
     }
+    memory_region_transaction_commit();
     mem->current = 0;
 }
 
-- 
2.20.1