From: David Gibson <david@gibson.dropbear.id.au>
To: "Cédric Le Goater" <clg@kaod.org>
Cc: qemu-ppc@nongnu.org, Greg Kurz <groug@kaod.org>, qemu-devel@nongnu.org
Subject: Re: [PATCH v2 04/13] ppc/pnv: Introduce a "xics" property under the POWER8 chip
Date: Mon, 23 Dec 2019 15:17:00 +1100 [thread overview]
Message-ID: <20191223041700.GB21569@umbus.fritz.box> (raw)
In-Reply-To: <20191219181155.32530-5-clg@kaod.org>
[-- Attachment #1: Type: text/plain, Size: 5202 bytes --]
On Thu, Dec 19, 2019 at 07:11:46PM +0100, Cédric Le Goater wrote:
> POWER8 is the only chip using the XICS interface. Add a "xics" link
> and a XICSFabric attribute under this chip to remove the use of
> qdev_get_machine()
>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> Reviewed-by: Greg Kurz <groug@kaod.org>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
but will need a rebase.
> ---
> include/hw/ppc/pnv.h | 2 ++
> hw/ppc/pnv.c | 26 ++++++++++++++++++++------
> 2 files changed, 22 insertions(+), 6 deletions(-)
>
> diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h
> index f31180618672..8b957dfb5736 100644
> --- a/include/hw/ppc/pnv.h
> +++ b/include/hw/ppc/pnv.h
> @@ -74,6 +74,8 @@ typedef struct Pnv8Chip {
> Pnv8Psi psi;
> PnvOCC occ;
> PnvHomer homer;
> +
> + XICSFabric *xics;
> } Pnv8Chip;
>
> #define TYPE_PNV9_CHIP "pnv9-chip"
> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> index 163a658806e2..2a1b15a69aed 100644
> --- a/hw/ppc/pnv.c
> +++ b/hw/ppc/pnv.c
> @@ -797,6 +797,13 @@ static void pnv_init(MachineState *machine)
> */
> object_property_set_link(chip, OBJECT(sysmem), "system-memory",
> &error_abort);
> + /*
> + * The POWER8 machine use the XICS interrupt interface.
> + * Propagate the XICS fabric to the chip and its controllers.
> + */
> + if (object_dynamic_cast(OBJECT(pnv), TYPE_XICS_FABRIC)) {
> + object_property_set_link(chip, OBJECT(pnv), "xics", &error_abort);
> + }
> object_property_set_bool(chip, true, "realized", &error_fatal);
> }
> g_free(chip_typename);
> @@ -838,12 +845,12 @@ static uint32_t pnv_chip_core_pir_p8(PnvChip *chip, uint32_t core_id)
> static void pnv_chip_power8_intc_create(PnvChip *chip, PowerPCCPU *cpu,
> Error **errp)
> {
> + Pnv8Chip *chip8 = PNV8_CHIP(chip);
> Error *local_err = NULL;
> Object *obj;
> PnvCPUState *pnv_cpu = pnv_cpu_state(cpu);
>
> - obj = icp_create(OBJECT(cpu), TYPE_PNV_ICP, XICS_FABRIC(qdev_get_machine()),
> - &local_err);
> + obj = icp_create(OBJECT(cpu), TYPE_PNV_ICP, chip8->xics, &local_err);
> if (local_err) {
> error_propagate(errp, local_err);
> return;
> @@ -997,6 +1004,12 @@ static void pnv_chip_power8_instance_init(Object *obj)
> {
> Pnv8Chip *chip8 = PNV8_CHIP(obj);
>
> + object_property_add_link(obj, "xics", TYPE_XICS_FABRIC,
> + (Object **)&chip8->xics,
> + object_property_allow_set_link,
> + OBJ_PROP_LINK_STRONG,
> + &error_abort);
> +
> object_initialize_child(obj, "psi", &chip8->psi, sizeof(chip8->psi),
> TYPE_PNV8_PSI, &error_abort, NULL);
>
> @@ -1016,7 +1029,6 @@ static void pnv_chip_icp_realize(Pnv8Chip *chip8, Error **errp)
> PnvChipClass *pcc = PNV_CHIP_GET_CLASS(chip);
> int i, j;
> char *name;
> - XICSFabric *xi = XICS_FABRIC(qdev_get_machine());
>
> name = g_strdup_printf("icp-%x", chip->chip_id);
> memory_region_init(&chip8->icp_mmio, OBJECT(chip), name, PNV_ICP_SIZE);
> @@ -1032,7 +1044,7 @@ static void pnv_chip_icp_realize(Pnv8Chip *chip8, Error **errp)
>
> for (j = 0; j < CPU_CORE(pnv_core)->nr_threads; j++) {
> uint32_t pir = pcc->core_pir(chip, core_hwid) + j;
> - PnvICPState *icp = PNV_ICP(xics_icp_get(xi, pir));
> + PnvICPState *icp = PNV_ICP(xics_icp_get(chip8->xics, pir));
>
> memory_region_add_subregion(&chip8->icp_mmio, pir << 12,
> &icp->mmio);
> @@ -1048,6 +1060,8 @@ static void pnv_chip_power8_realize(DeviceState *dev, Error **errp)
> Pnv8Psi *psi8 = &chip8->psi;
> Error *local_err = NULL;
>
> + assert(chip8->xics);
> +
> /* XSCOM bridge is first */
> pnv_xscom_realize(chip, PNV_XSCOM_SIZE, &local_err);
> if (local_err) {
> @@ -1067,8 +1081,8 @@ static void pnv_chip_power8_realize(DeviceState *dev, Error **errp)
> "bar", &error_fatal);
> object_property_set_link(OBJECT(&chip8->psi), OBJECT(chip->system_memory),
> "system-memory", &error_abort);
> - object_property_set_link(OBJECT(&chip8->psi), OBJECT(qdev_get_machine()),
> - ICS_PROP_XICS, &error_abort);
> + object_property_set_link(OBJECT(&chip8->psi), OBJECT(chip8->xics),
> + ICS_PROP_XICS, &error_abort);
> object_property_set_bool(OBJECT(&chip8->psi), true, "realized", &local_err);
> if (local_err) {
> error_propagate(errp, local_err);
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2019-12-23 4:18 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-19 18:11 [PATCH v2 00/13] ppc/pnv: remove the use of qdev_get_machine() and get_system_memory() Cédric Le Goater
2019-12-19 18:11 ` [PATCH v2 01/13] ppc/pnv: Modify the powerdown notifier to get the PowerNV machine Cédric Le Goater
2019-12-20 0:26 ` David Gibson
2019-12-19 18:11 ` [PATCH v2 02/13] ppc/pnv: Introduce a "system-memory" property Cédric Le Goater
2019-12-19 18:56 ` Greg Kurz
2019-12-20 0:31 ` David Gibson
2019-12-20 6:49 ` Cédric Le Goater
2019-12-19 18:11 ` [PATCH v2 03/13] ppc/pnv: Introduce a "xics" property alias under the PSI model Cédric Le Goater
2019-12-22 9:33 ` David Gibson
2019-12-19 18:11 ` [PATCH v2 04/13] ppc/pnv: Introduce a "xics" property under the POWER8 chip Cédric Le Goater
2019-12-23 4:17 ` David Gibson [this message]
2019-12-19 18:11 ` [PATCH v2 05/13] spapr/xive: Use device_class_set_parent_realize() Cédric Le Goater
2019-12-23 4:27 ` David Gibson
2019-12-19 18:11 ` [PATCH v2 06/13] pnv/xive: " Cédric Le Goater
2019-12-23 4:29 ` David Gibson
2019-12-19 18:11 ` [PATCH v2 07/13] spapr, pnv, xive: Add a "xive-fabric" link to the XIVE router Cédric Le Goater
2019-12-23 6:10 ` David Gibson
2019-12-19 18:11 ` [PATCH v2 08/13] xive: Use the XIVE fabric link under " Cédric Le Goater
2019-12-23 6:11 ` David Gibson
2019-12-19 18:11 ` [PATCH v2 09/13] ppc/pnv: Add an "nr-threads" property to the base chip class Cédric Le Goater
2019-12-23 6:12 ` David Gibson
2019-12-19 18:11 ` [PATCH v2 10/13] ppc/pnv: Add a "pnor" const link property to the BMC internal simulator Cédric Le Goater
2019-12-19 18:11 ` [PATCH v2 11/13] xive: Add a "presenter" link property to the TCTX object Cédric Le Goater
2019-12-19 18:11 ` [PATCH v2 12/13] spapr/xive: Deduce the SpaprXive pointer from XiveTCTX::xptr Cédric Le Goater
2019-12-19 18:11 ` [PATCH v2 13/13] pnv/xive: Deduce the PnvXive " Cédric Le Goater
2019-12-23 6:16 ` [PATCH v2 00/13] ppc/pnv: remove the use of qdev_get_machine() and get_system_memory() David Gibson
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=20191223041700.GB21569@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=clg@kaod.org \
--cc=groug@kaod.org \
--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).