@@ -1131,11 +1131,6 @@ int apic_init(CPUState *env)
vmstate_register(s->idx, &vmstate_apic, s);
qemu_register_reset(apic_reset, s);
- /* apic_reset must be called before the vcpu threads are initialized and load
- * registers, in qemu-kvm.
- */
- apic_reset(s);
-
local_apics[s->idx] = s;
return 0;
}
@@ -1918,11 +1918,6 @@ static void *ap_main_loop(void *_env)
setup_kernel_sigmask(env);
pthread_mutex_lock(&qemu_mutex);
- cpu_single_env = env;
-
- kvm_arch_init_vcpu(env);
-
- kvm_arch_load_regs(env);
/* signal VCPU creation */
current_env->created = 1;
@@ -1934,6 +1929,8 @@ static void *ap_main_loop(void *_env)
/* re-initialize cpu_single_env after re-acquiring qemu_mutex */
cpu_single_env = env;
+ kvm_arch_init_vcpu(env);
+ kvm_arch_load_regs(env);
kvm_main_loop_cpu(env);
return NULL;