Commit 0bf46a40a1fe22e35df344af1a8825f3b47a91e0
1 parent
43b96858
qemu: introduce qemu_init_vcpu (Marcelo Tosatti)
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7242 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
11 changed files
with
26 additions
and
4 deletions
qemu-common.h
| @@ -189,6 +189,12 @@ void qemu_service_io(void); | @@ -189,6 +189,12 @@ void qemu_service_io(void); | ||
| 189 | /* Force QEMU to process pending events */ | 189 | /* Force QEMU to process pending events */ |
| 190 | void qemu_notify_event(void); | 190 | void qemu_notify_event(void); |
| 191 | 191 | ||
| 192 | +#ifdef CONFIG_USER_ONLY | ||
| 193 | +#define qemu_init_vcpu(env) do { } while (0) | ||
| 194 | +#else | ||
| 195 | +void qemu_init_vcpu(void *env); | ||
| 196 | +#endif | ||
| 197 | + | ||
| 192 | typedef struct QEMUIOVector { | 198 | typedef struct QEMUIOVector { |
| 193 | struct iovec *iov; | 199 | struct iovec *iov; |
| 194 | int niov; | 200 | int niov; |
target-alpha/translate.c
| @@ -2505,6 +2505,7 @@ CPUAlphaState * cpu_alpha_init (const char *cpu_model) | @@ -2505,6 +2505,7 @@ CPUAlphaState * cpu_alpha_init (const char *cpu_model) | ||
| 2505 | env->ipr[IPR_SISR] = 0; | 2505 | env->ipr[IPR_SISR] = 0; |
| 2506 | env->ipr[IPR_VIRBND] = -1ULL; | 2506 | env->ipr[IPR_VIRBND] = -1ULL; |
| 2507 | 2507 | ||
| 2508 | + qemu_init_vcpu(env); | ||
| 2508 | return env; | 2509 | return env; |
| 2509 | } | 2510 | } |
| 2510 | 2511 |
target-arm/helper.c
| @@ -267,6 +267,7 @@ CPUARMState *cpu_arm_init(const char *cpu_model) | @@ -267,6 +267,7 @@ CPUARMState *cpu_arm_init(const char *cpu_model) | ||
| 267 | gdb_register_coprocessor(env, vfp_gdb_get_reg, vfp_gdb_set_reg, | 267 | gdb_register_coprocessor(env, vfp_gdb_get_reg, vfp_gdb_set_reg, |
| 268 | 19, "arm-vfp.xml", 0); | 268 | 19, "arm-vfp.xml", 0); |
| 269 | } | 269 | } |
| 270 | + qemu_init_vcpu(env); | ||
| 270 | return env; | 271 | return env; |
| 271 | } | 272 | } |
| 272 | 273 |
target-cris/translate.c
| @@ -3405,6 +3405,7 @@ CPUCRISState *cpu_cris_init (const char *cpu_model) | @@ -3405,6 +3405,7 @@ CPUCRISState *cpu_cris_init (const char *cpu_model) | ||
| 3405 | 3405 | ||
| 3406 | cpu_exec_init(env); | 3406 | cpu_exec_init(env); |
| 3407 | cpu_reset(env); | 3407 | cpu_reset(env); |
| 3408 | + qemu_init_vcpu(env); | ||
| 3408 | 3409 | ||
| 3409 | if (tcg_initialized) | 3410 | if (tcg_initialized) |
| 3410 | return env; | 3411 | return env; |
target-i386/helper.c
| @@ -1692,7 +1692,8 @@ CPUX86State *cpu_x86_init(const char *cpu_model) | @@ -1692,7 +1692,8 @@ CPUX86State *cpu_x86_init(const char *cpu_model) | ||
| 1692 | #ifdef CONFIG_KQEMU | 1692 | #ifdef CONFIG_KQEMU |
| 1693 | kqemu_init(env); | 1693 | kqemu_init(env); |
| 1694 | #endif | 1694 | #endif |
| 1695 | - if (kvm_enabled()) | ||
| 1696 | - kvm_init_vcpu(env); | 1695 | + |
| 1696 | + qemu_init_vcpu(env); | ||
| 1697 | + | ||
| 1697 | return env; | 1698 | return env; |
| 1698 | } | 1699 | } |
target-m68k/helper.c
target-mips/translate.c
| @@ -8551,6 +8551,7 @@ CPUMIPSState *cpu_mips_init (const char *cpu_model) | @@ -8551,6 +8551,7 @@ CPUMIPSState *cpu_mips_init (const char *cpu_model) | ||
| 8551 | env->cpu_model_str = cpu_model; | 8551 | env->cpu_model_str = cpu_model; |
| 8552 | mips_tcg_init(); | 8552 | mips_tcg_init(); |
| 8553 | cpu_reset(env); | 8553 | cpu_reset(env); |
| 8554 | + qemu_init_vcpu(env); | ||
| 8554 | return env; | 8555 | return env; |
| 8555 | } | 8556 | } |
| 8556 | 8557 |
target-ppc/helper.c
| @@ -2831,8 +2831,7 @@ CPUPPCState *cpu_ppc_init (const char *cpu_model) | @@ -2831,8 +2831,7 @@ CPUPPCState *cpu_ppc_init (const char *cpu_model) | ||
| 2831 | cpu_ppc_register_internal(env, def); | 2831 | cpu_ppc_register_internal(env, def); |
| 2832 | cpu_ppc_reset(env); | 2832 | cpu_ppc_reset(env); |
| 2833 | 2833 | ||
| 2834 | - if (kvm_enabled()) | ||
| 2835 | - kvm_init_vcpu(env); | 2834 | + qemu_init_vcpu(env); |
| 2836 | 2835 | ||
| 2837 | return env; | 2836 | return env; |
| 2838 | } | 2837 | } |
target-sh4/translate.c
| @@ -290,6 +290,7 @@ CPUSH4State *cpu_sh4_init(const char *cpu_model) | @@ -290,6 +290,7 @@ CPUSH4State *cpu_sh4_init(const char *cpu_model) | ||
| 290 | cpu_sh4_reset(env); | 290 | cpu_sh4_reset(env); |
| 291 | cpu_sh4_register(env, def); | 291 | cpu_sh4_register(env, def); |
| 292 | tlb_flush(env, 1); | 292 | tlb_flush(env, 1); |
| 293 | + qemu_init_vcpu(env); | ||
| 293 | return env; | 294 | return env; |
| 294 | } | 295 | } |
| 295 | 296 |
target-sparc/helper.c
| @@ -723,6 +723,7 @@ CPUSPARCState *cpu_sparc_init(const char *cpu_model) | @@ -723,6 +723,7 @@ CPUSPARCState *cpu_sparc_init(const char *cpu_model) | ||
| 723 | return NULL; | 723 | return NULL; |
| 724 | } | 724 | } |
| 725 | cpu_reset(env); | 725 | cpu_reset(env); |
| 726 | + qemu_init_vcpu(env); | ||
| 726 | 727 | ||
| 727 | return env; | 728 | return env; |
| 728 | } | 729 | } |
vl.c
| @@ -3731,6 +3731,15 @@ static int qemu_init_main_loop(void) | @@ -3731,6 +3731,15 @@ static int qemu_init_main_loop(void) | ||
| 3731 | return qemu_event_init(); | 3731 | return qemu_event_init(); |
| 3732 | } | 3732 | } |
| 3733 | 3733 | ||
| 3734 | +void qemu_init_vcpu(void *_env) | ||
| 3735 | +{ | ||
| 3736 | + CPUState *env = _env; | ||
| 3737 | + | ||
| 3738 | + if (kvm_enabled()) | ||
| 3739 | + kvm_init_vcpu(env); | ||
| 3740 | + return; | ||
| 3741 | +} | ||
| 3742 | + | ||
| 3734 | #ifdef _WIN32 | 3743 | #ifdef _WIN32 |
| 3735 | static void host_main_loop_wait(int *timeout) | 3744 | static void host_main_loop_wait(int *timeout) |
| 3736 | { | 3745 | { |