From: David Gibson <david@gibson.dropbear.id.au>
To: "Cédric Le Goater" <clg@kaod.org>
Cc: groug@kaod.org, qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 4/7] pnv: Clean up cpu realize path
Date: Wed, 13 Jun 2018 19:14:26 +1000 [thread overview]
Message-ID: <20180613091426.GB30690@umbus.fritz.box> (raw)
In-Reply-To: <dff8eff9-89da-5fcb-579d-656b356924a4@kaod.org>
[-- Attachment #1: Type: text/plain, Size: 4548 bytes --]
On Wed, Jun 13, 2018 at 10:20:43AM +0200, Cédric Le Goater wrote:
> On 06/13/2018 08:57 AM, David Gibson wrote:
> > pnv_cpu_init() is only called from the the pnv cpu core realize path, and
> > really only can be called from there. So fold it into its caller, which
> > we also rename for brevity.
> >
> > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
>
> I think we should set the default CPU settings (PIR) before creating
> the 'intc' object. I have cleanup for that in the pnv patchset.
> Nevertheless,
Ok.
> Reviewed-by: Cédric Le Goater <clg@kaod.org>
>
> Thanks,
>
> C.
>
> > ---
> > hw/ppc/pnv_core.c | 56 ++++++++++++++++++-----------------------------
> > 1 file changed, 21 insertions(+), 35 deletions(-)
> >
> > diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c
> > index 59309e149c..c9648fd1ad 100644
> > --- a/hw/ppc/pnv_core.c
> > +++ b/hw/ppc/pnv_core.c
> > @@ -54,28 +54,6 @@ static void pnv_cpu_reset(void *opaque)
> > env->msr |= MSR_HVB; /* Hypervisor mode */
> > }
> >
> > -static void pnv_cpu_init(PowerPCCPU *cpu, Error **errp)
> > -{
> > - CPUPPCState *env = &cpu->env;
> > - int core_pir;
> > - int thread_index = 0; /* TODO: TCG supports only one thread */
> > - ppc_spr_t *pir = &env->spr_cb[SPR_PIR];
> > -
> > - core_pir = object_property_get_uint(OBJECT(cpu), "core-pir", &error_abort);
> > -
> > - /*
> > - * The PIR of a thread is the core PIR + the thread index. We will
> > - * need to find a way to get the thread index when TCG supports
> > - * more than 1. We could use the object name ?
> > - */
> > - pir->default_value = core_pir + thread_index;
> > -
> > - /* Set time-base frequency to 512 MHz */
> > - cpu_ppc_tb_init(env, PNV_TIMEBASE_FREQ);
> > -
> > - qemu_register_reset(pnv_cpu_reset, cpu);
> > -}
> > -
> > /*
> > * These values are read by the PowerNV HW monitors under Linux
> > */
> > @@ -121,29 +99,39 @@ static const MemoryRegionOps pnv_core_xscom_ops = {
> > .endianness = DEVICE_BIG_ENDIAN,
> > };
> >
> > -static void pnv_core_realize_child(Object *child, XICSFabric *xi, Error **errp)
> > +static void pnv_realize_vcpu(PowerPCCPU *cpu, XICSFabric *xi, Error **errp)
> > {
> > + CPUPPCState *env = &cpu->env;
> > + int core_pir;
> > + int thread_index = 0; /* TODO: TCG supports only one thread */
> > + ppc_spr_t *pir = &env->spr_cb[SPR_PIR];
> > Error *local_err = NULL;
> > - CPUState *cs = CPU(child);
> > - PowerPCCPU *cpu = POWERPC_CPU(cs);
> >
> > - object_property_set_bool(child, true, "realized", &local_err);
> > + object_property_set_bool(OBJECT(cpu), true, "realized", &local_err);
> > if (local_err) {
> > error_propagate(errp, local_err);
> > return;
> > }
> >
> > - cpu->intc = icp_create(child, TYPE_PNV_ICP, xi, &local_err);
> > + cpu->intc = icp_create(OBJECT(cpu), TYPE_PNV_ICP, xi, &local_err);
> > if (local_err) {
> > error_propagate(errp, local_err);
> > return;
> > }
> >
> > - pnv_cpu_init(cpu, &local_err);
> > - if (local_err) {
> > - error_propagate(errp, local_err);
> > - return;
> > - }
> > + core_pir = object_property_get_uint(OBJECT(cpu), "core-pir", &error_abort);
> > +
> > + /*
> > + * The PIR of a thread is the core PIR + the thread index. We will
> > + * need to find a way to get the thread index when TCG supports
> > + * more than 1. We could use the object name ?
> > + */
> > + pir->default_value = core_pir + thread_index;
> > +
> > + /* Set time-base frequency to 512 MHz */
> > + cpu_ppc_tb_init(env, PNV_TIMEBASE_FREQ);
> > +
> > + qemu_register_reset(pnv_cpu_reset, cpu);
> > }
> >
> > static void pnv_core_realize(DeviceState *dev, Error **errp)
> > @@ -184,9 +172,7 @@ static void pnv_core_realize(DeviceState *dev, Error **errp)
> > }
> >
> > for (j = 0; j < cc->nr_threads; j++) {
> > - obj = OBJECT(pc->threads[j]);
> > -
> > - pnv_core_realize_child(obj, XICS_FABRIC(xi), &local_err);
> > + pnv_realize_vcpu(pc->threads[j], XICS_FABRIC(xi), &local_err);
> > if (local_err) {
> > goto 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:[~2018-06-13 9:33 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-13 6:57 [Qemu-devel] [PATCH 0/7] Better handling of machine specific per-cpu information David Gibson
2018-06-13 6:57 ` [Qemu-devel] [PATCH 1/7] spapr: Clean up cpu realize/unrealize paths David Gibson
2018-06-13 8:11 ` Cédric Le Goater
2018-06-13 8:51 ` Greg Kurz
2018-06-13 8:52 ` David Gibson
2018-06-13 8:34 ` Greg Kurz
2018-06-13 6:57 ` [Qemu-devel] [PATCH 2/7] pnv: Add missing error check during cpu realize() David Gibson
2018-06-13 8:15 ` Cédric Le Goater
2018-06-13 9:12 ` David Gibson
2018-06-13 9:09 ` Greg Kurz
2018-06-13 9:14 ` Cédric Le Goater
2018-06-13 9:42 ` Greg Kurz
2018-06-13 9:53 ` David Gibson
2018-06-14 1:01 ` David Gibson
2018-06-13 9:42 ` David Gibson
2018-06-13 6:57 ` [Qemu-devel] [PATCH 3/7] pnv_core: Allocate cpu thread objects individually David Gibson
2018-06-13 8:17 ` Cédric Le Goater
2018-06-13 9:13 ` Greg Kurz
2018-06-13 6:57 ` [Qemu-devel] [PATCH 4/7] pnv: Clean up cpu realize path David Gibson
2018-06-13 8:20 ` Cédric Le Goater
2018-06-13 9:14 ` David Gibson [this message]
2018-06-13 9:15 ` Greg Kurz
2018-06-13 6:57 ` [Qemu-devel] [PATCH 5/7] pnv: Add cpu unrealize path David Gibson
2018-06-13 8:23 ` Cédric Le Goater
2018-06-13 9:16 ` Greg Kurz
2018-06-13 6:57 ` [Qemu-devel] [PATCH 6/7] target/ppc: Replace intc pointer with a general machine_data pointer David Gibson
2018-06-13 8:46 ` Cédric Le Goater
2018-06-13 9:45 ` David Gibson
2018-06-13 10:11 ` Greg Kurz
2018-06-13 10:15 ` David Gibson
2018-06-13 6:57 ` [Qemu-devel] [PATCH 7/7] target/ppc, spapr: Move VPA information to machine_data David Gibson
2018-06-13 10:16 ` Greg Kurz
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=20180613091426.GB30690@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).