@@ -35,6 +35,8 @@ struct AccelOpsClass {
/* If non-NULL, return whether common vCPU thread must be created */
bool (*create_vcpu_thread_precheck)(CPUState *cpu);
void (*create_vcpu_thread_postcheck)(CPUState *cpu);
+ /* If non-NULL, return whether common vCPU thread must be destroyed */
+ bool (*destroy_vcpu_thread_precheck)(CPUState *cpu);
void (*kick_vcpu_thread)(CPUState *cpu);
bool (*cpu_thread_is_idle)(CPUState *cpu);
@@ -617,6 +617,10 @@ static void common_vcpu_thread_create(CPUState *cpu)
#endif
}
+static void common_vcpu_thread_destroy(CPUState *cpu)
+{
+}
+
void cpu_remove_sync(CPUState *cpu)
{
cpu->stop = true;
@@ -625,6 +629,11 @@ void cpu_remove_sync(CPUState *cpu)
qemu_mutex_unlock_iothread();
qemu_thread_join(cpu->thread);
qemu_mutex_lock_iothread();
+
+ if (cpus_accel->destroy_vcpu_thread_precheck == NULL
+ || cpus_accel->destroy_vcpu_thread_precheck(cpu)) {
+ common_vcpu_thread_destroy(cpu);
+ }
}
void cpus_register_accel(const AccelOpsClass *ops)