All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: Igor Mammedov <imammedo@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	qemu-devel@nongnu.org, Alexander Graf <agraf@suse.de>,
	qemu-ppc@nongnu.org, Cedric Le Goater <clg@kaod.org>,
	Bharata B Rao <bharata@linux.vnet.ibm.com>,
	Scott Wood <scottwood@freescale.com>
Subject: Re: [Qemu-devel] [PATCH v2 3/7] ppc: different creation paths for cpus in system and user mode
Date: Mon, 4 Jul 2016 09:40:58 +0200	[thread overview]
Message-ID: <20160704094058.7b504caa@bahia.lan> (raw)
In-Reply-To: <20160704091443.17f2ddf0@172-15-182-60.lightspeed.austtx.sbcglobal.net>

On Mon, 4 Jul 2016 09:14:43 +0200
Igor Mammedov <imammedo@redhat.com> wrote:

> On Sat, 02 Jul 2016 00:41:40 +0200
> Greg Kurz <groug@kaod.org> wrote:
> 
> > The machine code currently uses the same cpu_ppc_init() function to
> > create cpus as the user mode. This function also triggers the cpu
> > realization.
> > 
> > It is okay for user mode but with system mode we may want to do other
> > things between initialization and realization, like generating cpu
> > ids for the DT for example.
> > 
> > With this patch, each mode has its own creation helper:
> > - ppc_cpu_init() is for system mode only
> > - cpu_init() is for user mode only
> > 
> > Suggested-by: Igor Mammedov <imammedo@redhat.com>
> > Signed-off-by: Greg Kurz <groug@kaod.org>
> > ---
> >  hw/ppc/e500.c               |    2 +-
> >  hw/ppc/mac_newworld.c       |    2 +-
> >  hw/ppc/mac_oldworld.c       |    2 +-
> >  hw/ppc/ppc.c                |    5 +++++
> >  hw/ppc/ppc440_bamboo.c      |    2 +-
> >  hw/ppc/ppc4xx_devs.c        |    2 +-
> >  hw/ppc/prep.c               |    2 +-
> >  hw/ppc/spapr.c              |    2 +-
> >  hw/ppc/virtex_ml507.c       |    2 +-
> >  include/hw/ppc/ppc.h        |    1 +
> >  target-ppc/cpu.h            |    5 +++--
> >  target-ppc/translate_init.c |    5 -----
> >  12 files changed, 17 insertions(+), 15 deletions(-)
> > 
> > diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
> > index 0cd534df55f8..ff5d92e48dd9 100644
> > --- a/hw/ppc/e500.c
> > +++ b/hw/ppc/e500.c
> > @@ -821,7 +821,7 @@ void ppce500_init(MachineState *machine,
> > PPCE500Params *params) CPUState *cs;
> >          qemu_irq *input;
> >  
> > -        cpu = cpu_ppc_init(machine->cpu_model);
> > +        cpu = ppc_cpu_init(machine->cpu_model);
> >          if (cpu == NULL) {
> >              fprintf(stderr, "Unable to initialize CPU!\n");
> >              exit(1);
> > diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
> > index 32e88b378687..6ab675c498d0 100644
> > --- a/hw/ppc/mac_newworld.c
> > +++ b/hw/ppc/mac_newworld.c
> > @@ -193,7 +193,7 @@ static void ppc_core99_init(MachineState *machine)
> >  #endif
> >      }
> >      for (i = 0; i < smp_cpus; i++) {
> > -        cpu = cpu_ppc_init(machine->cpu_model);
> > +        cpu = ppc_cpu_init(machine->cpu_model);
> >          if (cpu == NULL) {
> >              fprintf(stderr, "Unable to find PowerPC CPU
> > definition\n"); exit(1);
> > diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
> > index 447948746b1a..77fbdfffd4e2 100644
> > --- a/hw/ppc/mac_oldworld.c
> > +++ b/hw/ppc/mac_oldworld.c
> > @@ -113,7 +113,7 @@ static void ppc_heathrow_init(MachineState
> > *machine) if (machine->cpu_model == NULL)
> >          machine->cpu_model = "G3";
> >      for (i = 0; i < smp_cpus; i++) {
> > -        cpu = cpu_ppc_init(machine->cpu_model);
> > +        cpu = ppc_cpu_init(machine->cpu_model);
> >          if (cpu == NULL) {
> >              fprintf(stderr, "Unable to find PowerPC CPU
> > definition\n"); exit(1);
> > diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
> > index e4252528a69d..dc3d214009c5 100644
> > --- a/hw/ppc/ppc.c
> > +++ b/hw/ppc/ppc.c
> > @@ -1350,3 +1350,8 @@ PowerPCCPU *ppc_get_vcpu_by_dt_id(int cpu_dt_id)
> >  
> >      return NULL;
> >  }
> > +
> > +PowerPCCPU *ppc_cpu_init(const char *cpu_model)
> > +{
> > +    return POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU,
> > cpu_model)); +}
> > diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c
> > index 5c535b18a20d..7f22433c8e91 100644
> > --- a/hw/ppc/ppc440_bamboo.c
> > +++ b/hw/ppc/ppc440_bamboo.c
> > @@ -186,7 +186,7 @@ static void bamboo_init(MachineState *machine)
> >      if (machine->cpu_model == NULL) {
> >          machine->cpu_model = "440EP";
> >      }
> > -    cpu = cpu_ppc_init(machine->cpu_model);
> > +    cpu = ppc_cpu_init(machine->cpu_model);
> >      if (cpu == NULL) {
> >          fprintf(stderr, "Unable to initialize CPU!\n");
> >          exit(1);
> > diff --git a/hw/ppc/ppc4xx_devs.c b/hw/ppc/ppc4xx_devs.c
> > index e7f413e49d08..94a24243af70 100644
> > --- a/hw/ppc/ppc4xx_devs.c
> > +++ b/hw/ppc/ppc4xx_devs.c
> > @@ -56,7 +56,7 @@ PowerPCCPU *ppc4xx_init(const char *cpu_model,
> >      CPUPPCState *env;
> >  
> >      /* init CPUs */
> > -    cpu = cpu_ppc_init(cpu_model);
> > +    cpu = ppc_cpu_init(cpu_model, 0);
> >      if (cpu == NULL) {
> >          fprintf(stderr, "Unable to find PowerPC %s CPU definition\n",
> >                  cpu_model);
> > diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
> > index 054af1e8b481..e62fe643f492 100644
> > --- a/hw/ppc/prep.c
> > +++ b/hw/ppc/prep.c
> > @@ -509,7 +509,7 @@ static void ppc_prep_init(MachineState *machine)
> >      if (machine->cpu_model == NULL)
> >          machine->cpu_model = "602";
> >      for (i = 0; i < smp_cpus; i++) {
> > -        cpu = cpu_ppc_init(machine->cpu_model);
> > +        cpu = ppc_cpu_init(machine->cpu_model);
> >          if (cpu == NULL) {
> >              fprintf(stderr, "Unable to find PowerPC CPU
> > definition\n"); exit(1);
> > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> > index 78ebd9ee38ce..690ee486aa07 100644
> > --- a/hw/ppc/spapr.c
> > +++ b/hw/ppc/spapr.c
> > @@ -1828,7 +1828,7 @@ static void ppc_spapr_init(MachineState
> > *machine) g_free(type);
> >      } else {
> >          for (i = 0; i < smp_cpus; i++) {
> > -            PowerPCCPU *cpu = cpu_ppc_init(machine->cpu_model);
> > +            PowerPCCPU *cpu = ppc_cpu_init(machine->cpu_model);
> >              if (cpu == NULL) {
> >                  error_report("Unable to find PowerPC CPU
> > definition"); exit(1);
> > diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c
> > index b97d96685cf1..8d350fb98b2c 100644
> > --- a/hw/ppc/virtex_ml507.c
> > +++ b/hw/ppc/virtex_ml507.c
> > @@ -96,7 +96,7 @@ static PowerPCCPU *ppc440_init_xilinx(ram_addr_t
> > *ram_size, CPUPPCState *env;
> >      qemu_irq *irqs;
> >  
> > -    cpu = cpu_ppc_init(cpu_model);
> > +    cpu = ppc_cpu_init(cpu_model, 0);  
> shouldn't it have only 1 argument?
> 

Yes ! And the build breaks... :-\

> >      if (cpu == NULL) {
> >          fprintf(stderr, "Unable to initialize CPU!\n");
> >          exit(1);
> > diff --git a/include/hw/ppc/ppc.h b/include/hw/ppc/ppc.h
> > index 5617dc4a2c04..a4db1db82e1b 100644
> > --- a/include/hw/ppc/ppc.h
> > +++ b/include/hw/ppc/ppc.h
> > @@ -106,4 +106,5 @@ enum {
> >  /* ppc_booke.c */
> >  void ppc_booke_timers_init(PowerPCCPU *cpu, uint32_t freq, uint32_t
> > flags); 
> > +PowerPCCPU *ppc_cpu_init(const char *cpu_model);
> >  #endif
> > diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
> > index af73bced9f70..440309a68006 100644
> > --- a/target-ppc/cpu.h
> > +++ b/target-ppc/cpu.h
> > @@ -1196,7 +1196,6 @@ extern const struct VMStateDescription
> > vmstate_ppc_cpu; #endif
> >  
> >  /*****************************************************************************/
> > -PowerPCCPU *cpu_ppc_init(const char *cpu_model);
> >  void ppc_translate_init(void);
> >  void gen_update_current_nip(void *opaque);
> >  /* you can call this signal handler from your SIGBUS and SIGSEGV
> > @@ -1275,7 +1274,9 @@ static inline uint64_t ppc_dump_gpr(CPUPPCState
> > *env, int gprn) int ppc_dcr_read (ppc_dcr_t *dcr_env, int dcrn,
> > uint32_t *valp); int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn,
> > uint32_t val); 
> > -#define cpu_init(cpu_model) CPU(cpu_ppc_init(cpu_model))
> > +#if defined(CONFIG_USER_ONLY)
> > +#define cpu_init(cpu_model) cpu_generic_init(TYPE_POWERPC_CPU,
> > cpu_model) +#endif
> >  
> >  #define cpu_signal_handler cpu_ppc_signal_handler
> >  #define cpu_list ppc_cpu_list
> > diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
> > index a06bf50b65d4..6706787b41a1 100644
> > --- a/target-ppc/translate_init.c
> > +++ b/target-ppc/translate_init.c
> > @@ -10000,11 +10000,6 @@ static ObjectClass
> > *ppc_cpu_class_by_name(const char *name) return NULL;
> >  }
> >  
> > -PowerPCCPU *cpu_ppc_init(const char *cpu_model)
> > -{
> > -    return POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU,
> > cpu_model)); -}
> > -
> >  /* Sort by PVR, ordering special case "host" last. */
> >  static gint ppc_cpu_list_compare(gconstpointer a, gconstpointer b)
> >  {
> >   
> 

  reply	other threads:[~2016-07-04  7:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-01 22:41 [Qemu-devel] [PATCH v2 0/7] ppc: compute cpu_dt_id in the machine code Greg Kurz
2016-07-01 22:41 ` [Qemu-devel] [PATCH v2 1/7] spapr: Ensure thread0 of CPU core is always realized first Greg Kurz
2016-07-01 22:41 ` [Qemu-devel] [PATCH v2 2/7] ppc: simplify max_smt initialization in ppc_cpu_realizefn() Greg Kurz
2016-07-04  3:53   ` David Gibson
2016-07-01 22:41 ` [Qemu-devel] [PATCH v2 3/7] ppc: different creation paths for cpus in system and user mode Greg Kurz
2016-07-04  7:14   ` Igor Mammedov
2016-07-04  7:40     ` Greg Kurz [this message]
2016-07-01 22:41 ` [Qemu-devel] [PATCH v2 4/7] ppc: open code cpu creation for machine types Greg Kurz
2016-07-02  8:06   ` Bharata B Rao
2016-07-02  8:33     ` Greg Kurz
2016-07-04  3:54       ` David Gibson
2016-07-04  6:32         ` Greg Kurz
2016-07-04  8:08           ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2016-07-04  7:37         ` [Qemu-devel] " Igor Mammedov
2016-07-04  8:09           ` David Gibson
2016-07-01 22:41 ` [Qemu-devel] [PATCH v2 5/7] ppc: introduce ppc_set_vcpu_dt_id() Greg Kurz
2016-07-01 22:42 ` [Qemu-devel] [PATCH v2 6/7] spapr: use ppc_set_vcpu_dt_id() in CPU hotplug code Greg Kurz
2016-07-02  8:14   ` Bharata B Rao
2016-07-02  8:35     ` Greg Kurz
2016-07-01 22:42 ` [Qemu-devel] [PATCH v2 7/7] ppc: move the cpu_dt_id logic to machine code Greg Kurz
2016-07-02  8:15   ` Bharata B Rao
2016-07-02  8:42     ` Greg Kurz
2016-07-02  9:55 ` [Qemu-devel] [PATCH v2 0/7] ppc: compute cpu_dt_id in the " Bharata B Rao
2016-07-02 10:34   ` 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=20160704094058.7b504caa@bahia.lan \
    --to=groug@kaod.org \
    --cc=agraf@suse.de \
    --cc=benh@kernel.crashing.org \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=clg@kaod.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=imammedo@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=scottwood@freescale.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.