With switching to upstream code, TCG mode becomes usable again. Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx> --- arch_init.c | 3 +- cpus.c | 89 ----------------------------------------------------------- vl.c | 5 +-- 3 files changed, 2 insertions(+), 95 deletions(-) diff --git a/arch_init.c b/arch_init.c index ac67c3d..484b39d 100644 --- a/arch_init.c +++ b/arch_init.c @@ -711,8 +711,7 @@ int audio_available(void) int tcg_available(void) { - /* temporarily broken */ - return 0; + return 1; } int kvm_available(void) diff --git a/cpus.c b/cpus.c index 30bbfa4..b31bcc3 100644 --- a/cpus.c +++ b/cpus.c @@ -767,7 +767,6 @@ static void qemu_tcg_wait_io_event(void) } } -#ifdef UNUSED_IOTHREAD_IMPL static void qemu_kvm_wait_io_event(CPUState *env) { while (cpu_thread_is_idle(env)) { @@ -777,9 +776,6 @@ static void qemu_kvm_wait_io_event(CPUState *env) qemu_kvm_eat_signals(env); qemu_wait_io_event_common(env); } -#endif /* UNUSED_IOTHREAD_IMPL */ - -static int kvm_main_loop_cpu(CPUState *env); static void *qemu_kvm_cpu_thread_fn(void *arg) { @@ -807,7 +803,6 @@ static void *qemu_kvm_cpu_thread_fn(void *arg) qemu_cond_wait(&qemu_system_cond, &qemu_global_mutex); } -#ifdef UNUSED_IOTHREAD_IMPL while (1) { if (cpu_can_run(env)) { r = kvm_cpu_exec(env); @@ -817,8 +812,6 @@ static void *qemu_kvm_cpu_thread_fn(void *arg) } qemu_kvm_wait_io_event(env); } -#endif /* UNUSED_IOTHREAD_IMPL */ - kvm_main_loop_cpu(env); return NULL; } @@ -1179,85 +1172,3 @@ void list_cpus(FILE *f, fprintf_function cpu_fprintf, const char *optarg) cpu_list(f, cpu_fprintf); /* deprecated */ #endif } - - - -/* - * qemu-kvm threading code, integration zone - */ - -static void kvm_main_loop_wait(CPUState *env, int timeout) -{ - struct timespec ts; - int r, e; - siginfo_t siginfo; - sigset_t waitset; - sigset_t chkset; - - ts.tv_sec = timeout / 1000; - ts.tv_nsec = (timeout % 1000) * 1000000; - sigemptyset(&waitset); - sigaddset(&waitset, SIG_IPI); - sigaddset(&waitset, SIGBUS); - - do { - qemu_mutex_unlock(&qemu_global_mutex); - - r = sigtimedwait(&waitset, &siginfo, &ts); - e = errno; - - qemu_mutex_lock(&qemu_global_mutex); - - if (r == -1 && !(e == EAGAIN || e == EINTR)) { - printf("sigtimedwait: %s\n", strerror(e)); - exit(1); - } - - switch (r) { - case SIGBUS: - if (kvm_on_sigbus_vcpu(env, siginfo.si_code, siginfo.si_addr)) - sigbus_reraise(); - break; - default: - break; - } - - r = sigpending(&chkset); - if (r == -1) { - printf("sigpending: %s\n", strerror(e)); - exit(1); - } - } while (sigismember(&chkset, SIG_IPI) || sigismember(&chkset, SIGBUS)); - - flush_queued_work(env); - - if (env->stop) { - env->stop = 0; - env->stopped = 1; - qemu_cond_signal(&qemu_pause_cond); - } - - env->thread_kicked = false; -} - -static int kvm_main_loop_cpu(CPUState *env) -{ - while (1) { - int timeout = 1000; - if (!cpu_is_stopped(env)) { - switch (kvm_cpu_exec(env)) { - case EXCP_HLT: - break; - case EXCP_DEBUG: - cpu_handle_guest_debug(env); - break; - default: - timeout = 0; - break; - } - } - kvm_main_loop_wait(env, timeout); - } - qemu_mutex_unlock(&qemu_global_mutex); - return 0; -} diff --git a/vl.c b/vl.c index 0bbd4e4..01ca414 100644 --- a/vl.c +++ b/vl.c @@ -1893,8 +1893,7 @@ static int debugcon_parse(const char *devname) static int tcg_init(void) { - fprintf(stderr, "Emulation temporarily broken\n"); - return -1; + return 0; } static struct { @@ -2683,8 +2682,6 @@ int main(int argc, char **argv, char **envp) } break; case QEMU_OPTION_no_kvm: - fprintf(stderr, "Emulation temporarily broken\n"); - exit(1); olist = qemu_find_opts("machine"); qemu_opts_reset(olist); qemu_opts_parse(olist, "accel=tcg", 0); -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html