aboutsummaryrefslogtreecommitdiff
path: root/softmmu/cpus.c
diff options
context:
space:
mode:
authorClaudio Fontana <cfontana@suse.de>2020-07-07 11:39:12 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2020-10-05 16:41:22 +0200
commit8ef39ecfa69f758680280577077e25f4b5be9844 (patch)
tree78fc2d48f3ae4401cb02969f34243b3f3f4ff2f7 /softmmu/cpus.c
parente92558e4bf8059ce4f0b310afe218802b72766bc (diff)
cpus: extract out whpx-specific code to target/i386/
register a "CpusAccel" interface for WHPX as well. Signed-off-by: Claudio Fontana <cfontana@suse.de> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'softmmu/cpus.c')
-rw-r--r--softmmu/cpus.c79
1 files changed, 0 insertions, 79 deletions
diff --git a/softmmu/cpus.c b/softmmu/cpus.c
index 900fff827a..067dae12eb 100644
--- a/softmmu/cpus.c
+++ b/softmmu/cpus.c
@@ -34,7 +34,6 @@
#include "sysemu/hw_accel.h"
#include "sysemu/kvm.h"
#include "sysemu/hvf.h"
-#include "sysemu/whpx.h"
#include "exec/exec-all.h"
#include "qemu/thread.h"
#include "qemu/plugin.h"
@@ -178,9 +177,6 @@ void cpu_synchronize_state(CPUState *cpu)
if (cpus_accel && cpus_accel->synchronize_state) {
cpus_accel->synchronize_state(cpu);
}
- if (whpx_enabled()) {
- whpx_cpu_synchronize_state(cpu);
- }
}
void cpu_synchronize_post_reset(CPUState *cpu)
@@ -188,9 +184,6 @@ void cpu_synchronize_post_reset(CPUState *cpu)
if (cpus_accel && cpus_accel->synchronize_post_reset) {
cpus_accel->synchronize_post_reset(cpu);
}
- if (whpx_enabled()) {
- whpx_cpu_synchronize_post_reset(cpu);
- }
}
void cpu_synchronize_post_init(CPUState *cpu)
@@ -198,9 +191,6 @@ void cpu_synchronize_post_init(CPUState *cpu)
if (cpus_accel && cpus_accel->synchronize_post_init) {
cpus_accel->synchronize_post_init(cpu);
}
- if (whpx_enabled()) {
- whpx_cpu_synchronize_post_init(cpu);
- }
}
void cpu_synchronize_pre_loadvm(CPUState *cpu)
@@ -211,9 +201,6 @@ void cpu_synchronize_pre_loadvm(CPUState *cpu)
if (hvf_enabled()) {
hvf_cpu_synchronize_pre_loadvm(cpu);
}
- if (whpx_enabled()) {
- whpx_cpu_synchronize_pre_loadvm(cpu);
- }
}
int64_t cpus_get_virtual_clock(void)
@@ -445,48 +432,6 @@ static void *qemu_hvf_cpu_thread_fn(void *arg)
return NULL;
}
-static void *qemu_whpx_cpu_thread_fn(void *arg)
-{
- CPUState *cpu = arg;
- int r;
-
- rcu_register_thread();
-
- qemu_mutex_lock_iothread();
- qemu_thread_get_self(cpu->thread);
- cpu->thread_id = qemu_get_thread_id();
- current_cpu = cpu;
-
- r = whpx_init_vcpu(cpu);
- if (r < 0) {
- fprintf(stderr, "whpx_init_vcpu failed: %s\n", strerror(-r));
- exit(1);
- }
-
- /* signal CPU creation */
- cpu_thread_signal_created(cpu);
- qemu_guest_random_seed_thread_part2(cpu->random_seed);
-
- do {
- if (cpu_can_run(cpu)) {
- r = whpx_vcpu_exec(cpu);
- if (r == EXCP_DEBUG) {
- cpu_handle_guest_debug(cpu);
- }
- }
- while (cpu_thread_is_idle(cpu)) {
- qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex);
- }
- qemu_wait_io_event_common(cpu);
- } while (!cpu->unplug || cpu_can_run(cpu));
-
- whpx_destroy_vcpu(cpu);
- cpu_thread_signal_destroyed(cpu);
- qemu_mutex_unlock_iothread();
- rcu_unregister_thread();
- return NULL;
-}
-
void cpus_kick_thread(CPUState *cpu)
{
#ifndef _WIN32
@@ -501,12 +446,6 @@ void cpus_kick_thread(CPUState *cpu)
fprintf(stderr, "qemu:%s: %s", __func__, strerror(err));
exit(1);
}
-#else /* _WIN32 */
- if (!qemu_cpu_is_self(cpu)) {
- if (whpx_enabled()) {
- whpx_vcpu_kick(cpu);
- }
- }
#endif
}
@@ -681,22 +620,6 @@ static void qemu_hvf_start_vcpu(CPUState *cpu)
cpu, QEMU_THREAD_JOINABLE);
}
-static void qemu_whpx_start_vcpu(CPUState *cpu)
-{
- char thread_name[VCPU_THREAD_NAME_SIZE];
-
- cpu->thread = g_malloc0(sizeof(QemuThread));
- cpu->halt_cond = g_malloc0(sizeof(QemuCond));
- qemu_cond_init(cpu->halt_cond);
- snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/WHPX",
- cpu->cpu_index);
- qemu_thread_create(cpu->thread, thread_name, qemu_whpx_cpu_thread_fn,
- cpu, QEMU_THREAD_JOINABLE);
-#ifdef _WIN32
- cpu->hThread = qemu_thread_get_handle(cpu->thread);
-#endif
-}
-
void cpus_register_accel(const CpusAccel *ca)
{
assert(ca != NULL);
@@ -726,8 +649,6 @@ void qemu_init_vcpu(CPUState *cpu)
cpus_accel->create_vcpu_thread(cpu);
} else if (hvf_enabled()) {
qemu_hvf_start_vcpu(cpu);
- } else if (whpx_enabled()) {
- qemu_whpx_start_vcpu(cpu);
} else {
g_assert_not_reached();
}