@@ -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 */
@@ -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);
-}
@@ -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;
};
@@ -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 = {
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é <philmd@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(-)