All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@kaod.org>
To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Daniel Henrique Barboza" <danielhb413@gmail.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Cédric Le Goater" <clg@kaod.org>
Subject: [PULL 21/31] ppc/pnv: introduce PnvPHB4 'pec' property
Date: Tue, 18 Jan 2022 14:07:20 +0100	[thread overview]
Message-ID: <20220118130730.1927983-22-clg@kaod.org> (raw)
In-Reply-To: <20220118130730.1927983-1-clg@kaod.org>

From: Daniel Henrique Barboza <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.

Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20220114180719.52117-2-danielhb413@gmail.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 include/hw/pci-host/pnv_phb4.h |  3 +++
 hw/pci-host/pnv_phb4.c         | 19 +++++++++++++------
 hw/pci-host/pnv_phb4_pec.c     |  2 ++
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h
index 6968efaba8f3..1d27e4c0cb74 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;
 
+    /* The owner PEC */
+    PnvPhb4PecState *pec;
+
     char bus_path[8];
 
     /* Main register images */
diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
index b5045fca641e..2658ef2d84b1 100644
--- a/hw/pci-host/pnv_phb4.c
+++ b/hw/pci-host/pnv_phb4.c
@@ -895,7 +895,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 +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);
+                 phb->pec->chip_id, phb->pec->index, stack->stack_no);
         memory_region_init(&phb->intbar, OBJECT(phb), name, size);
         memory_region_add_subregion(sysmem, bar, &phb->intbar);
     }
@@ -982,7 +982,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) {
@@ -1459,7 +1459,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;
@@ -1568,8 +1568,13 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp)
             return;
         }
 
-        /* All other phb properties but 'version' are already set */
-        pecc = PNV_PHB4_PEC_GET_CLASS(phb->stack->pec);
+        /*
+         * All other phb properties but 'pec' ad 'version' are
+         * already set.
+         */
+        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);
 
@@ -1682,6 +1687,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 7fe7f1f007dd..22194b8de2ff 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_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,
-- 
2.31.1



  parent reply	other threads:[~2022-01-18 14:12 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-18 13:06 [PULL 00/31] ppc queue Cédric Le Goater
2022-01-18 13:07 ` [PULL 01/31] docs: rSTify ppc-spapr-hotplug.txt Cédric Le Goater
2022-01-18 13:07 ` [PULL 02/31] docs: Rename ppc-spapr-hotplug.txt to ppc-spapr-hotplug.rst Cédric Le Goater
2022-01-18 13:07 ` [PULL 03/31] Link new ppc-spapr-hotplug.rst file to pseries.rst Cédric Le Goater
2022-01-18 13:07 ` [PULL 04/31] rSTify ppc-spapr-uv-hcalls.txt Cédric Le Goater
2022-01-18 13:07 ` [PULL 05/31] Rename ppc-spapr-uv-hcalls.txt to ppc-spapr-uv-hcalls.rst Cédric Le Goater
2022-01-18 13:07 ` [PULL 06/31] Link new ppc-spapr-uv-hcalls.rst to pseries.rst Cédric Le Goater
2022-01-18 13:07 ` [PULL 07/31] target/ppc: Remove last user of .load_state_old Cédric Le Goater
2022-01-18 13:07 ` [PULL 08/31] target/ppc: Finish removal of 401/403 CPUs Cédric Le Goater
2022-01-18 13:07 ` [PULL 09/31] target/ppc: Fix 7448 support Cédric Le Goater
2022-01-18 13:07 ` [PULL 10/31] tests/avocado: ppc: Add smoke tests for MPC7400 and MPC7450 families Cédric Le Goater
2022-01-18 13:07 ` [PULL 11/31] ppc/pnv: use PHB4 obj in pnv_pec_stk_pci_xscom_ops Cédric Le Goater
2022-01-18 13:07 ` [PULL 12/31] ppc/pnv: move PCI registers to PnvPHB4 Cédric Le Goater
2022-01-18 13:07 ` [PULL 13/31] ppc/pnv: move phbbar " Cédric Le Goater
2022-01-18 13:07 ` [PULL 14/31] ppc/pnv: move intbar " Cédric Le Goater
2022-01-18 13:07 ` [PULL 15/31] ppc/pnv: change pnv_phb4_update_regions() to use PnvPHB4 Cédric Le Goater
2022-01-18 13:07 ` [PULL 16/31] ppc/pnv: move mmbar0/mmbar1 and friends to PnvPHB4 Cédric Le Goater
2022-01-18 13:07 ` [PULL 17/31] ppc/pnv: move nest_regs[] " Cédric Le Goater
2022-01-18 13:07 ` [PULL 18/31] ppc/pnv: change pnv_pec_stk_update_map() to use PnvPHB4 Cédric Le Goater
2022-01-18 13:07 ` [PULL 19/31] ppc/pnv: move nest_regs_mr to PnvPHB4 Cédric Le Goater
2022-01-18 13:07 ` [PULL 20/31] ppc/pnv: move phb_regs_mr " Cédric Le Goater
2022-01-18 13:07 ` Cédric Le Goater [this message]
2022-01-18 13:07 ` [PULL 22/31] ppc/pnv: reduce stack->stack_no usage Cédric Le Goater
2022-01-18 13:07 ` [PULL 23/31] ppc/pnv: remove stack pointer from PnvPHB4 Cédric Le Goater
2022-01-18 13:07 ` [PULL 24/31] ppc/pnv: move default_phb_realize() to pec_realize() Cédric Le Goater
2022-01-18 13:07 ` [PULL 25/31] ppc/pnv: remove PnvPhb4PecStack::stack_no Cédric Le Goater
2022-01-18 13:07 ` [PULL 26/31] ppc/pnv: make PECs create and realize PHB4s Cédric Le Goater
2022-01-18 13:07 ` [PULL 27/31] ppc/pnv: remove PnvPhb4PecStack object Cédric Le Goater
2022-01-18 13:07 ` [PULL 28/31] ppc/pnv: rename pnv_pec_stk_update_map() Cédric Le Goater
2022-01-18 13:07 ` [PULL 29/31] ppc/pnv: Move root port allocation under pnv_pec_default_phb_realize() Cédric Le Goater
2022-01-18 13:07 ` [PULL 30/31] ppc/pnv: Add a 'rp_model' class attribute for the PHB4 PEC Cédric Le Goater
2022-01-18 13:07 ` [PULL 31/31] ppc/pnv: Remove PHB4 version property Cédric Le Goater
2022-01-18 22:27 ` [PULL 00/31] ppc queue Peter Maydell

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=20220118130730.1927983-22-clg@kaod.org \
    --to=clg@kaod.org \
    --cc=danielhb413@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=richard.henderson@linaro.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.