aboutsummaryrefslogtreecommitdiff
path: root/cpus.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-05-27 02:20:39 +0200
committerAndreas Färber <afaerber@suse.de>2013-06-28 13:25:13 +0200
commit48a106bd144c60862e8b6116dc226885d1937d76 (patch)
tree603b5791b159dbfdf09f2ea21b5edd60eebd1a41 /cpus.c
parent913250464f5ea5799d71ab033b51d1bf8ed84343 (diff)
downloadqemu-48a106bd144c60862e8b6116dc226885d1937d76.zip
qemu-48a106bd144c60862e8b6116dc226885d1937d76.tar.gz
qemu-48a106bd144c60862e8b6116dc226885d1937d76.tar.bz2
cpus: Change qemu_kvm_start_vcpu() argument to CPUState
Pass it on to qemu_kvm_cpu_thread_fn(). Prepares for changing qemu_init_vcpu() argument to CPUState. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'cpus.c')
-rw-r--r--cpus.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/cpus.c b/cpus.c
index 6016891..6e6a8f9 100644
--- a/cpus.c
+++ b/cpus.c
@@ -727,14 +727,13 @@ static void qemu_kvm_wait_io_event(CPUState *cpu)
static void *qemu_kvm_cpu_thread_fn(void *arg)
{
- CPUArchState *env = arg;
- CPUState *cpu = ENV_GET_CPU(env);
+ CPUState *cpu = arg;
int r;
qemu_mutex_lock(&qemu_global_mutex);
qemu_thread_get_self(cpu->thread);
cpu->thread_id = qemu_get_thread_id();
- cpu_single_env = env;
+ cpu_single_env = cpu->env_ptr;
r = kvm_init_vcpu(cpu);
if (r < 0) {
@@ -1031,14 +1030,12 @@ static void qemu_tcg_init_vcpu(CPUState *cpu)
}
}
-static void qemu_kvm_start_vcpu(CPUArchState *env)
+static void qemu_kvm_start_vcpu(CPUState *cpu)
{
- CPUState *cpu = ENV_GET_CPU(env);
-
cpu->thread = g_malloc0(sizeof(QemuThread));
cpu->halt_cond = g_malloc0(sizeof(QemuCond));
qemu_cond_init(cpu->halt_cond);
- qemu_thread_create(cpu->thread, qemu_kvm_cpu_thread_fn, env,
+ qemu_thread_create(cpu->thread, qemu_kvm_cpu_thread_fn, cpu,
QEMU_THREAD_JOINABLE);
while (!cpu->created) {
qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
@@ -1068,7 +1065,7 @@ void qemu_init_vcpu(void *_env)
cpu->nr_threads = smp_threads;
cpu->stopped = true;
if (kvm_enabled()) {
- qemu_kvm_start_vcpu(env);
+ qemu_kvm_start_vcpu(cpu);
} else if (tcg_enabled()) {
qemu_tcg_init_vcpu(cpu);
} else {