All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Henrique Barboza <danielhb413@gmail.com>
To: qemu-devel@nongnu.org
Cc: Daniel Henrique Barboza <danielhb413@gmail.com>,
	qemu-ppc@nongnu.org, clg@kaod.org, david@gibson.dropbear.id.au
Subject: [PATCH 12/17] ppc/pnv: introduce PnvPHB4 'pec' property
Date: Thu, 13 Jan 2022 16:29:47 -0300	[thread overview]
Message-ID: <20220113192952.911188-13-danielhb413@gmail.com> (raw)
In-Reply-To: <20220113192952.911188-1-danielhb413@gmail.com>

This property will track the owner PEC of this PHB. For now it's
redundant since we can retrieve the PEC via phb->stack->pec but it
will not be redundant when we get rid of the stack device.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
 hw/pci-host/pnv_phb4.c         | 20 +++++++++++---------
 hw/pci-host/pnv_phb4_pec.c     |  2 ++
 include/hw/pci-host/pnv_phb4.h |  3 +++
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
index 44f3087913..c9117221b2 100644
--- a/hw/pci-host/pnv_phb4.c
+++ b/hw/pci-host/pnv_phb4.c
@@ -894,8 +894,7 @@ static void pnv_phb4_update_regions(PnvPHB4 *phb)
 
 static void pnv_pec_stk_update_map(PnvPHB4 *phb)
 {
-    PnvPhb4PecStack *stack = phb->stack;
-    PnvPhb4PecState *pec = stack->pec;
+    PnvPhb4PecState *pec = phb->pec;
     MemoryRegion *sysmem = get_system_memory();
     uint64_t bar_en = phb->nest_regs[PEC_NEST_STK_BAR_EN];
     uint64_t bar, mask, size;
@@ -969,7 +968,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, phb->phb_number);
+                 phb->pec->chip_id, phb->pec->index, phb->phb_number);
         memory_region_init(&phb->intbar, OBJECT(phb), name, size);
         memory_region_add_subregion(sysmem, bar, &phb->intbar);
     }
@@ -982,7 +981,7 @@ static void pnv_pec_stk_nest_xscom_write(void *opaque, hwaddr addr,
                                          uint64_t val, unsigned size)
 {
     PnvPHB4 *phb = PNV_PHB4(opaque);
-    PnvPhb4PecState *pec = phb->stack->pec;
+    PnvPhb4PecState *pec = phb->pec;
     uint32_t reg = addr >> 3;
 
     switch (reg) {
@@ -1458,8 +1457,7 @@ static AddressSpace *pnv_phb4_dma_iommu(PCIBus *bus, void *opaque, int devfn)
 
 static void pnv_phb4_xscom_realize(PnvPHB4 *phb)
 {
-    PnvPhb4PecStack *stack = phb->stack;
-    PnvPhb4PecState *pec = stack->pec;
+    PnvPhb4PecState *pec = phb->pec;
     PnvPhb4PecClass *pecc = PNV_PHB4_PEC_GET_CLASS(pec);
     uint32_t pec_nest_base;
     uint32_t pec_pci_base;
@@ -1569,10 +1567,12 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp)
         }
 
         /*
-         * All other phb properties but 'version' and 'phb-number'
-         * are already set.
+         * All other phb properties but 'pec', 'version' and
+         * 'phb-number' are already set.
          */
-        pecc = PNV_PHB4_PEC_GET_CLASS(phb->stack->pec);
+        object_property_set_link(OBJECT(phb), "pec", OBJECT(phb->stack->pec),
+                                 &error_abort);
+        pecc = PNV_PHB4_PEC_GET_CLASS(phb->pec);
         object_property_set_int(OBJECT(phb), "version", pecc->version,
                                 &error_fatal);
         object_property_set_int(OBJECT(phb), "phb-number",
@@ -1688,6 +1688,8 @@ static Property pnv_phb4_properties[] = {
         DEFINE_PROP_UINT64("version", PnvPHB4, version, 0),
         DEFINE_PROP_LINK("stack", PnvPHB4, stack, TYPE_PNV_PHB4_PEC_STACK,
                          PnvPhb4PecStack *),
+        DEFINE_PROP_LINK("pec", PnvPHB4, pec, TYPE_PNV_PHB4_PEC,
+                         PnvPhb4PecState *),
         DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c
index 7c4b4023df..36cc4ffe7c 100644
--- a/hw/pci-host/pnv_phb4_pec.c
+++ b/hw/pci-host/pnv_phb4_pec.c
@@ -287,6 +287,8 @@ static void pnv_pec_stk_default_phb_realize(PnvPhb4PecStack *stack,
 
     object_property_set_int(OBJECT(stack->phb), "phb-number", stack->stack_no,
                             &error_abort);
+    object_property_set_link(OBJECT(stack->phb), "pec", OBJECT(pec),
+                             &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 fc7807be1c..f66bc76b78 100644
--- a/include/hw/pci-host/pnv_phb4.h
+++ b/include/hw/pci-host/pnv_phb4.h
@@ -87,6 +87,9 @@ struct PnvPHB4 {
     /* My own PHB number */
     uint32_t phb_number;
 
+    /* The owner PEC */
+    PnvPhb4PecState *pec;
+
     char bus_path[8];
 
     /* Main register images */
-- 
2.33.1



  parent reply	other threads:[~2022-01-13 19:46 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
2022-01-14 11:38       ` Cédric Le Goater
2022-01-13 19:29 ` Daniel Henrique Barboza [this message]
2022-01-14 10:47   ` [PATCH 12/17] ppc/pnv: introduce PnvPHB4 'pec' property 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=20220113192952.911188-13-danielhb413@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 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.