qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Greg Kurz <groug@kaod.org>
Cc: Eduardo Habkost <ehabkost@redhat.com>,
	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>,
	Igor Mammedov <imammedo@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 4/7] ppc: open code cpu creation for machine types
Date: Thu, 7 Jul 2016 11:54:12 +1000	[thread overview]
Message-ID: <20160707015412.GI14675@voom.fritz.box> (raw)
In-Reply-To: <146780723427.26232.10779748351110554240.stgit@bahia.lab.toulouse-stg.fr.ibm.com>

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

On Wed, Jul 06, 2016 at 02:14:25PM +0200, Greg Kurz wrote:
> If we want to generate cpu_dt_id in the machine code, this must occur
> before the cpu gets realized. We must open code the cpu creation to be
> able to do this.
> 
> This patch just does that.
> 
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
> v3: don't parse cpu features as it is done in a previous patch

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  hw/ppc/ppc.c |   32 +++++++++++++++++++++++++++++++-
>  1 file changed, 31 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
> index 313b3f0b9a51..0df32a9b3965 100644
> --- a/hw/ppc/ppc.c
> +++ b/hw/ppc/ppc.c
> @@ -32,6 +32,7 @@
>  #include "sysemu/cpus.h"
>  #include "hw/timer/m48t59.h"
>  #include "qemu/log.h"
> +#include "qapi/error.h"
>  #include "qemu/error-report.h"
>  #include "qapi/error.h"
>  #include "hw/loader.h"
> @@ -1354,7 +1355,36 @@ PowerPCCPU *ppc_get_vcpu_by_dt_id(int cpu_dt_id)
>  
>  PowerPCCPU *ppc_cpu_init(const char *cpu_model)
>  {
> -    return POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU, cpu_model));
> +    PowerPCCPU *cpu;
> +    ObjectClass *oc;
> +    gchar **model_pieces;
> +    Error *err = NULL;
> +
> +    model_pieces = g_strsplit(cpu_model, ",", 2);
> +    if (!model_pieces[0]) {
> +        error_report("Invalid/empty CPU model name");
> +        return NULL;
> +    }
> +
> +    oc = cpu_class_by_name(TYPE_POWERPC_CPU, model_pieces[0]);
> +    if (oc == NULL) {
> +        error_report("Unable to find CPU definition: %s", model_pieces[0]);
> +        goto out;
> +    }
> +
> +    cpu = POWERPC_CPU(object_new(object_class_get_name(oc)));
> +    object_property_set_bool(OBJECT(cpu), true, "realized", &err);
> +
> +out:
> +    g_strfreev(model_pieces);
> +
> +    if (err != NULL) {
> +        error_report_err(err);
> +        object_unref(OBJECT(cpu));
> +        return NULL;
> +    }
> +
> +    return cpu;
>  }
>  
>  void ppc_cpu_parse_features(const char *cpu_model)
> 

-- 
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: 819 bytes --]

  parent reply	other threads:[~2016-07-07  2:03 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-06 12:12 [Qemu-devel] [PATCH v3 0/7] ppc: compute cpu_dt_id in the machine code Greg Kurz
2016-07-06 12:13 ` [Qemu-devel] [PATCH v3 1/7] ppc: different creation paths for cpus in system and user mode Greg Kurz
2016-07-07  1:11   ` David Gibson
2016-07-06 12:13 ` [Qemu-devel] [PATCH v3 2/7] ppc: move smp_threads sanity checks to spapr Greg Kurz
2016-07-07  1:12   ` David Gibson
2016-07-07  1:57     ` Benjamin Herrenschmidt
2016-07-07  2:05       ` David Gibson
2016-07-07  7:15       ` Greg Kurz
2016-07-07  6:49     ` Greg Kurz
2016-07-06 12:13 ` [Qemu-devel] [PATCH v3 3/7] ppc: parse cpu features once Greg Kurz
2016-07-06 12:14 ` [Qemu-devel] [PATCH v3 4/7] ppc: open code cpu creation for machine types Greg Kurz
2016-07-06 16:06   ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2016-07-07  1:59     ` David Gibson
2016-07-07  1:54   ` David Gibson [this message]
2016-07-06 12:14 ` [Qemu-devel] [PATCH v3 5/7] ppc: each machine type to provide vcpu_dt_id Greg Kurz
2016-07-07  2:01   ` David Gibson
2016-07-07  8:55     ` Greg Kurz
2016-07-08  1:57       ` David Gibson
2016-07-08  6:41         ` Greg Kurz
2016-07-06 12:14 ` [Qemu-devel] [PATCH v3 6/7] ppc: drop vcpu_idt_id bits from the target code Greg Kurz
2016-07-06 12:14 ` [Qemu-devel] [PATCH v3 7/7] spapr: consolidate the logic of core cpu_dt_id Greg Kurz
2016-07-07  2:05   ` David Gibson
2016-07-07  8:44     ` 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=20160707015412.GI14675@voom.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=agraf@suse.de \
    --cc=benh@kernel.crashing.org \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=clg@kaod.org \
    --cc=ehabkost@redhat.com \
    --cc=groug@kaod.org \
    --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 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).