From 2984218aeab22a262174b4a131ae4d4fbddf5e44 Mon Sep 17 00:00:00 2001 From: BALATON Zoltan Date: Thu, 23 Oct 2025 17:26:21 +0200 Subject: [PATCH] hw/pci-host/raven: Simplify creating PCI facing part MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit There is no need to init and realize the PCI facing part of the host bridge separately as it does not expose any properties that need to be available before realize. It can be simpilfied using pci_create_simple. Signed-off-by: BALATON Zoltan Reviewed-by: Mark Cave-Ayland Message-ID: <5a60e395d72e5eb4d01093434fbb645d72ac567a.1761232472.git.balaton@eik.bme.hu> Signed-off-by: Philippe Mathieu-Daudé --- hw/pci-host/raven.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c index eacffc86d8..c0492d1456 100644 --- a/hw/pci-host/raven.c +++ b/hw/pci-host/raven.c @@ -65,7 +65,6 @@ struct PRePPCIState { MemoryRegion bm_ram_alias; MemoryRegion bm_pci_memory_alias; AddressSpace bm_as; - RavenPCIState pci_dev; int contiguous_map; }; @@ -260,8 +259,7 @@ static void raven_pcihost_realizefn(DeviceState *d, Error **errp) "pci-intack", 1); memory_region_add_subregion(address_space_mem, 0xbffffff0, &s->pci_intack); - /* TODO Remove once realize propagates to child devices. */ - qdev_realize(DEVICE(&s->pci_dev), BUS(&s->pci_bus), errp); + pci_create_simple(&s->pci_bus, PCI_DEVFN(0, 0), TYPE_RAVEN_PCI_DEVICE); } static void raven_pcihost_initfn(Object *obj) @@ -269,7 +267,6 @@ static void raven_pcihost_initfn(Object *obj) PCIHostState *h = PCI_HOST_BRIDGE(obj); PREPPCIState *s = RAVEN_PCI_HOST_BRIDGE(obj); MemoryRegion *address_space_mem = get_system_memory(); - DeviceState *pci_dev; memory_region_init(&s->pci_io, obj, "pci-io", 0x3f800000); memory_region_init_io(&s->pci_io_non_contiguous, obj, &raven_io_ops, s, @@ -306,12 +303,6 @@ static void raven_pcihost_initfn(Object *obj) pci_setup_iommu(&s->pci_bus, &raven_iommu_ops, s); h->bus = &s->pci_bus; - - object_initialize(&s->pci_dev, sizeof(s->pci_dev), TYPE_RAVEN_PCI_DEVICE); - pci_dev = DEVICE(&s->pci_dev); - object_property_set_int(OBJECT(&s->pci_dev), "addr", PCI_DEVFN(0, 0), - NULL); - qdev_prop_set_bit(pci_dev, "multifunction", false); } static void raven_realize(PCIDevice *d, Error **errp) -- 2.47.3