All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Frederic Barrat <fbarrat@linux.ibm.com>,
	clg@kaod.org, danielhb413@gmail.com, qemu-ppc@nongnu.org,
	qemu-devel@nongnu.org
Subject: Re: [PATCH 1/4] pnv_phb4_pec: Keep track of instantiated PHBs
Date: Thu, 2 Mar 2023 23:21:18 +0100	[thread overview]
Message-ID: <e6ea9eda-51be-df8e-5711-73b944b52944@linaro.org> (raw)
In-Reply-To: <20230302163715.129635-2-fbarrat@linux.ibm.com>

Hi Frederic,

On 2/3/23 17:37, Frederic Barrat wrote:
> Add an array on the PEC object to keep track of the PHBs which are
> instantiated. The array can be sparsely populated when using
> user-created PHBs. It will be useful for the next patch to only export
> instantiated PHBs in the device tree.
> 
> Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
> ---
>   hw/pci-host/pnv_phb4_pec.c     | 12 +++++++-----
>   hw/ppc/pnv.c                   |  1 +
>   include/hw/pci-host/pnv_phb4.h |  2 ++
>   3 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c
> index 43267a428f..97c06bb0a0 100644
> --- a/hw/pci-host/pnv_phb4_pec.c
> +++ b/hw/pci-host/pnv_phb4_pec.c

> +static PnvPHB *pnv_pec_default_phb_realize(PnvPhb4PecState *pec,
> +                                           int stack_no,
> +                                           Error **errp)
>   {
>       PnvPHB *phb = PNV_PHB(qdev_new(TYPE_PNV_PHB));
>       int phb_id = pnv_phb4_pec_get_phb_id(pec, stack_no);
> @@ -128,8 +128,9 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState *pec,
>                               &error_fatal);
>   
>       if (!sysbus_realize(SYS_BUS_DEVICE(phb), errp)) {
> -        return;
> +        return NULL;
>       }
> +    return phb;
>   }


> diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h
> index 28d61b96c7..0b72ef1471 100644
> --- a/include/hw/pci-host/pnv_phb4.h
> +++ b/include/hw/pci-host/pnv_phb4.h
> @@ -185,6 +185,8 @@ struct PnvPhb4PecState {
>   
>       /* PHBs */
>       uint32_t num_phbs;
> +#define MAX_PHBS_PER_PEC        3
> +    PnvPHB *phbs[MAX_PHBS_PER_PEC];
>   
>       PnvChip *chip;
>   };

 From QOM PoV, better would be to 'embed' the PnvPHB structure (not only
a pointer to it), and initialize the PnvPHB instance calling
object_initialize_child() instead of qdev_new().

See for example the recent conversion of OHCISysBusState in commit
01c400ae43 ("hw/display/sm501: Embed OHCI QOM child in chipset").

Regards,

Phil.


  reply	other threads:[~2023-03-02 22:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-02 16:37 [PATCH 0/4] user-created PHB cleanup Frederic Barrat
2023-03-02 16:37 ` [PATCH 1/4] pnv_phb4_pec: Keep track of instantiated PHBs Frederic Barrat
2023-03-02 22:21   ` Philippe Mathieu-Daudé [this message]
2023-03-03  8:42     ` Daniel Henrique Barboza
2023-03-03 11:29     ` Frederic Barrat
2023-03-03  9:18   ` Daniel Henrique Barboza
2023-03-02 16:37 ` [PATCH 2/4] pnv_phb4_pec: Only export existing PHBs to the device tree Frederic Barrat
2023-03-03  9:18   ` Daniel Henrique Barboza
2023-03-02 16:37 ` [PATCH 3/4] pnv_phb4_pec: Move pnv_phb4_get_pec() to rightful file Frederic Barrat
2023-03-03  9:19   ` Daniel Henrique Barboza
2023-03-02 16:37 ` [PATCH 4/4] pnv_phb4_pec: Simplify/align code to parent user-created PHBs Frederic Barrat
2023-03-03  9:20   ` Daniel Henrique Barboza
2023-03-03  9:33 ` [PATCH 0/4] user-created PHB cleanup Daniel Henrique Barboza

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=e6ea9eda-51be-df8e-5711-73b944b52944@linaro.org \
    --to=philmd@linaro.org \
    --cc=clg@kaod.org \
    --cc=danielhb413@gmail.com \
    --cc=fbarrat@linux.ibm.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.