@@ -31,6 +31,10 @@ struct AccelOpsClass {
bool (*cpus_are_resettable)(void);
void (*create_vcpu_thread)(CPUState *cpu); /* MANDATORY NON-NULL */
+ /* 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);
+
void (*kick_vcpu_thread)(CPUState *cpu);
bool (*cpu_thread_is_idle)(CPUState *cpu);
@@ -637,7 +637,13 @@ void qemu_init_vcpu(CPUState *cpu)
/* accelerators all implement the AccelOpsClass */
g_assert(cpus_accel != NULL && cpus_accel->create_vcpu_thread != NULL);
- cpus_accel->create_vcpu_thread(cpu);
+ if (cpus_accel->create_vcpu_thread_precheck == NULL
+ || cpus_accel->create_vcpu_thread_precheck(cpu)) {
+ cpus_accel->create_vcpu_thread(cpu);
+ }
+ if (cpus_accel->create_vcpu_thread_postcheck) {
+ cpus_accel->create_vcpu_thread_postcheck(cpu);
+ }
while (!cpu->created) {
qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);