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 <[email protected]>
---
 hw/arm/armv7m.c         | 2 +-
 hw/arm/aspeed_ast27x0.c | 2 +-
 hw/arm/smmu-common.c    | 5 +++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c
index 7fa854bc14df..54d0d9f78207 100644
--- a/hw/arm/armv7m.c
+++ b/hw/arm/armv7m.c
@@ -117,7 +117,7 @@ static void bitband_realize(DeviceState *dev, Error **errp)
         return;
     }
 
-    address_space_init(&s->source_as, NULL, s->source_memory, 
"bitband-source");
+    address_space_init(&s->source_as, OBJECT(s), s->source_memory, "as");
 }
 
 /* Board init.  */
diff --git a/hw/arm/aspeed_ast27x0.c b/hw/arm/aspeed_ast27x0.c
index f8c0ac5f87df..7fe097ad3f11 100644
--- a/hw/arm/aspeed_ast27x0.c
+++ b/hw/arm/aspeed_ast27x0.c
@@ -387,7 +387,7 @@ static bool aspeed_soc_ast2700_dram_init(DeviceState *dev, 
Error **errp)
     memory_region_init(&s->dram_container, OBJECT(s), "ram-container",
                        ram_size);
     memory_region_add_subregion(&s->dram_container, 0, s->dram_mr);
-    address_space_init(&s->dram_as, NULL, s->dram_mr, "dram");
+    address_space_init(&s->dram_as, OBJECT(s), s->dram_mr, "dram-as");
 
     /*
      * Add a memory region beyond the RAM region to emulate
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
index 081c50750947..7c1648165b9f 100644
--- a/hw/arm/smmu-common.c
+++ b/hw/arm/smmu-common.c
@@ -863,6 +863,7 @@ static AddressSpace *smmu_find_add_as(PCIBus *bus, void 
*opaque, int devfn)
     sdev = sbus->pbdev[devfn];
     if (!sdev) {
         char *name = g_strdup_printf("%s-%d-%d", s->mrtypename, devfn, 
index++);
+        g_autofree char *as_name = g_strconcat(name, "-as", NULL);
 
         sdev = sbus->pbdev[devfn] = g_new0(SMMUDevice, 1);
 
@@ -873,8 +874,8 @@ static AddressSpace *smmu_find_add_as(PCIBus *bus, void 
*opaque, int devfn)
         memory_region_init_iommu(&sdev->iommu, sizeof(sdev->iommu),
                                  s->mrtypename,
                                  OBJECT(s), name, UINT64_MAX);
-        address_space_init(&sdev->as, NULL,
-                           MEMORY_REGION(&sdev->iommu), name);
+        address_space_init(&sdev->as, OBJECT(s),
+                           MEMORY_REGION(&sdev->iommu), as_name);
         trace_smmu_add_mr(name);
         g_free(name);
     }

-- 
2.51.0


Reply via email to