From: Daniel Henrique Barboza <danielhb413@gmail.com>
To: "Cédric Le Goater" <clg@kaod.org>,
qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH 4/5] ppc/pnv: Attach PHB3 root port device when defaults are enabled
Date: Wed, 22 Dec 2021 15:13:03 -0300 [thread overview]
Message-ID: <79be1148-d539-667f-97f5-0a774459cc21@gmail.com> (raw)
In-Reply-To: <20211222063817.1541058-5-clg@kaod.org>
On 12/22/21 03:38, Cédric Le Goater wrote:
> This cleanups the PHB3 model a bit more since the root port is an
> independent device and it will ease our task when adding user created
> PHB3s.
>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
> include/hw/pci-host/pnv_phb3.h | 2 --
> hw/pci-host/pnv_phb3.c | 8 --------
> hw/ppc/pnv.c | 14 ++++++++++++++
> 3 files changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/include/hw/pci-host/pnv_phb3.h b/include/hw/pci-host/pnv_phb3.h
> index e9c13e6bd821..2e423c3890bc 100644
> --- a/include/hw/pci-host/pnv_phb3.h
> +++ b/include/hw/pci-host/pnv_phb3.h
> @@ -155,8 +155,6 @@ struct PnvPHB3 {
>
> PnvPBCQState pbcq;
>
> - PnvPHB3RootPort root;
> -
> QLIST_HEAD(, PnvPhb3DMASpace) dma_spaces;
>
> PnvChip *chip;
> diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c
> index 9c4451ca0d1c..39f03bd256d0 100644
> --- a/hw/pci-host/pnv_phb3.c
> +++ b/hw/pci-host/pnv_phb3.c
> @@ -980,10 +980,6 @@ static void pnv_phb3_instance_init(Object *obj)
> /* Power Bus Common Queue */
> object_initialize_child(obj, "pbcq", &phb->pbcq, TYPE_PNV_PBCQ);
>
> - /* Root Port */
> - object_initialize_child(obj, "root", &phb->root, TYPE_PNV_PHB3_ROOT_PORT);
> - qdev_prop_set_int32(DEVICE(&phb->root), "addr", PCI_DEVFN(0, 0));
> - qdev_prop_set_bit(DEVICE(&phb->root), "multifunction", false);
> }
>
> static void pnv_phb3_realize(DeviceState *dev, Error **errp)
> @@ -1051,10 +1047,6 @@ static void pnv_phb3_realize(DeviceState *dev, Error **errp)
>
> pci_setup_iommu(pci->bus, pnv_phb3_dma_iommu, phb);
>
> - /* Add a single Root port */
> - qdev_prop_set_uint8(DEVICE(&phb->root), "chassis", phb->chip_id);
> - qdev_prop_set_uint16(DEVICE(&phb->root), "slot", phb->phb_id);
> - qdev_realize(DEVICE(&phb->root), BUS(pci->bus), &error_fatal);
> }
>
> void pnv_phb3_update_regions(PnvPHB3 *phb)
> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> index 9de8b8353014..6edfd6876fd0 100644
> --- a/hw/ppc/pnv.c
> +++ b/hw/ppc/pnv.c
> @@ -1156,6 +1156,17 @@ static void pnv_chip_icp_realize(Pnv8Chip *chip8, Error **errp)
> }
> }
>
> +/* Attach a root port device */
> +static void pnv_phb_attach_root_port(PCIHostState *pci, int id,
> + const char *name)
> +{
> + PCIDevice *root = pci_new(PCI_DEVFN(0, 0), name);
> +
> + qdev_prop_set_uint8(&root->qdev, "chassis", id);
> + qdev_prop_set_uint16(&root->qdev, "slot", id);
> + pci_realize_and_unref(root, pci->bus, &error_fatal);
> +}
> +
> static void pnv_chip_power8_realize(DeviceState *dev, Error **errp)
> {
> PnvChipClass *pcc = PNV_CHIP_GET_CLASS(dev);
> @@ -1250,6 +1261,9 @@ static void pnv_chip_power8_realize(DeviceState *dev, Error **errp)
> if (!sysbus_realize(SYS_BUS_DEVICE(phb), errp)) {
> return;
> }
> +
> + pnv_phb_attach_root_port(PCI_HOST_BRIDGE(phb), phb->phb_id,
> + TYPE_PNV_PHB3_ROOT_PORT);
> }
> }
>
>
next prev parent reply other threads:[~2021-12-22 18:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-22 6:38 [PATCH 0/5] ppc/pnv: Preliminary cleanups before user created PHBs Cédric Le Goater
2021-12-22 6:38 ` [PATCH 1/5] ppc/pnv: Change the maximum of PHB3 devices for Power8NVL Cédric Le Goater
2021-12-22 18:11 ` Daniel Henrique Barboza
2021-12-22 6:38 ` [PATCH 2/5] ppc/pnv: Remove PHB4 reset handler Cédric Le Goater
2021-12-22 18:12 ` Daniel Henrique Barboza
2021-12-22 6:38 ` [PATCH 3/5] ppc/pnv: Remove the PHB4 "device-id" property Cédric Le Goater
2021-12-22 18:12 ` Daniel Henrique Barboza
2021-12-22 6:38 ` [PATCH 4/5] ppc/pnv: Attach PHB3 root port device when defaults are enabled Cédric Le Goater
2021-12-22 18:13 ` Daniel Henrique Barboza [this message]
2021-12-22 6:38 ` [PATCH 5/5] ppc/pnv: Attach PHB4 " Cédric Le Goater
2021-12-22 18:13 ` Daniel Henrique Barboza
2021-12-22 18:16 ` [PATCH 0/5] ppc/pnv: Preliminary cleanups before user created PHBs Daniel Henrique Barboza
2022-01-04 7:43 ` Cédric Le Goater
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=79be1148-d539-667f-97f5-0a774459cc21@gmail.com \
--to=danielhb413@gmail.com \
--cc=clg@kaod.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).