All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Greg Kurz <groug@kaod.org>
Cc: "Cédric Le Goater" <clg@kaod.org>,
	"Thomas Huth" <thuth@redhat.com>,
	qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/4] ppc/pnv: introduce a CPU machine_data
Date: Sat, 26 Jan 2019 15:37:12 +1300	[thread overview]
Message-ID: <20190126023712.GG22942@umbus> (raw)
In-Reply-To: <20190117091302.1d46e737@bahia.lan>

[-- Attachment #1: Type: text/plain, Size: 4278 bytes --]

On Thu, Jan 17, 2019 at 09:13:02AM +0100, Greg Kurz wrote:
> On Thu, 17 Jan 2019 08:53:25 +0100
> Cédric Le Goater <clg@kaod.org> wrote:
> 
> > Include the interrupt presenter under the machine_data as we plan to
> > remove it from under PowerPCCPU
> > 
> > Signed-off-by: Cédric Le Goater <clg@kaod.org>
> > ---
> 
> Reviewed-by: Greg Kurz <groug@kaod.org>

Applied, thanks.

> 
> >  include/hw/ppc/pnv_core.h |  9 +++++++++
> >  hw/ppc/pnv.c              |  7 ++++---
> >  hw/ppc/pnv_core.c         | 12 +++++++++++-
> >  3 files changed, 24 insertions(+), 4 deletions(-)
> > 
> > diff --git a/include/hw/ppc/pnv_core.h b/include/hw/ppc/pnv_core.h
> > index 447ae761f7ae..9961ea3a92cd 100644
> > --- a/include/hw/ppc/pnv_core.h
> > +++ b/include/hw/ppc/pnv_core.h
> > @@ -47,4 +47,13 @@ typedef struct PnvCoreClass {
> >  #define PNV_CORE_TYPE_SUFFIX "-" TYPE_PNV_CORE
> >  #define PNV_CORE_TYPE_NAME(cpu_model) cpu_model PNV_CORE_TYPE_SUFFIX
> >  
> > +typedef struct PnvCPUState {
> > +    struct ICPState *icp;
> > +} PnvCPUState;
> > +
> > +static inline PnvCPUState *pnv_cpu_state(PowerPCCPU *cpu)
> > +{
> > +    return (PnvCPUState *)cpu->machine_data;
> > +}
> > +
> >  #endif /* _PPC_PNV_CORE_H */
> > diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> > index d84acef55b69..da540860a2b0 100644
> > --- a/hw/ppc/pnv.c
> > +++ b/hw/ppc/pnv.c
> > @@ -673,6 +673,7 @@ static void pnv_chip_power8_intc_create(PnvChip *chip, PowerPCCPU *cpu,
> >  {
> >      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);
> > @@ -681,7 +682,7 @@ static void pnv_chip_power8_intc_create(PnvChip *chip, PowerPCCPU *cpu,
> >          return;
> >      }
> >  
> > -    cpu->icp = ICP(obj);
> > +    pnv_cpu->icp = ICP(obj);
> >  }
> >  
> >  /*
> > @@ -1099,7 +1100,7 @@ static ICPState *pnv_icp_get(XICSFabric *xi, int pir)
> >  {
> >      PowerPCCPU *cpu = ppc_get_vcpu_by_pir(pir);
> >  
> > -    return cpu ? cpu->icp : NULL;
> > +    return cpu ? pnv_cpu_state(cpu)->icp : NULL;
> >  }
> >  
> >  static void pnv_pic_print_info(InterruptStatsProvider *obj,
> > @@ -1112,7 +1113,7 @@ static void pnv_pic_print_info(InterruptStatsProvider *obj,
> >      CPU_FOREACH(cs) {
> >          PowerPCCPU *cpu = POWERPC_CPU(cs);
> >  
> > -        icp_pic_print_info(cpu->icp, mon);
> > +        icp_pic_print_info(pnv_cpu_state(cpu)->icp, mon);
> >      }
> >  
> >      for (i = 0; i < pnv->num_chips; i++) {
> > diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c
> > index b98f277f1e02..7c806da720c6 100644
> > --- a/hw/ppc/pnv_core.c
> > +++ b/hw/ppc/pnv_core.c
> > @@ -155,7 +155,10 @@ static void pnv_core_realize(DeviceState *dev, Error **errp)
> >  
> >      pc->threads = g_new(PowerPCCPU *, cc->nr_threads);
> >      for (i = 0; i < cc->nr_threads; i++) {
> > +        PowerPCCPU *cpu;
> > +
> >          obj = object_new(typename);
> > +        cpu = POWERPC_CPU(obj);
> >  
> >          pc->threads[i] = POWERPC_CPU(obj);
> >  
> > @@ -163,6 +166,9 @@ static void pnv_core_realize(DeviceState *dev, Error **errp)
> >          object_property_add_child(OBJECT(pc), name, obj, &error_abort);
> >          object_property_add_alias(obj, "core-pir", OBJECT(pc),
> >                                    "pir", &error_abort);
> > +
> > +        cpu->machine_data = g_new0(PnvCPUState, 1);
> > +
> >          object_unref(obj);
> >      }
> >  
> > @@ -189,9 +195,13 @@ err:
> >  
> >  static void pnv_unrealize_vcpu(PowerPCCPU *cpu)
> >  {
> > +    PnvCPUState *pnv_cpu = pnv_cpu_state(cpu);
> > +
> >      qemu_unregister_reset(pnv_cpu_reset, cpu);
> > -    object_unparent(OBJECT(cpu->icp));
> > +    object_unparent(OBJECT(pnv_cpu_state(cpu)->icp));
> >      cpu_remove_sync(CPU(cpu));
> > +    cpu->machine_data = NULL;
> > +    g_free(pnv_cpu);
> >      object_unparent(OBJECT(cpu));
> >  }
> >  
> 

-- 
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 --]

  reply	other threads:[~2019-01-27  1:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-17  7:53 [Qemu-devel] [PATCH 0/4] ppc: move the interrupt presenters under the CPU machine_data Cédric Le Goater
2019-01-17  7:53 ` [Qemu-devel] [PATCH 1/4] xive: add a get_tctx() method to the XiveRouter Cédric Le Goater
2019-01-17  8:12   ` Greg Kurz
2019-01-26  2:29     ` David Gibson
2019-01-17  7:53 ` [Qemu-devel] [PATCH 2/4] ppc/pnv: introduce a CPU machine_data Cédric Le Goater
2019-01-17  8:13   ` Greg Kurz
2019-01-26  2:37     ` David Gibson [this message]
2019-01-17  7:53 ` [Qemu-devel] [PATCH 3/4] spapr: move the interrupt presenters under machine_data Cédric Le Goater
2019-01-17  8:14   ` Greg Kurz
2019-01-26  2:31     ` David Gibson
2019-01-17  7:53 ` [Qemu-devel] [PATCH 4/4] ppc: remove the interrupt presenters from under PowerPCCPU Cédric Le Goater
2019-01-17  8:20   ` Greg Kurz
2019-01-17  8:23     ` Thomas Huth
2019-01-17  8:26       ` Cédric Le Goater
2019-01-17  9:00         ` [Qemu-devel] [PATCH v6] ppc: Fix duplicated typedefs to be able to compile with Clang in gnu99 mode Thomas Huth
2019-01-17  9:20           ` 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=20190126023712.GG22942@umbus \
    --to=david@gibson.dropbear.id.au \
    --cc=clg@kaod.org \
    --cc=groug@kaod.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=thuth@redhat.com \
    /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.