Skip to content

Commit 9ce84a0

Browse files
jandryukhuth
authored andcommitted
accel: move qtest CpusAccel functions to a common location
Move and rename accel/qtest/qtest-cpus.c files to accel/dummy-cpus.c so it can be re-used by Xen. Signed-off-by: Jason Andryuk <[email protected]> Message-Id: <[email protected]> Reviewed-by: Claudio Fontana <[email protected]> Acked-by: Paolo Bonzini <[email protected]> Signed-off-by: Thomas Huth <[email protected]>
1 parent a6b0882 commit 9ce84a0

File tree

6 files changed

+18
-37
lines changed

6 files changed

+18
-37
lines changed

accel/qtest/qtest-cpus.c renamed to accel/dummy-cpus.c

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* QTest accelerator code
2+
* Dummy cpu thread code
33
*
44
* Copyright IBM, Corp. 2011
55
*
@@ -13,21 +13,12 @@
1313

1414
#include "qemu/osdep.h"
1515
#include "qemu/rcu.h"
16-
#include "qapi/error.h"
17-
#include "qemu/module.h"
18-
#include "qemu/option.h"
19-
#include "qemu/config-file.h"
20-
#include "sysemu/accel.h"
21-
#include "sysemu/qtest.h"
2216
#include "sysemu/cpus.h"
23-
#include "sysemu/cpu-timers.h"
2417
#include "qemu/guest-random.h"
2518
#include "qemu/main-loop.h"
2619
#include "hw/core/cpu.h"
2720

28-
#include "qtest-cpus.h"
29-
30-
static void *qtest_cpu_thread_fn(void *arg)
21+
static void *dummy_cpu_thread_fn(void *arg)
3122
{
3223
CPUState *cpu = arg;
3324
sigset_t waitset;
@@ -67,7 +58,7 @@ static void *qtest_cpu_thread_fn(void *arg)
6758
return NULL;
6859
}
6960

70-
static void qtest_start_vcpu_thread(CPUState *cpu)
61+
void dummy_start_vcpu_thread(CPUState *cpu)
7162
{
7263
char thread_name[VCPU_THREAD_NAME_SIZE];
7364

@@ -76,11 +67,6 @@ static void qtest_start_vcpu_thread(CPUState *cpu)
7667
qemu_cond_init(cpu->halt_cond);
7768
snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/DUMMY",
7869
cpu->cpu_index);
79-
qemu_thread_create(cpu->thread, thread_name, qtest_cpu_thread_fn, cpu,
70+
qemu_thread_create(cpu->thread, thread_name, dummy_cpu_thread_fn, cpu,
8071
QEMU_THREAD_JOINABLE);
8172
}
82-
83-
const CpusAccel qtest_cpus = {
84-
.create_vcpu_thread = qtest_start_vcpu_thread,
85-
.get_virtual_clock = qtest_get_virtual_clock,
86-
};

accel/meson.build

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,10 @@ subdir('kvm')
55
subdir('tcg')
66
subdir('xen')
77
subdir('stubs')
8+
9+
dummy_ss = ss.source_set()
10+
dummy_ss.add(files(
11+
'dummy-cpus.c',
12+
))
13+
14+
specific_ss.add_all(when: ['CONFIG_SOFTMMU', 'CONFIG_POSIX'], if_true: dummy_ss)

accel/qtest/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
qtest_ss = ss.source_set()
22
qtest_ss.add(files(
33
'qtest.c',
4-
'qtest-cpus.c',
54
))
65

76
specific_ss.add_all(when: ['CONFIG_SOFTMMU', 'CONFIG_POSIX'], if_true: qtest_ss)

accel/qtest/qtest-cpus.h

Lines changed: 0 additions & 17 deletions
This file was deleted.

accel/qtest/qtest.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
#include "qemu/main-loop.h"
2626
#include "hw/core/cpu.h"
2727

28-
#include "qtest-cpus.h"
28+
const CpusAccel qtest_cpus = {
29+
.create_vcpu_thread = dummy_start_vcpu_thread,
30+
.get_virtual_clock = qtest_get_virtual_clock,
31+
};
2932

3033
static int qtest_init_accel(MachineState *ms)
3134
{

include/sysemu/cpus.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ typedef struct CpusAccel {
2525
/* register accel-specific cpus interface implementation */
2626
void cpus_register_accel(const CpusAccel *i);
2727

28+
/* Create a dummy vcpu for CpusAccel->create_vcpu_thread */
29+
void dummy_start_vcpu_thread(CPUState *);
30+
2831
/* interface available for cpus accelerator threads */
2932

3033
/* For temporary buffers for forming a name */

0 commit comments

Comments
 (0)