This series is an approach to MemoryRegion QOMification that is complementary to Peter's posted patches. Instead of focusing on properties, it places attention on modeling the lifetime of memory regions correctly. MemoryRegions are added to the QOM tree as children of their owner device, and analogously to what was done for devices, memory_region_destroy becomes a simple forwarder for object_unparent. Still, I am including Peter's refactorings and also read-only access to region properties.
In fact, with this change memory_region_destroy becomes mostly obsolete, because when the owner dies the children memory regions will be unparented themselves and then (as they lose the last ref) finalized. In other words, this effectively achieves the same as http://lists.gnu.org/archive/html/qemu-devel/2013-09/msg00477.html except it does this by way of removing code rather than adding it! Indeed I have a follow-up that drops all but 7 calls to memory_region_destroy. I have already applied patches 5 and 6 to the memory branch. Paolo Bonzini (5): qom: move unparenting to the child property's release callback qom: delete properties before calling instance_finalize memory: MemoryRegion: use /machine as default owner memory: MemoryRegion: rename parent to container memory: MemoryRegion: replace owner field with QOM parent Peter Crosthwaite (8): qom: object: Ignore refs/unrefs of NULL qom: object: remove parent pointer when unparenting memory: MemoryRegion: factor out subregion add functionality memory: MemoryRegion: factor out memory region re-adder memory: MemoryRegion: QOMify memory: MemoryRegion: Add container and addr props memory: MemoryRegion: Add may-overlap and priority props memory: MemoryRegion: Add size property exec.c | 4 +- include/exec/memory.h | 29 +++--- memory.c | 255 ++++++++++++++++++++++++++++++++++++++++---------- qom/object.c | 29 +++--- 4 files changed, 235 insertions(+), 82 deletions(-) -- 1.8.3.1