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/pci-host/astro.c       | 3 +--
 hw/pci-host/designware.c  | 5 ++---
 hw/pci-host/dino.c        | 4 ++--
 hw/pci-host/gt64120.c     | 2 +-
 hw/pci-host/pnv_phb3.c    | 4 ++--
 hw/pci-host/pnv_phb4.c    | 4 ++--
 hw/pci-host/ppc440_pcix.c | 2 +-
 hw/pci-host/ppce500.c     | 2 +-
 hw/pci-host/raven.c       | 2 +-
 9 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/hw/pci-host/astro.c b/hw/pci-host/astro.c
index bb6b7d05582f..19f6a7ac88f4 100644
--- a/hw/pci-host/astro.c
+++ b/hw/pci-host/astro.c
@@ -835,8 +835,7 @@ static void astro_realize(DeviceState *obj, Error **errp)
     memory_region_init_iommu(&s->iommu, sizeof(s->iommu),
                              TYPE_ASTRO_IOMMU_MEMORY_REGION, OBJECT(s),
                              "iommu-astro", UINT64_MAX);
-    address_space_init(&s->iommu_as, NULL, MEMORY_REGION(&s->iommu),
-                       "bm-pci");
+    address_space_init(&s->iommu_as, OBJECT(s), MEMORY_REGION(&s->iommu), 
"as");
 
     /* Create Elroys (PCI host bus chips).  */
     for (i = 0; i < ELROY_NUM; i++) {
diff --git a/hw/pci-host/designware.c b/hw/pci-host/designware.c
index d67211c9bc74..a542f6e9b1b1 100644
--- a/hw/pci-host/designware.c
+++ b/hw/pci-host/designware.c
@@ -706,9 +706,8 @@ static void designware_pcie_host_realize(DeviceState *dev, 
Error **errp)
                        UINT64_MAX);
     memory_region_add_subregion(&s->pci.address_space_root,
                                 0x0, &s->pci.memory);
-    address_space_init(&s->pci.address_space, NULL,
-                       &s->pci.address_space_root,
-                       "pcie-bus-address-space");
+    address_space_init(&s->pci.address_space, OBJECT(s),
+                       &s->pci.address_space_root, "as");
     pci_setup_iommu(pci->bus, &designware_iommu_ops, s);
 
     qdev_realize(DEVICE(&s->root), BUS(pci->bus), &error_fatal);
diff --git a/hw/pci-host/dino.c b/hw/pci-host/dino.c
index b78167fd2fcd..d213478c86ce 100644
--- a/hw/pci-host/dino.c
+++ b/hw/pci-host/dino.c
@@ -434,14 +434,14 @@ static void dino_pcihost_realize(DeviceState *dev, Error 
**errp)
     memory_region_add_subregion(&s->bm, 0xfff00000,
                                 &s->bm_cpu_alias);
 
-    address_space_init(&s->bm_as, NULL, &s->bm, "pci-bm");
+    address_space_init(&s->bm_as, OBJECT(s), &s->bm, "as");
 }
 
 static void dino_pcihost_unrealize(DeviceState *dev)
 {
     DinoState *s = DINO_PCI_HOST_BRIDGE(dev);
 
-    address_space_destroy(&s->bm_as);
+    object_unparent(OBJECT(&s->bm_as));
 }
 
 static void dino_pcihost_init(Object *obj)
diff --git a/hw/pci-host/gt64120.c b/hw/pci-host/gt64120.c
index 68ad885edbe4..89c4cf0bd5f8 100644
--- a/hw/pci-host/gt64120.c
+++ b/hw/pci-host/gt64120.c
@@ -1198,7 +1198,7 @@ static void gt64120_realize(DeviceState *dev, Error 
**errp)
     memory_region_init_io(&s->ISD_mem, OBJECT(dev), &isd_mem_ops, s,
                           "gt64120-isd", 0x1000);
     memory_region_init(&s->pci0_mem, OBJECT(dev), "pci0-mem", 4 * GiB);
-    address_space_init(&s->pci0_mem_as, NULL, &s->pci0_mem, "pci0-mem");
+    address_space_init(&s->pci0_mem_as, OBJECT(s), &s->pci0_mem, "as");
     phb->bus = pci_root_bus_new(dev, "pci",
                                 &s->pci0_mem,
                                 get_system_io(),
diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c
index 73592c9cbd3d..554ad034b6f4 100644
--- a/hw/pci-host/pnv_phb3.c
+++ b/hw/pci-host/pnv_phb3.c
@@ -956,8 +956,8 @@ static AddressSpace *pnv_phb3_dma_iommu(PCIBus *bus, void 
*opaque, int devfn)
         memory_region_init_iommu(&ds->dma_mr, sizeof(ds->dma_mr),
                                  TYPE_PNV_PHB3_IOMMU_MEMORY_REGION,
                                  OBJECT(phb), "phb3_iommu", UINT64_MAX);
-        address_space_init(&ds->dma_as, NULL, MEMORY_REGION(&ds->dma_mr),
-                           "phb3_iommu");
+        address_space_init(&ds->dma_as, OBJECT(phb), 
MEMORY_REGION(&ds->dma_mr),
+                           "as");
         memory_region_init_io(&ds->msi32_mr, OBJECT(phb), &pnv_phb3_msi_ops,
                               ds, "msi32", 0x10000);
         memory_region_init_io(&ds->msi64_mr, OBJECT(phb), &pnv_phb3_msi_ops,
diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
index 9db9268358d1..0d7643e36036 100644
--- a/hw/pci-host/pnv_phb4.c
+++ b/hw/pci-host/pnv_phb4.c
@@ -1469,8 +1469,8 @@ static AddressSpace *pnv_phb4_dma_iommu(PCIBus *bus, void 
*opaque, int devfn)
         memory_region_init_iommu(&ds->dma_mr, sizeof(ds->dma_mr),
                                  TYPE_PNV_PHB4_IOMMU_MEMORY_REGION,
                                  OBJECT(phb), name, UINT64_MAX);
-        address_space_init(&ds->dma_as, NULL, MEMORY_REGION(&ds->dma_mr),
-                           name);
+        address_space_init(&ds->dma_as, OBJECT(phb), 
MEMORY_REGION(&ds->dma_mr),
+                           "as");
         memory_region_init_io(&ds->msi32_mr, OBJECT(phb), &pnv_phb4_msi_ops,
                               ds, "msi32", 0x10000);
         memory_region_init_io(&ds->msi64_mr, OBJECT(phb), &pnv_phb4_msi_ops,
diff --git a/hw/pci-host/ppc440_pcix.c b/hw/pci-host/ppc440_pcix.c
index 3fe24d70ac30..6500871f48ae 100644
--- a/hw/pci-host/ppc440_pcix.c
+++ b/hw/pci-host/ppc440_pcix.c
@@ -502,7 +502,7 @@ static void ppc440_pcix_realize(DeviceState *dev, Error 
**errp)
 
     memory_region_init(&s->bm, OBJECT(s), "bm-ppc440-pcix", UINT64_MAX);
     memory_region_add_subregion(&s->bm, 0x0, &s->busmem);
-    address_space_init(&s->bm_as, NULL, &s->bm, "pci-bm");
+    address_space_init(&s->bm_as, OBJECT(s), &s->bm, "as");
     pci_setup_iommu(h->bus, &ppc440_iommu_ops, s);
 
     memory_region_init(&s->container, OBJECT(s), "pci-container", 
PCI_ALL_SIZE);
diff --git a/hw/pci-host/ppce500.c b/hw/pci-host/ppce500.c
index eda168fb5955..94d5c53f328a 100644
--- a/hw/pci-host/ppce500.c
+++ b/hw/pci-host/ppce500.c
@@ -470,7 +470,7 @@ static void e500_pcihost_realize(DeviceState *dev, Error 
**errp)
     /* Set up PCI view of memory */
     memory_region_init(&s->bm, OBJECT(s), "bm-e500", UINT64_MAX);
     memory_region_add_subregion(&s->bm, 0x0, &s->busmem);
-    address_space_init(&s->bm_as, NULL, &s->bm, "pci-bm");
+    address_space_init(&s->bm_as, OBJECT(s), &s->bm, "as");
     pci_setup_iommu(b, &ppce500_iommu_ops, s);
 
     pci_create_simple(b, 0, TYPE_PPC_E500_PCI_BRIDGE);
diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c
index 5564b51d6755..5bf87bdffa26 100644
--- a/hw/pci-host/raven.c
+++ b/hw/pci-host/raven.c
@@ -214,7 +214,7 @@ static void raven_pcihost_realize(DeviceState *d, Error 
**errp)
     memory_region_init_alias(mr, o, "bm-system", get_system_memory(),
                              0, 0x80000000);
     memory_region_add_subregion(bm, 0x80000000, mr);
-    address_space_init(&s->bm_as, NULL, bm, "raven-bm-as");
+    address_space_init(&s->bm_as, o, bm, "as");
     pci_setup_iommu(h->bus, &raven_iommu_ops, s);
 }
 

-- 
2.51.0


Reply via email to