From: Daniel Henrique Barboza <danielhb413@gmail.com>
To: "Cédric Le Goater" <clg@kaod.org>, qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au
Subject: Re: [PATCH 11/17] ppc/pnv: introduce PnvPHB4 'phb_number' property
Date: Fri, 14 Jan 2022 08:29:03 -0300 [thread overview]
Message-ID: <6501c291-38d3-3131-9b3d-7b4513cadee4@gmail.com> (raw)
In-Reply-To: <3416965f-203e-f902-a4cb-a5dcd4da6f83@kaod.org>
On 1/14/22 07:46, Cédric Le Goater wrote:
> On 1/13/22 20:29, Daniel Henrique Barboza wrote:
>> One of the remaining dependencies we have on the PnvPhb4PecStack object
>> is the stack->stack_no property. This is set as the position the stack
>> occupies in the pec->stacks[] array.
>>
>> We need a way to report this same value in the PnvPHB4. This patch
>> creates a new property called 'phb_number' to be used in existing code
>> in all instances stack->stack_no is currently being used.
>>
>> The 'phb_number' name is an indication of our future intention to convert
>> the pec->stacks[] array into a pec->phbs[] array, when the PEC object will
>> deal directly with phb4 objects.
>
>
> So the PHB would have a 'phb_number' and a 'index' property ? That's
> confusing. Can we simplify ? compute one from another ?
>
> or keep 'stack_no' to make it clear this belongs to the stack subunit
> logic.
I guess for now we can keep it as phb->stack_no. We can think about reworking the
logic (my initial reaction is to keep 'index' and then derive the 'stack_no' from
it when needed) in a follow up.
Thanks,
Daniel
>
> Thanks,
>
> C.
>
>>
>> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
>> ---
>> hw/pci-host/pnv_phb4.c | 28 +++++++++++++++++-----------
>> hw/pci-host/pnv_phb4_pec.c | 2 ++
>> include/hw/pci-host/pnv_phb4.h | 3 +++
>> 3 files changed, 22 insertions(+), 11 deletions(-)
>>
>> diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
>> index b5045fca64..44f3087913 100644
>> --- a/hw/pci-host/pnv_phb4.c
>> +++ b/hw/pci-host/pnv_phb4.c
>> @@ -937,7 +937,7 @@ static void pnv_pec_stk_update_map(PnvPHB4 *phb)
>> mask = phb->nest_regs[PEC_NEST_STK_MMIO_BAR0_MASK];
>> size = ((~mask) >> 8) + 1;
>> snprintf(name, sizeof(name), "pec-%d.%d-phb-%d-mmio0",
>> - pec->chip_id, pec->index, stack->stack_no);
>> + pec->chip_id, pec->index, phb->phb_number);
>> memory_region_init(&phb->mmbar0, OBJECT(phb), name, size);
>> memory_region_add_subregion(sysmem, bar, &phb->mmbar0);
>> phb->mmio0_base = bar;
>> @@ -949,7 +949,7 @@ static void pnv_pec_stk_update_map(PnvPHB4 *phb)
>> mask = phb->nest_regs[PEC_NEST_STK_MMIO_BAR1_MASK];
>> size = ((~mask) >> 8) + 1;
>> snprintf(name, sizeof(name), "pec-%d.%d-phb-%d-mmio1",
>> - pec->chip_id, pec->index, stack->stack_no);
>> + pec->chip_id, pec->index, phb->phb_number);
>> memory_region_init(&phb->mmbar1, OBJECT(phb), name, size);
>> memory_region_add_subregion(sysmem, bar, &phb->mmbar1);
>> phb->mmio1_base = bar;
>> @@ -960,7 +960,7 @@ static void pnv_pec_stk_update_map(PnvPHB4 *phb)
>> bar = phb->nest_regs[PEC_NEST_STK_PHB_REGS_BAR] >> 8;
>> size = PNV_PHB4_NUM_REGS << 3;
>> snprintf(name, sizeof(name), "pec-%d.%d-phb-%d",
>> - pec->chip_id, pec->index, stack->stack_no);
>> + pec->chip_id, pec->index, phb->phb_number);
>> memory_region_init(&phb->phbbar, OBJECT(phb), name, size);
>> memory_region_add_subregion(sysmem, bar, &phb->phbbar);
>> }
>> @@ -969,7 +969,7 @@ static void pnv_pec_stk_update_map(PnvPHB4 *phb)
>> bar = phb->nest_regs[PEC_NEST_STK_INT_BAR] >> 8;
>> size = PNV_PHB4_MAX_INTs << 16;
>> snprintf(name, sizeof(name), "pec-%d.%d-phb-%d-int",
>> - stack->pec->chip_id, stack->pec->index, stack->stack_no);
>> + stack->pec->chip_id, stack->pec->index, phb->phb_number);
>> memory_region_init(&phb->intbar, OBJECT(phb), name, size);
>> memory_region_add_subregion(sysmem, bar, &phb->intbar);
>> }
>> @@ -1469,20 +1469,20 @@ static void pnv_phb4_xscom_realize(PnvPHB4 *phb)
>> /* Initialize the XSCOM regions for the stack registers */
>> snprintf(name, sizeof(name), "xscom-pec-%d.%d-nest-phb-%d",
>> - pec->chip_id, pec->index, stack->stack_no);
>> + pec->chip_id, pec->index, phb->phb_number);
>> 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",
>> - pec->chip_id, pec->index, stack->stack_no);
>> + pec->chip_id, pec->index, phb->phb_number);
>> pnv_xscom_region_init(&phb->pci_regs_mr, OBJECT(phb),
>> &pnv_pec_stk_pci_xscom_ops, phb, name,
>> PHB4_PEC_PCI_STK_REGS_COUNT);
>> /* PHB pass-through */
>> snprintf(name, sizeof(name), "xscom-pec-%d.%d-pci-phb-%d",
>> - pec->chip_id, pec->index, stack->stack_no);
>> + pec->chip_id, pec->index, phb->phb_number);
>> pnv_xscom_region_init(&phb->phb_regs_mr, OBJECT(phb),
>> &pnv_phb4_xscom_ops, phb, name, 0x40);
>> @@ -1491,14 +1491,14 @@ 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),
>> + pec_nest_base + 0x40 * (phb->phb_number + 1),
>> &phb->nest_regs_mr);
>> pnv_xscom_add_subregion(pec->chip,
>> - pec_pci_base + 0x40 * (stack->stack_no + 1),
>> + pec_pci_base + 0x40 * (phb->phb_number + 1),
>> &phb->pci_regs_mr);
>> pnv_xscom_add_subregion(pec->chip,
>> pec_pci_base + PNV9_XSCOM_PEC_PCI_STK0 +
>> - 0x40 * stack->stack_no,
>> + 0x40 * phb->phb_number,
>> &phb->phb_regs_mr);
>> }
>> @@ -1568,10 +1568,15 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp)
>> return;
>> }
>> - /* All other phb properties but 'version' are already set */
>> + /*
>> + * All other phb properties but 'version' and 'phb-number'
>> + * are already set.
>> + */
>> pecc = PNV_PHB4_PEC_GET_CLASS(phb->stack->pec);
>> object_property_set_int(OBJECT(phb), "version", pecc->version,
>> &error_fatal);
>> + object_property_set_int(OBJECT(phb), "phb-number",
>> + phb->stack->stack_no, &error_abort);
>> /*
>> * Assign stack->phb since pnv_phb4_update_regions() uses it
>> @@ -1677,6 +1682,7 @@ static void pnv_phb4_xive_notify(XiveNotifier *xf, uint32_t srcno)
>> }
>> static Property pnv_phb4_properties[] = {
>> + DEFINE_PROP_UINT32("phb-number", PnvPHB4, phb_number, 0),
>> DEFINE_PROP_UINT32("index", PnvPHB4, phb_id, 0),
>> DEFINE_PROP_UINT32("chip-id", PnvPHB4, chip_id, 0),
>> DEFINE_PROP_UINT64("version", PnvPHB4, version, 0),
>> diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c
>> index 7fe7f1f007..7c4b4023df 100644
>> --- a/hw/pci-host/pnv_phb4_pec.c
>> +++ b/hw/pci-host/pnv_phb4_pec.c
>> @@ -285,6 +285,8 @@ static void pnv_pec_stk_default_phb_realize(PnvPhb4PecStack *stack,
>> stack->phb = PNV_PHB4(qdev_new(TYPE_PNV_PHB4));
>> + object_property_set_int(OBJECT(stack->phb), "phb-number", stack->stack_no,
>> + &error_abort);
>> object_property_set_int(OBJECT(stack->phb), "chip-id", pec->chip_id,
>> &error_fatal);
>> object_property_set_int(OBJECT(stack->phb), "index", phb_id,
>> diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h
>> index 6968efaba8..fc7807be1c 100644
>> --- a/include/hw/pci-host/pnv_phb4.h
>> +++ b/include/hw/pci-host/pnv_phb4.h
>> @@ -84,6 +84,9 @@ struct PnvPHB4 {
>> uint64_t version;
>> + /* My own PHB number */
>> + uint32_t phb_number;
>> +
>> char bus_path[8];
>> /* Main register images */
>>
>
next prev parent reply other threads:[~2022-01-14 11:40 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
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 [this message]
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=6501c291-38d3-3131-9b3d-7b4513cadee4@gmail.com \
--to=danielhb413@gmail.com \
--cc=clg@kaod.org \
--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 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).