]> git.proxmox.com Git - qemu.git/commitdiff
memory: populate FlatView for new address spaces
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 16 Apr 2013 13:39:51 +0000 (15:39 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 24 May 2013 16:43:42 +0000 (18:43 +0200)
Even a new address space might have a non-empty FlatView.  In order
to initialize it properly, address_space_init should (a) call
memory_region_transaction_commit after the address space is inserted
into the list; (b) force memory_region_transaction_commit to do something.

This bug was latent so far because all address spaces started empty, including
the PCI address space where the bus master region is initially disabled.
However, the target address space of an IOMMU is usually rooted at
get_system_memory(), which might not be empty at the time the IOMMU is created.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
memory.c

index 9478f98fdc42b3410330beb29d1866ef032948a9..99f046d8bbc4e5f4750e4a4ba6e4247d4c143773 100644 (file)
--- a/memory.c
+++ b/memory.c
@@ -1576,8 +1576,9 @@ void address_space_init(AddressSpace *as, MemoryRegion *root)
     as->ioeventfds = NULL;
     QTAILQ_INSERT_TAIL(&address_spaces, as, address_spaces_link);
     as->name = NULL;
-    memory_region_transaction_commit();
     address_space_init_dispatch(as);
+    memory_region_update_pending |= root->enabled;
+    memory_region_transaction_commit();
 }
 
 void address_space_destroy(AddressSpace *as)