By converting to AccelOpsClass::cpu_thread_routine we can let the common accel_create_vcpu_thread() create the thread.
Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org> --- include/system/cpus.h | 4 +--- accel/dummy-cpus.c | 14 +------------- accel/qtest/qtest.c | 3 ++- accel/xen/xen-all.c | 3 ++- 4 files changed, 6 insertions(+), 18 deletions(-) diff --git a/include/system/cpus.h b/include/system/cpus.h index bfaa339dd73..e7ca9f4d684 100644 --- a/include/system/cpus.h +++ b/include/system/cpus.h @@ -9,9 +9,7 @@ const AccelOpsClass *cpus_get_accel(void); /* accel/dummy-cpus.c */ void dummy_thread_precreate(CPUState *cpu); - -/* Create a dummy vcpu for AccelOpsClass->create_vcpu_thread */ -void dummy_start_vcpu_thread(CPUState *); +void *dummy_cpu_thread_routine(void *arg); /* interface available for cpus accelerator threads */ diff --git a/accel/dummy-cpus.c b/accel/dummy-cpus.c index 7c34e6c0fc5..c6756252550 100644 --- a/accel/dummy-cpus.c +++ b/accel/dummy-cpus.c @@ -18,7 +18,7 @@ #include "qemu/main-loop.h" #include "hw/core/cpu.h" -static void *dummy_cpu_thread_fn(void *arg) +void *dummy_cpu_thread_routine(void *arg) { CPUState *cpu = arg; @@ -70,15 +70,3 @@ void dummy_thread_precreate(CPUState *cpu) qemu_sem_init(&cpu->sem, 0); #endif } - -void dummy_start_vcpu_thread(CPUState *cpu) -{ - char thread_name[VCPU_THREAD_NAME_SIZE]; - - dummy_thread_precreate(cpu); - - snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/DUMMY", - cpu->cpu_index); - qemu_thread_create(cpu->thread, thread_name, dummy_cpu_thread_fn, cpu, - QEMU_THREAD_JOINABLE); -} diff --git a/accel/qtest/qtest.c b/accel/qtest/qtest.c index c5a53ecb6dd..6930cc4cf3e 100644 --- a/accel/qtest/qtest.c +++ b/accel/qtest/qtest.c @@ -63,7 +63,8 @@ static void qtest_accel_ops_class_init(ObjectClass *oc, const void *data) { AccelOpsClass *ops = ACCEL_OPS_CLASS(oc); - ops->create_vcpu_thread = dummy_start_vcpu_thread; + ops->thread_precreate = dummy_thread_precreate; + ops->cpu_thread_routine = dummy_cpu_thread_routine; ops->get_virtual_clock = qtest_get_virtual_clock; ops->set_virtual_clock = qtest_set_virtual_clock; }; diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c index de52a8f882a..3bd91889925 100644 --- a/accel/xen/xen-all.c +++ b/accel/xen/xen-all.c @@ -151,7 +151,8 @@ static void xen_accel_ops_class_init(ObjectClass *oc, const void *data) { AccelOpsClass *ops = ACCEL_OPS_CLASS(oc); - ops->create_vcpu_thread = dummy_start_vcpu_thread; + ops->thread_precreate = dummy_thread_precreate; + ops->cpu_thread_routine = dummy_cpu_thread_routine; } static const TypeInfo xen_accel_ops_type = { -- 2.49.0