From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60441) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPZAQ-0002ib-Hd for qemu-devel@nongnu.org; Tue, 19 Jul 2016 13:50:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPZAO-0000nI-LP for qemu-devel@nongnu.org; Tue, 19 Jul 2016 13:50:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50671) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPZAO-0000nE-Fw for qemu-devel@nongnu.org; Tue, 19 Jul 2016 13:50:48 -0400 Date: Tue, 19 Jul 2016 20:50:42 +0300 From: "Michael S. Tsirkin" Message-ID: <20160719175042.GA32630@redhat.com> References: <1468950176-31959-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1468950176-31959-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL v2 05/55] hw/apb: fix PCI bus initialization List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Marcel Apfelbaum , Mark Cave-Ayland , Cao jin , Paolo Bonzini From: Marcel Apfelbaum Create and connect the PCI root bus to the host bridge before the later is 'realized'. Signed-off-by: Marcel Apfelbaum Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Tested-by: Mark Cave-Ayland --- hw/pci-host/apb.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/hw/pci-host/apb.c b/hw/pci-host/apb.c index babbbef..16587f8 100644 --- a/hw/pci-host/apb.c +++ b/hw/pci-host/apb.c @@ -670,6 +670,13 @@ PCIBus *pci_apb_init(hwaddr special_base, /* Ultrasparc PBM main bus */ dev = qdev_create(NULL, TYPE_APB); + d = APB_DEVICE(dev); + phb = PCI_HOST_BRIDGE(dev); + phb->bus = pci_register_bus(DEVICE(phb), "pci", + pci_apb_set_irq, pci_pbm_map_irq, d, + &d->pci_mmio, + get_system_io(), + 0, 32, TYPE_PCI_BUS); qdev_init_nofail(dev); s = SYS_BUS_DEVICE(dev); /* apb_config */ @@ -678,18 +685,10 @@ PCIBus *pci_apb_init(hwaddr special_base, sysbus_mmio_map(s, 1, special_base + 0x1000000ULL); /* pci_ioport */ sysbus_mmio_map(s, 2, special_base + 0x2000000ULL); - d = APB_DEVICE(dev); memory_region_init(&d->pci_mmio, OBJECT(s), "pci-mmio", 0x100000000ULL); memory_region_add_subregion(get_system_memory(), mem_base, &d->pci_mmio); - phb = PCI_HOST_BRIDGE(dev); - phb->bus = pci_register_bus(DEVICE(phb), "pci", - pci_apb_set_irq, pci_pbm_map_irq, d, - &d->pci_mmio, - get_system_io(), - 0, 32, TYPE_PCI_BUS); - *pbm_irqs = d->pbm_irqs; d->ivec_irqs = ivec_irqs; -- MST