From nobody Tue Nov 18 10:38:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.46 as permitted sender) client-ip=209.85.221.46; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f46.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.46 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1609455033; cv=none; d=zohomail.com; s=zohoarc; b=Fq+RVR14b6Yebl/dcZKrBPGCg+06bySDgfKNC7dpRzzfB9Jgf3qLw9WP0Eqs23lDsNY7+Xoa88GqdXvCG1LES9/3TNJcFiVVBzryZnnoVr19OdMOXZApCmIchYUR46lwtS0b0C7g6pejEH7GiLJ3JMuOnsB1TdE3updicDDQJNo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609455033; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bRQj82c2dJ/rqcosZjZiHFbNtmid7e/8/vWsz4qrKdU=; b=Zl0xEqbYsHrlwDxpRXptMveul5ITn4BFmHzolxR9R3Rw5aoLKAbbZVEI+iU+B6Y628rOHFusnvglSwsH7upHNPRg5yait7tiXwakbB4BuwbTRXGMxngP3mg0bMa6mWDMUQ8D4kNuVsyrijbThprSgWkS9lUHz2Q+srUtFKMhmz4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.46 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by mx.zohomail.com with SMTPS id 1609455033808654.6180310050269; Thu, 31 Dec 2020 14:50:33 -0800 (PST) Received: by mail-wr1-f46.google.com with SMTP id w5so21013118wrm.11 for ; Thu, 31 Dec 2020 14:50:33 -0800 (PST) Return-Path: Return-Path: Received: from localhost.localdomain (239.red-83-42-57.dynamicip.rima-tde.net. [83.42.57.239]) by smtp.gmail.com with ESMTPSA id u205sm15462023wme.42.2020.12.31.14.50.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Dec 2020 14:50:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bRQj82c2dJ/rqcosZjZiHFbNtmid7e/8/vWsz4qrKdU=; b=dZFm8j+1d+3sYs3D7TjZklBb2QYT/Ree7TerLC35X/83Rm0x+1Pq0ygi2TqsPnEOwX yGzezJv10J+WwzdYIcGoNV1BwZl/u+PTP6xX6qM7ZSaCPD+6Cr18gCV1i9jYS6Rsuxwe 4paQV/3PS7iibRQm+6N28ZWmFULWIaXaymrjfMC1MbYqwE3A6dGBsutMBQym9gzadE3h sVNBqwmvaFayanshiQTR07rOanTTxB1OQxrRIRP09TJUWn5NvE7pioqnu2oxIOfUhbJw 8oB0pygtLGBWZGGTn/OueneAoUJbD7248g1i4Bm85yDY5t9jm3BNGEVDZncAWbmOgWmm /BbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=bRQj82c2dJ/rqcosZjZiHFbNtmid7e/8/vWsz4qrKdU=; b=cuYBVtY9nvdfiU+GwGx3sRbezpEZS7HP0rrDqnswAFvEiJZPnYhNEozZf808f5kr8f pt81pTJ/HPk5LEOs7XDTqlc6IN4OfATv8qoej00y0ZUouzzhpmbMLg8kEnOFKlxot9qo rIlImBKLeQMxaUfiYLL92Fg+8vIeadACOrnKGFU901llOe6Ddi8ePBwru5O+hptWfO2c J1rjvvTDAU9h8UTcS4TsEV94i5h72vFoBvx2EHd1jnWcIQezQa9wF1+8lpovPdBJn+Ru vM17q0fFIoDtyNIIQZVaU8WYzcA0xYplTiyqShKjdGhDGspaxhxp8WHwmV1jQhIqAKZP 3xag== X-Gm-Message-State: AOAM533BhdDj1cK/EtPrYGmsv0U5a8ihYSBjcJUz09SJK2tM510L5LyH SL7Q69mYdITfYEp30RmHQoE= X-Google-Smtp-Source: ABdhPJzPg9G1rBCCh+xp8a/lzp24DhPTbZ92h2DGvfrSWfMUJFNlN/IdGN12qgYHZ5jW4NGWCxhNOw== X-Received: by 2002:a5d:4b44:: with SMTP id w4mr65873135wrs.155.1609455032099; Thu, 31 Dec 2020 14:50:32 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , Aleksandar Rikalo , Aurelien Jarno , Huacai Chen Subject: [PATCH 16/18] hw/pci-host/bonito: Create TYPE_PCI_BONITO in bonito_host_realize() Date: Thu, 31 Dec 2020 23:49:09 +0100 Message-Id: <20201231224911.1467352-17-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201231224911.1467352-1-f4bug@amsat.org> References: <20201231224911.1467352-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) As it doesn't make sens to create the TYPE_BONITO_PCI_HOST_BRIDGE PCI function device without its host side, create it in the host realize(). This will allow to inline bonito_init() in few commits. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/bonito.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index 099bb737c77..5a8a85ae443 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -622,6 +622,7 @@ static void bonito_host_realize(DeviceState *dev, Error= **errp) PCIHostState *phb =3D PCI_HOST_BRIDGE(dev); BonitoState *bs =3D BONITO_PCI_HOST_BRIDGE(dev); MemoryRegion *pcimem_alias =3D g_new(MemoryRegion, 1); + PCIDevice *pci_dev; =20 memory_region_init(&bs->pci_mem, OBJECT(dev), "pci.mem", BONITO_PCIHI_= SIZE); phb->bus =3D pci_register_root_bus(dev, "pci", @@ -645,6 +646,11 @@ static void bonito_host_realize(DeviceState *dev, Erro= r **errp) "north-bridge-pci-config", BONITO_PCICONFIG_SIZE= ); memory_region_add_subregion(get_system_memory(), BONITO_PCICONFIG_BASE, &phb->conf_mem); + + pci_dev =3D pci_new(PCI_DEVFN(0, 0), TYPE_PCI_BONITO); + PCI_BONITO(pci_dev)->pcihost =3D bs; + bs->pci_dev =3D PCI_BONITO(pci_dev); + pci_realize_and_unref(pci_dev, phb->bus, &error_fatal); } =20 static void bonito_pci_realize(PCIDevice *dev, Error **errp) @@ -727,8 +733,6 @@ PCIBus *bonito_init(qemu_irq *pic) DeviceState *dev; BonitoState *pcihost; PCIHostState *phb; - BonitoPciState *s; - PCIDevice *d; =20 dev =3D qdev_new(TYPE_BONITO_PCI_HOST_BRIDGE); phb =3D PCI_HOST_BRIDGE(dev); @@ -736,12 +740,6 @@ PCIBus *bonito_init(qemu_irq *pic) pcihost->pic =3D pic; sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); =20 - d =3D pci_new(PCI_DEVFN(0, 0), TYPE_PCI_BONITO); - s =3D PCI_BONITO(d); - s->pcihost =3D pcihost; - pcihost->pci_dev =3D s; - pci_realize_and_unref(d, phb->bus, &error_fatal); - return phb->bus; } =20 --=20 2.26.2