]> git.proxmox.com Git - qemu.git/commitdiff
cpu: Change qemu_init_vcpu() argument to CPUState
authorAndreas Färber <afaerber@suse.de>
Mon, 27 May 2013 01:23:24 +0000 (03:23 +0200)
committerAndreas Färber <afaerber@suse.de>
Fri, 28 Jun 2013 11:25:13 +0000 (13:25 +0200)
This allows to move the call into CPUState's realizefn.
Therefore move the stub into libqemustub.a.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
21 files changed:
cpus.c
include/qemu-common.h
include/qom/cpu.h
qom/cpu.c
stubs/cpus.c
target-alpha/cpu.c
target-arm/cpu.c
target-cris/cpu.c
target-i386/cpu.c
target-lm32/cpu.c
target-m68k/cpu.c
target-microblaze/cpu.c
target-mips/cpu.c
target-moxie/cpu.c
target-openrisc/cpu.c
target-ppc/translate_init.c
target-s390x/cpu.c
target-sh4/cpu.c
target-sparc/cpu.c
target-unicore32/cpu.c
target-xtensa/cpu.c

diff --git a/cpus.c b/cpus.c
index 06ab567bd5489c096235d89978f574e856c05079..86571f913c0b4c53f05da060882b76e8aa479057 100644 (file)
--- a/cpus.c
+++ b/cpus.c
@@ -1053,11 +1053,8 @@ static void qemu_dummy_start_vcpu(CPUState *cpu)
     }
 }
 
-void qemu_init_vcpu(void *_env)
+void qemu_init_vcpu(CPUState *cpu)
 {
-    CPUArchState *env = _env;
-    CPUState *cpu = ENV_GET_CPU(env);
-
     cpu->nr_cores = smp_cores;
     cpu->nr_threads = smp_threads;
     cpu->stopped = true;
index 6010bba204828eb5b4800ed6593b16ded29a97db..f4397388f5c0c5a5b507e24ab07e733c5a08fd23 100644 (file)
@@ -295,14 +295,6 @@ struct qemu_work_item {
     int done;
 };
 
-#ifdef CONFIG_USER_ONLY
-static inline void qemu_init_vcpu(void *env)
-{
-}
-#else
-void qemu_init_vcpu(void *env);
-#endif
-
 
 /**
  * Sends a (part of) iovec down a socket, yielding when the socket is full, or
index 12b509920e67a908bb4e9cb28e4c24d2fd97746c..d9b73db1180276c5cbb48060eae8c1244675f07b 100644 (file)
@@ -428,6 +428,14 @@ void cpu_exit(CPUState *cpu);
  */
 void cpu_resume(CPUState *cpu);
 
+/**
+ * qemu_init_vcpu:
+ * @cpu: The vCPU to initialize.
+ *
+ * Initializes a vCPU.
+ */
+void qemu_init_vcpu(CPUState *cpu);
+
 #ifdef CONFIG_SOFTMMU
 extern const struct VMStateDescription vmstate_cpu_common;
 #else
index 4da63321d750972f6c4ece6abf6a4db34a4dc2d2..ee8f632ecb7e2341842873050d015fdf7f65bdc1 100644 (file)
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -209,6 +209,8 @@ static void cpu_common_realizefn(DeviceState *dev, Error **errp)
 {
     CPUState *cpu = CPU(dev);
 
+    qemu_init_vcpu(cpu);
+
     if (dev->hotplugged) {
         cpu_synchronize_post_init(cpu);
         notifier_list_notify(&cpu_added_notifiers, dev);
index f0d56c53815e297442a7b2e70fbea4b4ab772337..8e6f06b1168b3dc9ad052bddeae6556335fd91f5 100644 (file)
@@ -4,3 +4,7 @@
 void cpu_resume(CPUState *cpu)
 {
 }
+
+void qemu_init_vcpu(CPUState *cpu)
+{
+}
index 7d7fdab461bacb9f5ec62782730a22be24181b94..4e62eafa56799a64fde60227a4cf775f18446901 100644 (file)
 
 static void alpha_cpu_realizefn(DeviceState *dev, Error **errp)
 {
-    AlphaCPU *cpu = ALPHA_CPU(dev);
     AlphaCPUClass *acc = ALPHA_CPU_GET_CLASS(dev);
 
-    qemu_init_vcpu(&cpu->env);
-
     acc->parent_realize(dev, errp);
 }
 
index 645c9617e5a8b3c1c53896294f76dd825df54cce..1bc227e9a6c35df852f874e2393244340194edc7 100644 (file)
@@ -208,7 +208,6 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
     init_cpreg_list(cpu);
 
     cpu_reset(CPU(cpu));
-    qemu_init_vcpu(env);
 
     acc->parent_realize(dev, errp);
 }
index 82271f7f1f6889bb12b23c131a536dca0a4b2e2f..6a3bdf00f8bbc9b440d0938c81e61dc76aef7e25 100644 (file)
@@ -139,7 +139,6 @@ static void cris_cpu_realizefn(DeviceState *dev, Error **errp)
     CRISCPUClass *ccc = CRIS_CPU_GET_CLASS(dev);
 
     cpu_reset(CPU(cpu));
-    qemu_init_vcpu(&cpu->env);
 
     ccc->parent_realize(dev, errp);
 }
index 48c062fe5d9ec21534c4797cb164534d3b7b7f4e..b7416fea35a84d3a3a892debf450e1019ca84bd9 100644 (file)
@@ -2392,7 +2392,6 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
 #endif
 
     mce_init(cpu);
-    qemu_init_vcpu(&cpu->env);
 
     x86_cpu_apic_realize(cpu, &local_err);
     if (local_err != NULL) {
index 2366152c9b1253b3ff2621ba89e9358f5dc4aadc..02f8436bffe0d484d8aff63b7b60fd7cdb97d649 100644 (file)
@@ -49,8 +49,6 @@ static void lm32_cpu_realizefn(DeviceState *dev, Error **errp)
 
     cpu_reset(CPU(cpu));
 
-    qemu_init_vcpu(&cpu->env);
-
     lcc->parent_realize(dev, errp);
 }
 
index d5010277be72500031ff40f85b7aa4a9612653bf..799869ff9767a687bb9024ee75784a383eda6641 100644 (file)
@@ -147,7 +147,6 @@ static void m68k_cpu_realizefn(DeviceState *dev, Error **errp)
     m68k_cpu_init_gdb(cpu);
 
     cpu_reset(CPU(cpu));
-    qemu_init_vcpu(&cpu->env);
 
     mcc->parent_realize(dev, errp);
 }
index e8104d17b0f6fb07832c428f64829dc39f954541..b9a097c740ea1f5155533fdcaa240d0838e5441c 100644 (file)
@@ -92,7 +92,6 @@ static void mb_cpu_realizefn(DeviceState *dev, Error **errp)
     MicroBlazeCPUClass *mcc = MICROBLAZE_CPU_GET_CLASS(dev);
 
     cpu_reset(CPU(cpu));
-    qemu_init_vcpu(&cpu->env);
 
     mcc->parent_realize(dev, errp);
 }
index b685d39ae3e64fb38f1cab5b8cfa6d87ada19524..0fdc31630d5444325c5955e8b842212a5d7cd8f0 100644 (file)
@@ -48,7 +48,6 @@ static void mips_cpu_realizefn(DeviceState *dev, Error **errp)
     MIPSCPUClass *mcc = MIPS_CPU_GET_CLASS(dev);
 
     cpu_reset(CPU(cpu));
-    qemu_init_vcpu(&cpu->env);
 
     mcc->parent_realize(dev, errp);
 }
index 3c3932c1297055acc6daa1969d405e61b06bce5d..f3c0d22141030920815ae5eba65c52093de009da 100644 (file)
@@ -44,12 +44,11 @@ static void moxie_cpu_reset(CPUState *s)
 static void moxie_cpu_realizefn(DeviceState *dev, Error **errp)
 {
     MoxieCPU *cpu = MOXIE_CPU(dev);
-    MoxieCPUClass *occ = MOXIE_CPU_GET_CLASS(dev);
+    MoxieCPUClass *mcc = MOXIE_CPU_GET_CLASS(dev);
 
-    qemu_init_vcpu(&cpu->env);
     cpu_reset(CPU(cpu));
 
-    occ->parent_realize(dev, errp);
+    mcc->parent_realize(dev, errp);
 }
 
 static void moxie_cpu_initfn(Object *obj)
index a4017064044bc6995ccc318aeeb3191e3f9acfc5..fd90d370baeb508ca85bb2265d3f49ecc090020e 100644 (file)
@@ -67,7 +67,6 @@ static void openrisc_cpu_realizefn(DeviceState *dev, Error **errp)
     OpenRISCCPU *cpu = OPENRISC_CPU(dev);
     OpenRISCCPUClass *occ = OPENRISC_CPU_GET_CLASS(dev);
 
-    qemu_init_vcpu(&cpu->env);
     cpu_reset(CPU(cpu));
 
     occ->parent_realize(dev, errp);
index 0edb33604c43eb43ee63e920329f6aad2c0d27c5..fa5e09fb360b70d7d01357f86199ea8ba6cffb83 100644 (file)
@@ -7752,8 +7752,6 @@ static void ppc_cpu_realizefn(DeviceState *dev, Error **errp)
                                  34, "power-spe.xml", 0);
     }
 
-    qemu_init_vcpu(env);
-
     pcc->parent_realize(dev, errp);
 
 #if defined(PPC_DUMP_CPU)
index 8ec2f9b1f53721f47b7b6dfd59c9f1ed6c62a2e5..c3697cd9433ded438c43a58a866b774efa17082e 100644 (file)
@@ -102,7 +102,6 @@ static void s390_cpu_realizefn(DeviceState *dev, Error **errp)
     S390CPU *cpu = S390_CPU(dev);
     S390CPUClass *scc = S390_CPU_GET_CLASS(dev);
 
-    qemu_init_vcpu(&cpu->env);
     cpu_reset(CPU(cpu));
 
     scc->parent_realize(dev, errp);
index a7d5213423bd0fef811d599297b03635a473bfc2..e73915693f5f1fb45da133f23ad8125331bfd5db 100644 (file)
@@ -234,7 +234,6 @@ static void superh_cpu_realizefn(DeviceState *dev, Error **errp)
     SuperHCPUClass *scc = SUPERH_CPU_GET_CLASS(dev);
 
     cpu_reset(CPU(cpu));
-    qemu_init_vcpu(&cpu->env);
 
     scc->parent_realize(dev, errp);
 }
index 72700cdcf4334157877de76b5a56d0532ea8347d..ff1200c310b846d4b902b63cd3be8369b0f285a0 100644 (file)
@@ -730,11 +730,8 @@ void sparc_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
 
 static void sparc_cpu_realizefn(DeviceState *dev, Error **errp)
 {
-    SPARCCPU *cpu = SPARC_CPU(dev);
     SPARCCPUClass *scc = SPARC_CPU_GET_CLASS(dev);
 
-    qemu_init_vcpu(&cpu->env);
-
     scc->parent_realize(dev, errp);
 }
 
index 1a97e6bba46722e87ff88fc3f818a4878d5e0837..6572f0199bc192be031d27781decbbda2af88c40 100644 (file)
@@ -83,11 +83,8 @@ static const UniCore32CPUInfo uc32_cpus[] = {
 
 static void uc32_cpu_realizefn(DeviceState *dev, Error **errp)
 {
-    UniCore32CPU *cpu = UNICORE32_CPU(dev);
     UniCore32CPUClass *ucc = UNICORE32_CPU_GET_CLASS(dev);
 
-    qemu_init_vcpu(&cpu->env);
-
     ucc->parent_realize(dev, errp);
 }
 
index b5df32176371f73e5297f46635c5fe0fdbd88f13..0488984d4af2f4de53845a229f63e389f96841cc 100644 (file)
@@ -59,11 +59,8 @@ static void xtensa_cpu_reset(CPUState *s)
 
 static void xtensa_cpu_realizefn(DeviceState *dev, Error **errp)
 {
-    XtensaCPU *cpu = XTENSA_CPU(dev);
     XtensaCPUClass *xcc = XTENSA_CPU_GET_CLASS(dev);
 
-    qemu_init_vcpu(&cpu->env);
-
     xcc->parent_realize(dev, errp);
 }