qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Guan Xuetao" <gxt@mprc.pku.edu.cn>, "Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [RFC qom-cpu v2 27/28] target-unicore32: Move TCG initialization to UniCore32CPU initfn
Date: Sun, 20 Jan 2013 08:22:50 +0100	[thread overview]
Message-ID: <1358666571-1737-28-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1358666571-1737-1-git-send-email-afaerber@suse.de>

Normalize the "inited" logic and add a tcg_enabled() check to suppress
it for qtest.

Ensures that a QOM-created UniCore32CPU is usable.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-unicore32/cpu.c    |    6 ++++++
 target-unicore32/helper.c |    6 ------
 2 Dateien geändert, 6 Zeilen hinzugefügt(+), 6 Zeilen entfernt(-)

diff --git a/target-unicore32/cpu.c b/target-unicore32/cpu.c
index bf33326..7f8dc15 100644
--- a/target-unicore32/cpu.c
+++ b/target-unicore32/cpu.c
@@ -75,6 +75,7 @@ static void uc32_cpu_initfn(Object *obj)
 {
     UniCore32CPU *cpu = UNICORE32_CPU(obj);
     CPUUniCore32State *env = &cpu->env;
+    static bool inited;
 
     cpu_exec_init(env);
     env->cpu_model_str = object_get_typename(obj);
@@ -88,6 +89,11 @@ static void uc32_cpu_initfn(Object *obj)
 #endif
 
     tlb_flush(env, 1);
+
+    if (tcg_enabled() && !inited) {
+        inited = true;
+        uc32_translate_init();
+    }
 }
 
 static void uc32_cpu_class_init(ObjectClass *oc, void *data)
diff --git a/target-unicore32/helper.c b/target-unicore32/helper.c
index 173579a..357cc8b 100644
--- a/target-unicore32/helper.c
+++ b/target-unicore32/helper.c
@@ -29,7 +29,6 @@ CPUUniCore32State *uc32_cpu_init(const char *cpu_model)
 {
     UniCore32CPU *cpu;
     CPUUniCore32State *env;
-    static int inited = 1;
 
     if (object_class_by_name(cpu_model) == NULL) {
         return NULL;
@@ -37,11 +36,6 @@ CPUUniCore32State *uc32_cpu_init(const char *cpu_model)
     cpu = UNICORE32_CPU(object_new(cpu_model));
     env = &cpu->env;
 
-    if (inited) {
-        inited = 0;
-        uc32_translate_init();
-    }
-
     object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
 
     return env;
-- 
1.7.10.4

  parent reply	other threads:[~2013-01-20  7:23 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-20  7:22 [Qemu-devel] [RFC qom-cpu v2 00/28] CPUState QOM realizefn support Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 01/28] cpu: Prepare QOM realizefn Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 02/28] target-alpha: Update AlphaCPU to " Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 03/28] target-arm: Update ARMCPU " Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 04/28] target-i386: Update X86CPU " Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 05/28] target-openrisc: Update OpenRISCCPU " Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 06/28] target-ppc: Update PowerPCCPU " Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 07/28] target-cris: Introduce QOM realizefn for CRISCPU Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 08/28] target-lm32: Introduce QOM realizefn for LM32CPU Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 09/28] target-m68k: Introduce QOM realizefn for M68kCPU Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 10/28] target-microblaze: Introduce QOM realizefn for MicroBlazeCPU Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 11/28] target-mips: Introduce QOM realizefn for MIPSCPU Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 12/28] target-s390x: Introduce QOM realizefn for S390CPU Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 13/28] target-sh4: Introduce QOM realizefn for SuperHCPU Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 14/28] target-sparc: Introduce QOM realizefn for SPARCCPU Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 15/28] target-unicore32: Introduce QOM realizefn for UniCore32CPU Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 16/28] target-xtensa: Introduce QOM realizefn for XtensaCPU Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 17/28] target-arm: Move TCG initialization to ARMCPU initfn Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 18/28] target-cris: Move TCG initialization to CRISCPU initfn Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 19/28] target-lm32: Move TCG initialization to LM32CPU initfn Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 20/28] target-m68k: Move TCG initialization to M68kCPU initfn Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 21/28] target-microblaze: Move TCG initialization to MicroBlazeCPU initfn Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 22/28] target-mips: Move TCG initialization to MIPSCPU initfn Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 23/28] target-ppc: Move TCG initialization to PowerPCCPU initfn Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 24/28] target-s390x: Move TCG initialization to S390CPU initfn Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 25/28] target-sh4: Move TCG initialization to SuperHCPU initfn Andreas Färber
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 26/28] target-sparc: Move TCG initialization to SPARCCPU initfn Andreas Färber
2013-01-20  7:22 ` Andreas Färber [this message]
2013-01-20  7:22 ` [Qemu-devel] [RFC qom-cpu v2 28/28] target-xtensa: Move TCG initialization to XtensaCPU initfn Andreas Färber

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=1358666571-1737-28-git-send-email-afaerber@suse.de \
    --to=afaerber@suse.de \
    --cc=gxt@mprc.pku.edu.cn \
    --cc=qemu-devel@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).