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 <od...@rsg.ci.i.u-tokyo.ac.jp>
---
 hw/riscv/riscv-iommu.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/hw/riscv/riscv-iommu.c b/hw/riscv/riscv-iommu.c
index aed84d87a823..6e2962f8331b 100644
--- a/hw/riscv/riscv-iommu.c
+++ b/hw/riscv/riscv-iommu.c
@@ -1221,8 +1221,8 @@ static AddressSpace *riscv_iommu_space(RISCVIOMMUState 
*s, uint32_t devid)
         memory_region_init_iommu(&as->iova_mr, sizeof(as->iova_mr),
             TYPE_RISCV_IOMMU_MEMORY_REGION,
             OBJECT(as), "riscv_iommu", UINT64_MAX);
-        address_space_init(&as->iova_as, NULL, MEMORY_REGION(&as->iova_mr),
-                           name);
+        address_space_init(&as->iova_as, OBJECT(s), 
MEMORY_REGION(&as->iova_mr),
+                           "iova-as");
 
         QLIST_INSERT_HEAD(&s->spaces, as, list);
 
@@ -2427,8 +2427,8 @@ static void riscv_iommu_realize(DeviceState *dev, Error 
**errp)
     /* Memory region for downstream access, if specified. */
     if (s->target_mr) {
         s->target_as = g_new0(AddressSpace, 1);
-        address_space_init(s->target_as, NULL, s->target_mr,
-            "riscv-iommu-downstream");
+        address_space_init(s->target_as, OBJECT(s), s->target_mr,
+                           "downstream-as");
     } else {
         /* Fallback to global system memory. */
         s->target_as = &address_space_memory;
@@ -2437,7 +2437,7 @@ static void riscv_iommu_realize(DeviceState *dev, Error 
**errp)
     /* Memory region for untranslated MRIF/MSI writes */
     memory_region_init_io(&s->trap_mr, OBJECT(dev), &riscv_iommu_trap_ops, s,
             "riscv-iommu-trap", ~0ULL);
-    address_space_init(&s->trap_as, NULL, &s->trap_mr, "riscv-iommu-trap-as");
+    address_space_init(&s->trap_as, OBJECT(s), &s->trap_mr, "trap-as");
 
     if (s->cap & RISCV_IOMMU_CAP_HPM) {
         s->hpm_timer =

-- 
2.51.0


Reply via email to