memory: allow destroying a non-empty MemoryRegion
commit91232d98da2bfe042d4c5744076b488880de3040
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 1 Oct 2015 08:59:50 +0000 (1 10:59 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Wed, 28 Oct 2015 19:46:06 +0000 (28 14:46 -0500)
tree23932470e25af6af8bddf393d66808528a1553c1
parentd68ba3cab357f73aa74525f86f5da448b39ae34a
memory: allow destroying a non-empty MemoryRegion

This is legal; the MemoryRegion will simply unreference all the
existing subregions and possibly bring them down with it as well.
However, it requires a bit of care to avoid an infinite loop.
Finalizing a memory region cannot trigger an address space update,
but memory_region_del_subregion errs on the side of caution and
might trigger a spurious update: avoid that by resetting mr->enabled
first.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1443689999-12182-2-git-send-email-armbru@redhat.com>
(cherry picked from commit 2e2b8eb70fdb7dfbec39f3a19b20f9a73f2f813e)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
memory.c