From: David Gibson <david@gibson.dropbear.id.au>
To: "Cédric Le Goater" <clg@kaod.org>
Cc: qemu-ppc@nongnu.org,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
qemu-devel@nongnu.org, Alexander Graf <agraf@suse.de>
Subject: Re: [Qemu-devel] [PATCH v2 2/7] ppc/pnv: add a PnvChip object
Date: Tue, 6 Sep 2016 10:52:26 +1000 [thread overview]
Message-ID: <20160906005226.GE2900@voom.fritz.box> (raw)
In-Reply-To: <5ba2f048-72bb-85b9-31a4-462c99e05386@kaod.org>
[-- Attachment #1: Type: text/plain, Size: 4538 bytes --]
On Mon, Sep 05, 2016 at 09:56:03AM +0200, Cédric Le Goater wrote:
> On 09/05/2016 04:58 AM, David Gibson wrote:
> > On Wed, Aug 31, 2016 at 06:34:10PM +0200, Cédric Le Goater wrote:
> >> This is is an abstraction of a POWER8 chip which is a set of cores
> >> plus other 'units', like the pervasive unit, the interrupt controller,
> >> the memory controller, the on-chip microcontroller, etc. The whole can
> >> be seen as a socket. It depends on a cpu model and its characteristics,
> >> max cores, specific init are defined in a PnvChipClass.
> >>
> >> We start with an near empty PnvChip with only a few cpu constants
> >> which we will grow in the subsequent patches with the controllers
> >> required to run the system.
> >>
> >> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> >> ---
> >>
> >> Changes since v1:
> >>
> >> - introduced a PnvChipClass depending on the cpu model. It also
> >> provides some chip constants used by devices, like the cpu model hw
> >> id (f000f), a enum type (not sure this is useful yet), a custom
> >> realize ops for customization.
> >> - the num-chips property can be configured on the command line.
> >>
> >> Maybe this object deserves its own file hw/ppc/pnv_chip.c ?
> >>
> >> hw/ppc/pnv.c | 154 +++++++++++++++++++++++++++++++++++++++++++++++++++
> >> include/hw/ppc/pnv.h | 71 ++++++++++++++++++++++++
> >> 2 files changed, 225 insertions(+)
> >>
> >> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> >> index 70413e3c5740..06051268e200 100644
> >> --- a/hw/ppc/pnv.c
> >> +++ b/hw/ppc/pnv.c
> >> @@ -168,6 +168,8 @@ static void ppc_powernv_init(MachineState *machine)
> >> char *fw_filename;
> >> long fw_size;
> >> long kernel_size;
> >> + int i;
> >> + char *chip_typename;
> >>
> >> /* allocate RAM */
> >> if (ram_size < (1 * G_BYTE)) {
> >> @@ -212,6 +214,153 @@ static void ppc_powernv_init(MachineState *machine)
> >> exit(1);
> >> }
> >> }
> >> +
> >> + /* Create the processor chips */
> >> + chip_typename = g_strdup_printf(TYPE_PNV_CHIP "-%s", machine->cpu_model);
> >> +
> >> + pnv->chips = g_new0(PnvChip *, pnv->num_chips);
> >> + for (i = 0; i < pnv->num_chips; i++) {
> >> + Object *chip = object_new(chip_typename);
> >> + object_property_set_int(chip, CHIP_HWID(i), "chip-id", &error_abort);
> >> + object_property_set_bool(chip, true, "realized", &error_abort);
> >
> > I'm guessing these could fail due to bad user supplied parameters, not
> > just internal bugs. In which case this should be &error_fatal rather
> > than &error_abort.
>
> yes.
>
> >
> >> + pnv->chips[i] = PNV_CHIP(chip);
> >> + }
> >> + g_free(chip_typename);
> >> +}
> >> +
> >> +static void pnv_chip_power8nvl_realize(PnvChip *chip, Error **errp)
> >> +{
> >> + ;
> >> +}
> >
> > I don't think you should need to define an empty realize function.
> > Or is this just a placeholder for things future patches will add?
>
> yes that was the plan but maybe this is a little early. chip_type
> proved to be useful enough for the moment in the full patchset
> I maintain.
>
> P9 will use a xive object when available and not a xics. I think
> this is when the real big difference will show up. So I should
> make realize() optional.
>
> >> +
> >> +static void pnv_chip_power8nvl_class_init(ObjectClass *klass, void *data)
> >> +{
> >> + DeviceClass *dc = DEVICE_CLASS(klass);
> >> + PnvChipClass *k = PNV_CHIP_CLASS(klass);
> >> +
> >> + k->realize = pnv_chip_power8nvl_realize;
> >> + k->cpu_model = "POWER8NVL";
> >> + k->chip_type = PNV_CHIP_P8NVL;
> >
> > With the new chip class per cpu class, does this chip_type field serve
> > any purpose any more?
>
> It does look a bit redundant, I agree. But it is useful for xscom
> address translation (P9 is a little different), for xscom devices
> in general, for core id to pir conversion. It also does for lpc_irq
> support, which applies to P8NVL (and upper I suppose).
>
> Let's keep it for the moment as it serves its purpose, which is
> to handle small differences without too much cost. If this is
> going too far, I will propose a set of ops per chip type.
Ok, fair enough.
--
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: 801 bytes --]
next prev parent reply other threads:[~2016-09-06 0:52 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-31 16:34 [Qemu-devel] [PATCH v2 0/7] ppc/pnv: add a minimal platform Cédric Le Goater
2016-08-31 16:34 ` [Qemu-devel] [PATCH v2 1/7] ppc/pnv: add skeleton PowerNV platform Cédric Le Goater
2016-09-01 16:31 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2016-09-02 6:32 ` Cédric Le Goater
2016-09-02 6:39 ` Benjamin Herrenschmidt
2016-09-05 2:48 ` [Qemu-devel] " David Gibson
2016-09-05 6:06 ` Cédric Le Goater
2016-08-31 16:34 ` [Qemu-devel] [PATCH v2 2/7] ppc/pnv: add a PnvChip object Cédric Le Goater
2016-09-01 17:21 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2016-09-02 6:34 ` Cédric Le Goater
2016-09-05 2:58 ` [Qemu-devel] " David Gibson
2016-09-05 6:59 ` Benjamin Herrenschmidt
2016-09-05 7:41 ` Cédric Le Goater
2016-09-05 8:28 ` Benjamin Herrenschmidt
2016-09-06 0:49 ` David Gibson
2016-09-06 6:21 ` Cédric Le Goater
2016-09-05 7:41 ` David Gibson
2016-09-05 9:10 ` Cédric Le Goater
2016-09-06 0:50 ` David Gibson
2016-09-05 7:56 ` Cédric Le Goater
2016-09-06 0:52 ` David Gibson [this message]
2016-08-31 16:34 ` [Qemu-devel] [PATCH v2 3/7] ppc/pnv: Add XSCOM infrastructure Cédric Le Goater
2016-09-05 3:39 ` David Gibson
2016-09-05 7:11 ` Benjamin Herrenschmidt
2016-09-06 0:48 ` David Gibson
2016-09-06 14:42 ` Cédric Le Goater
2016-09-06 21:47 ` Benjamin Herrenschmidt
2016-09-06 21:49 ` Benjamin Herrenschmidt
2016-09-07 15:55 ` Cédric Le Goater
2016-09-07 19:48 ` Benjamin Herrenschmidt
2016-09-07 2:03 ` David Gibson
2016-09-07 15:47 ` Cédric Le Goater
2016-09-07 21:53 ` Benjamin Herrenschmidt
2016-09-08 8:52 ` Cédric Le Goater
2016-09-07 2:01 ` David Gibson
2016-09-06 14:42 ` Cédric Le Goater
2016-09-06 21:45 ` Benjamin Herrenschmidt
2016-09-07 2:02 ` David Gibson
2016-09-07 16:40 ` Cédric Le Goater
2016-09-07 1:59 ` David Gibson
2016-09-07 5:27 ` Benjamin Herrenschmidt
2016-09-07 5:46 ` David Gibson
2016-09-07 8:29 ` Benjamin Herrenschmidt
2016-09-05 4:16 ` [Qemu-devel] [Qemu-ppc] " Sam Bobroff
2016-09-06 14:51 ` Cédric Le Goater
2016-08-31 16:34 ` [Qemu-devel] [PATCH v2 4/7] ppc/pnv: add a core mask to PnvChip Cédric Le Goater
2016-09-02 8:03 ` Cédric Le Goater
2016-09-05 3:42 ` David Gibson
2016-09-05 11:13 ` Cédric Le Goater
2016-09-05 11:30 ` Benjamin Herrenschmidt
2016-08-31 16:34 ` [Qemu-devel] [PATCH v2 5/7] ppc/pnv: add a PnvCore object Cédric Le Goater
2016-09-05 4:02 ` David Gibson
2016-09-06 6:14 ` Cédric Le Goater
2016-09-07 1:48 ` David Gibson
2016-08-31 16:34 ` [Qemu-devel] [PATCH v2 6/7] ppc/pnv: add a XScomDevice to PnvCore Cédric Le Goater
2016-09-05 4:19 ` David Gibson
2016-09-06 13:54 ` Cédric Le Goater
2016-09-07 1:51 ` David Gibson
2016-08-31 16:34 ` [Qemu-devel] [PATCH v2 7/7] monitor: fix crash for platforms without a CPU 0 Cédric Le Goater
2016-09-05 4:27 ` David Gibson
2016-09-06 6:28 ` Cédric Le Goater
2016-09-07 1:49 ` 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=20160906005226.GE2900@voom.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=agraf@suse.de \
--cc=benh@kernel.crashing.org \
--cc=clg@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 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.