All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@kaod.org>
To: Daniel Henrique Barboza <danielhb413@gmail.com>, <qemu-devel@nongnu.org>
Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au
Subject: Re: [PATCH 09/17] ppc/pnv: move nest_regs_mr to PnvPHB4
Date: Fri, 14 Jan 2022 11:42:27 +0100	[thread overview]
Message-ID: <8ecb83eb-ce0c-b8d4-fd8a-d48d1dadc430@kaod.org> (raw)
In-Reply-To: <20220113192952.911188-10-danielhb413@gmail.com>

On 1/13/22 20:29, Daniel Henrique Barboza wrote:
> We're now able to cleanly move nest_regs_mr to the PnvPHB4 device.
> 
> One thing of notice here is the need to use a phb->stack->pec pointer
> because pnv_pec_stk_nest_xscom_write requires a PEC object. Another
> thing that can be noticed in the use of 'stack->stack_no' that still
> remains throughout the XSCOM code.
> 
> After moving all MemoryRegions to the PnvPHB4 object, this illustrates
> what is the remaining role of the stack: provide a PEC pointer and the
> 'stack_no' information. If we can provide these in the PnvPHB4 object
> instead (spoiler: we can, and we will), the PnvPhb4PecStack device will
> be deprecated and can be removed.
> 
> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>


Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks,

C.

> ---
>   hw/pci-host/pnv_phb4.c         | 16 +++++++---------
>   include/hw/pci-host/pnv_phb4.h |  3 +--
>   2 files changed, 8 insertions(+), 11 deletions(-)
> 
> diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
> index 0f4464ec67..37bab10fcb 100644
> --- a/hw/pci-host/pnv_phb4.c
> +++ b/hw/pci-host/pnv_phb4.c
> @@ -861,8 +861,7 @@ const MemoryRegionOps pnv_phb4_xscom_ops = {
>   static uint64_t pnv_pec_stk_nest_xscom_read(void *opaque, hwaddr addr,
>                                               unsigned size)
>   {
> -    PnvPhb4PecStack *stack = PNV_PHB4_PEC_STACK(opaque);
> -    PnvPHB4 *phb = stack->phb;
> +    PnvPHB4 *phb = PNV_PHB4(opaque);
>       uint32_t reg = addr >> 3;
>   
>       /* TODO: add list of allowed registers and error out if not */
> @@ -982,9 +981,8 @@ static void pnv_pec_stk_update_map(PnvPHB4 *phb)
>   static void pnv_pec_stk_nest_xscom_write(void *opaque, hwaddr addr,
>                                            uint64_t val, unsigned size)
>   {
> -    PnvPhb4PecStack *stack = PNV_PHB4_PEC_STACK(opaque);
> -    PnvPHB4 *phb = stack->phb;
> -    PnvPhb4PecState *pec = stack->pec;
> +    PnvPHB4 *phb = PNV_PHB4(opaque);
> +    PnvPhb4PecState *pec = phb->stack->pec;
>       uint32_t reg = addr >> 3;
>   
>       switch (reg) {
> @@ -1470,10 +1468,10 @@ static void pnv_phb4_xscom_realize(PnvPHB4 *phb)
>       assert(pec);
>   
>       /* Initialize the XSCOM regions for the stack registers */
> -    snprintf(name, sizeof(name), "xscom-pec-%d.%d-nest-stack-%d",
> +    snprintf(name, sizeof(name), "xscom-pec-%d.%d-nest-phb-%d",
>                pec->chip_id, pec->index, stack->stack_no);
> -    pnv_xscom_region_init(&stack->nest_regs_mr, OBJECT(stack),
> -                          &pnv_pec_stk_nest_xscom_ops, stack, name,
> +    pnv_xscom_region_init(&phb->nest_regs_mr, OBJECT(phb),
> +                          &pnv_pec_stk_nest_xscom_ops, phb, name,
>                             PHB4_PEC_NEST_STK_REGS_COUNT);
>   
>       snprintf(name, sizeof(name), "xscom-pec-%d.%d-pci-phb-%d",
> @@ -1494,7 +1492,7 @@ static void pnv_phb4_xscom_realize(PnvPHB4 *phb)
>       /* Populate the XSCOM address space. */
>       pnv_xscom_add_subregion(pec->chip,
>                               pec_nest_base + 0x40 * (stack->stack_no + 1),
> -                            &stack->nest_regs_mr);
> +                            &phb->nest_regs_mr);
>       pnv_xscom_add_subregion(pec->chip,
>                               pec_pci_base + 0x40 * (stack->stack_no + 1),
>                               &phb->pci_regs_mr);
> diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h
> index a7e08772c1..1d53dda0ed 100644
> --- a/include/hw/pci-host/pnv_phb4.h
> +++ b/include/hw/pci-host/pnv_phb4.h
> @@ -115,6 +115,7 @@ struct PnvPHB4 {
>       /* Nest registers */
>   #define PHB4_PEC_NEST_STK_REGS_COUNT  0x17
>       uint64_t nest_regs[PHB4_PEC_NEST_STK_REGS_COUNT];
> +    MemoryRegion nest_regs_mr;
>   
>       /* Memory windows from PowerBus to PHB */
>       MemoryRegion phbbar;
> @@ -169,8 +170,6 @@ struct PnvPhb4PecStack {
>       /* My own stack number */
>       uint32_t stack_no;
>   
> -    MemoryRegion nest_regs_mr;
> -
>       /* PHB pass-through XSCOM */
>       MemoryRegion phb_regs_mr;
>   
> 



  reply	other threads:[~2022-01-14 10:54 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-13 19:29 [PATCH 00/17] remove PnvPhb4PecStack from Powernv9 Daniel Henrique Barboza
2022-01-13 19:29 ` [PATCH 01/17] ppc/pnv: use PHB4 obj in pnv_pec_stk_pci_xscom_ops Daniel Henrique Barboza
2022-01-14 10:36   ` Cédric Le Goater
2022-01-13 19:29 ` [PATCH 02/17] ppc/pnv: move PCI registers to PnvPHB4 Daniel Henrique Barboza
2022-01-14 10:39   ` Cédric Le Goater
2022-01-13 19:29 ` [PATCH 03/17] ppc/pnv: move phbbar " Daniel Henrique Barboza
2022-01-14 10:40   ` Cédric Le Goater
2022-01-13 19:29 ` [PATCH 04/17] ppc/pnv: move intbar " Daniel Henrique Barboza
2022-01-14 10:40   ` Cédric Le Goater
2022-01-13 19:29 ` [PATCH 05/17] ppc/pnv: change pnv_phb4_update_regions() to use PnvPHB4 Daniel Henrique Barboza
2022-01-14 10:40   ` Cédric Le Goater
2022-01-13 19:29 ` [PATCH 06/17] ppc/pnv: move mmbar0/mmbar1 and friends to PnvPHB4 Daniel Henrique Barboza
2022-01-14 10:41   ` Cédric Le Goater
2022-01-13 19:29 ` [PATCH 07/17] ppc/pnv: move nest_regs[] " Daniel Henrique Barboza
2022-01-14 10:41   ` Cédric Le Goater
2022-01-13 19:29 ` [PATCH 08/17] ppc/pnv: change pnv_pec_stk_update_map() to use PnvPHB4 Daniel Henrique Barboza
2022-01-14 10:41   ` Cédric Le Goater
2022-01-13 19:29 ` [PATCH 09/17] ppc/pnv: move nest_regs_mr to PnvPHB4 Daniel Henrique Barboza
2022-01-14 10:42   ` Cédric Le Goater [this message]
2022-01-13 19:29 ` [PATCH 10/17] ppc/pnv: move phb_regs_mr " Daniel Henrique Barboza
2022-01-14 10:42   ` Cédric Le Goater
2022-01-13 19:29 ` [PATCH 11/17] ppc/pnv: introduce PnvPHB4 'phb_number' property Daniel Henrique Barboza
2022-01-14 10:46   ` Cédric Le Goater
2022-01-14 11:29     ` Daniel Henrique Barboza
2022-01-14 11:38       ` Cédric Le Goater
2022-01-13 19:29 ` [PATCH 12/17] ppc/pnv: introduce PnvPHB4 'pec' property Daniel Henrique Barboza
2022-01-14 10:47   ` Cédric Le Goater
2022-01-13 19:29 ` [PATCH 13/17] ppc/pnv: remove stack pointer from PnvPHB4 Daniel Henrique Barboza
2022-01-14 10:47   ` Cédric Le Goater
2022-01-13 19:29 ` [PATCH 14/17] ppc/pnv: move default_phb_realize() to pec_realize() Daniel Henrique Barboza
2022-01-14 10:49   ` Cédric Le Goater
2022-01-13 19:29 ` [PATCH 15/17] ppc/pnv: convert pec->stacks[] into pec->phbs[] Daniel Henrique Barboza
2022-01-14 10:52   ` Cédric Le Goater
2022-01-14 13:33   ` Cédric Le Goater
2022-01-14 13:40     ` Daniel Henrique Barboza
2022-01-13 19:29 ` [PATCH 16/17] ppc/pnv: remove PnvPhb4PecStack object Daniel Henrique Barboza
2022-01-14 10:49   ` Cédric Le Goater
2022-01-13 19:29 ` [PATCH 17/17] ppc/pnv: rename pnv_pec_stk_update_map() Daniel Henrique Barboza
2022-01-14 10:50   ` Cédric Le Goater
2022-01-14 10:38 ` [PATCH 00/17] remove PnvPhb4PecStack from Powernv9 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=8ecb83eb-ce0c-b8d4-fd8a-d48d1dadc430@kaod.org \
    --to=clg@kaod.org \
    --cc=danielhb413@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --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.