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/s390x/s390-pci-bus.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 67fce1c133b0..3febf9df968f 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -623,18 +623,13 @@ static S390PCIIOMMU *s390_pci_get_iommu(S390pciState *s, PCIBus *bus, pci_bus_num(bus), PCI_SLOT(devfn), PCI_FUNC(devfn)); - char *as_name = g_strdup_printf("iommu-pci-%02x:%02x.%01x", - pci_bus_num(bus), - PCI_SLOT(devfn), - PCI_FUNC(devfn)); memory_region_init(&iommu->mr, OBJECT(iommu), mr_name, UINT64_MAX); - address_space_init(&iommu->as, NULL, &iommu->mr, as_name); + address_space_init(&iommu->as, OBJECT(iommu), &iommu->mr, "as"); iommu->iotlb = g_hash_table_new_full(g_int64_hash, g_int64_equal, NULL, g_free); table->iommu[PCI_SLOT(devfn)] = iommu; g_free(mr_name); - g_free(as_name); } return iommu; @@ -785,7 +780,7 @@ static void s390_pci_iommu_free(S390pciState *s, PCIBus *bus, int32_t devfn) * Remove the listeners now before destroying the address space. */ address_space_remove_listeners(&iommu->as); - address_space_destroy(&iommu->as); + object_unparent(OBJECT(&iommu->as)); object_unparent(OBJECT(&iommu->mr)); object_unparent(OBJECT(iommu)); object_unref(OBJECT(iommu)); -- 2.51.0