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 14/17] Revert "ppc/pnv: Introduce support for user created PHB4 devices"
Date: Tue, 28 Dec 2021 16:38:03 -0300	[thread overview]
Message-ID: <20211228193806.1198496-15-danielhb413@gmail.com> (raw)
In-Reply-To: <20211228193806.1198496-1-danielhb413@gmail.com>

The upcoming code that allows for user creatable pnv-phb4 devices relies
on finding the correct pnv-phb4-pec controller to associate with. At
this moment the code that added support for user creatable pnv-phb4-pec
devices does not update chip9->pecs[] and pec->chip->num_pecs after
pnv_pec_realize(). This is not trivial to do because chip9-pecs[] is an
array of PEC devices, not an array of pointers to PEC devices.

All of this wasn't a problem back when this commit was introduced
because the pnv-phb4 devices of each pnv-phb4-pec were being created
automatically.  We had a change of heart since then, realizing that
dealing with pnv-phb4-pec is too complicated from the user standpoint.

In theory we could work the code to change chip9->pecs[] to be an array
of pointers and go from there, but in reality this will be a wasted
effort since we're going to backtrack on the user-creatable
pnv-phb4-pec. All PCI Express controllers of all chips will be created
by default. When running with default settings all pnv-phb4 PHBs will be
created, as usual. When running with '-nodefaults' the PECs will be
created without the PHBs, and then the user will be responsible for
adding them by hand in the command line.

Instead of fixing this situation with chip9->pecs[] not being up to date
with each user created pnv-phb4-pec, then work on user creatable pnv-phb4
support, then removing the support for user pnv-phb4-pec, let's remove
user-creatable pnv-phb4-pec right now and spare the extra code.

This reverts commit 7a221a8f6eb04d3e03081b06a89896803554e37d.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
 hw/pci-host/pnv_phb4_pec.c | 19 +------------------
 hw/ppc/pnv.c               |  5 ++---
 2 files changed, 3 insertions(+), 21 deletions(-)

diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c
index 3797696e8f..aa93ad3f10 100644
--- a/hw/pci-host/pnv_phb4_pec.c
+++ b/hw/pci-host/pnv_phb4_pec.c
@@ -382,17 +382,6 @@ static void pnv_pec_realize(DeviceState *dev, Error **errp)
     char name[64];
     int i;
 
-    /* User created devices */
-    if (!pec->chip) {
-        PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());
-
-        pec->chip = pnv_get_chip(pnv, pec->chip_id);
-        if (!pec->chip) {
-            error_setg(errp, "invalid chip id: %d", pec->chip_id);
-            return;
-        }
-    }
-
     if (pec->index >= PNV_CHIP_GET_CLASS(pec->chip)->num_pecs) {
         error_setg(errp, "invalid PEC index: %d", pec->index);
         return;
@@ -400,12 +389,6 @@ static void pnv_pec_realize(DeviceState *dev, Error **errp)
 
     pec->num_stacks = pecc->num_stacks[pec->index];
 
-    /*
-     * Reparent user created devices to the chip to build correctly
-     * the device tree.
-     */
-    pnv_chip_parent_fixup(pec->chip, OBJECT(pec), pec->index);
-
     /* Create stacks */
     for (i = 0; i < pec->num_stacks; i++) {
         PnvPhb4PecStack *stack = &pec->stacks[i];
@@ -538,7 +521,7 @@ static void pnv_pec_class_init(ObjectClass *klass, void *data)
 
     dc->realize = pnv_pec_realize;
     device_class_set_props(dc, pnv_pec_properties);
-    dc->user_creatable = true;
+    dc->user_creatable = false;
 
     pecc->xscom_nest_base = pnv_pec_xscom_nest_base;
     pecc->xscom_pci_base  = pnv_pec_xscom_pci_base;
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index c88fef26cf..bf2607446a 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -1426,9 +1426,8 @@ static void pnv_chip_power9_instance_init(Object *obj)
 
     object_initialize_child(obj, "homer", &chip9->homer, TYPE_PNV9_HOMER);
 
-    if (defaults_enabled()) {
-        chip->num_pecs = pcc->num_pecs;
-    }
+    /* Number of PECs is the chip default */
+    chip->num_pecs = pcc->num_pecs;
 
     for (i = 0; i < chip->num_pecs; i++) {
         object_initialize_child(obj, "pec[*]", &chip9->pecs[i],
-- 
2.33.1



  parent reply	other threads:[~2021-12-28 19:57 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-28 19:37 [PATCH 00/17] ppc/pnv: enable pnv-phb4 user devices Daniel Henrique Barboza
2021-12-28 19:37 ` [PATCH 01/17] pnv_phb3.c: add unique chassis and slot for pnv_phb3_root_port Daniel Henrique Barboza
2022-01-03  8:24   ` Cédric Le Goater
2022-01-04 19:33     ` Daniel Henrique Barboza
2022-01-05 14:04     ` Daniel Henrique Barboza
2021-12-28 19:37 ` [PATCH 02/17] pnv_phb3.c: do not set 'root-bus' as bus name Daniel Henrique Barboza
2022-01-03  8:25   ` Cédric Le Goater
2022-01-03  8:26   ` Cédric Le Goater
2021-12-28 19:37 ` [PATCH 03/17] pnv_phb3.h: change TYPE_PNV_PHB3_ROOT_BUS name Daniel Henrique Barboza
2022-01-03  8:28   ` Cédric Le Goater
2022-01-03 19:01     ` Daniel Henrique Barboza
2021-12-28 19:37 ` [PATCH 04/17] pnv_phb4.c: add unique chassis and slot for pnv_phb4_root_port Daniel Henrique Barboza
2021-12-28 19:37 ` [PATCH 05/17] pnv.c: simplify pnv_phb_attach_root_port() Daniel Henrique Barboza
2022-01-03  8:32   ` Cédric Le Goater
2021-12-28 19:37 ` [PATCH 06/17] pnv_phb4.c: attach default root port in phb4 realize() Daniel Henrique Barboza
2022-01-03  8:33   ` Cédric Le Goater
2021-12-28 19:37 ` [PATCH 07/17] pnv_phb4.c: check if root port exists in rc_config functions Daniel Henrique Barboza
2022-01-03  8:53   ` Cédric Le Goater
2021-12-28 19:37 ` [PATCH 08/17] pnv_phb4.c: introduce pnv_phb4_set_stack_phb_props() Daniel Henrique Barboza
2021-12-28 19:37 ` [PATCH 09/17] pnv_phb4_pec.c: move pnv_pec_phb_offset() to pnv_phb4.c Daniel Henrique Barboza
2022-01-03  9:00   ` Cédric Le Goater
2022-01-05 19:14     ` Daniel Henrique Barboza
2021-12-28 19:37 ` [PATCH 10/17] pnv_phb4.c: introduce pnv_pec_init_stack_xscom() Daniel Henrique Barboza
2021-12-28 19:38 ` [PATCH 11/17] pnv_phb4_pec.c: use pnv_pec_get_phb_id() in pnv_pec_dt_xscom() Daniel Henrique Barboza
2022-01-03  9:08   ` Cédric Le Goater
2022-01-05 18:55     ` Daniel Henrique Barboza
2021-12-28 19:38 ` [PATCH 12/17] pnv_phb4_pec.c: use 'default_enabled()' to init stack->phb Daniel Henrique Barboza
2021-12-28 19:38 ` [PATCH 13/17] pnv_phb4.h: turn phb into a pointer in struct PnvPhb4PecStack Daniel Henrique Barboza
2021-12-28 19:38 ` Daniel Henrique Barboza [this message]
2021-12-28 19:38 ` [PATCH 15/17] ppc/pnv: Introduce user creatable pnv-phb4 devices Daniel Henrique Barboza
2021-12-28 19:38 ` [PATCH 16/17] pnv_phb4.c: do not set 'root-bus' as bus name Daniel Henrique Barboza
2022-01-03  8:40   ` Cédric Le Goater
2021-12-28 19:38 ` [PATCH 17/17] pnv_phb4.c: change TYPE_PNV_PHB4_ROOT_BUS name Daniel Henrique Barboza
2022-01-03  8:21 ` [PATCH 00/17] ppc/pnv: enable pnv-phb4 user devices Cédric Le Goater
2022-01-03 18:58   ` Daniel Henrique Barboza
2022-01-03 21:20     ` Cédric Le Goater
2022-01-03 21:37       ` Daniel Henrique Barboza
2022-01-04  7:39 ` 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=20211228193806.1198496-15-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.