[PATCH 20/35] hw/remote: QOM-ify AddressSpace

Akihiko Odaki posted 35 patches 1 month, 4 weeks ago
[PATCH 20/35] hw/remote: QOM-ify AddressSpace
Posted by Akihiko Odaki 1 month, 4 weeks ago
Make AddressSpaces QOM objects to ensure that they are destroyed when
their owners are finalized and also to get a unique path for debugging
output.

The name arguments were used to distinguish AddresSpaces in debugging
output, but they will represent property names after QOM-ification and
debugging output will show QOM paths. So change them to make them more
concise and also avoid conflicts with other properties.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
---
 hw/remote/iommu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/remote/iommu.c b/hw/remote/iommu.c
index aac5c178ec81..89d79e9480da 100644
--- a/hw/remote/iommu.c
+++ b/hw/remote/iommu.c
@@ -54,7 +54,7 @@ static AddressSpace *remote_iommu_find_add_as(PCIBus *pci_bus,
     if (!elem->mr) {
         elem->mr = MEMORY_REGION(object_new(TYPE_MEMORY_REGION));
         memory_region_set_size(elem->mr, UINT64_MAX);
-        address_space_init(&elem->as, NULL, elem->mr, NULL);
+        address_space_init(&elem->as, OBJECT(iommu), elem->mr, "as");
     }
 
     qemu_mutex_unlock(&iommu->lock);
@@ -73,7 +73,7 @@ void remote_iommu_unplug_dev(PCIDevice *pci_dev)
 
     elem = container_of(as, RemoteIommuElem, as);
 
-    address_space_destroy(&elem->as);
+    object_unparent(OBJECT(&elem->as));
 
     object_unref(elem->mr);
 

-- 
2.51.0