Upstream is now identical to qemu-kvm's versions, and we are using the same signaling mechanisms now. Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx> --- cpu-defs.h | 11 +---------- cpus.c | 45 +-------------------------------------------- kvm-all.c | 4 ---- qemu-kvm.c | 4 ++-- qemu-kvm.h | 2 -- target-i386/helper.c | 4 ---- 6 files changed, 4 insertions(+), 66 deletions(-) diff --git a/cpu-defs.h b/cpu-defs.h index 5a0f11d..db48a7a 100644 --- a/cpu-defs.h +++ b/cpu-defs.h @@ -27,7 +27,6 @@ #include <setjmp.h> #include <inttypes.h> #include <signal.h> -#include <pthread.h> #include "osdep.h" #include "qemu-queue.h" #include "targphys.h" @@ -154,13 +153,6 @@ typedef struct CPUWatchpoint { QTAILQ_ENTRY(CPUWatchpoint) entry; } CPUWatchpoint; -/* forward decleration */ -struct qemu_work_item; - -struct KVMCPUState { - struct qemu_work_item *queued_work_first, *queued_work_last; -}; - #define CPU_TEMP_BUF_NLONGS 128 #define CPU_COMMON \ struct TranslationBlock *current_tb; /* currently executing TB */ \ @@ -226,7 +218,6 @@ struct KVMCPUState { struct KVMState *kvm_state; \ struct kvm_run *kvm_run; \ int kvm_fd; \ - int kvm_vcpu_dirty; \ - struct KVMCPUState kvm_cpu_state; + int kvm_vcpu_dirty; #endif diff --git a/cpus.c b/cpus.c index 2f72243..fc5605d 100644 --- a/cpus.c +++ b/cpus.c @@ -722,7 +722,6 @@ void run_on_cpu(CPUState *env, void (*func)(void *data), void *data) } } -#ifdef UNUSED_IOTHREAD_IMPL static void flush_queued_work(CPUState *env) { struct qemu_work_item *wi; @@ -740,6 +739,7 @@ static void flush_queued_work(CPUState *env) qemu_cond_broadcast(&qemu_work_cond); } +#ifdef UNUSED_IOTHREAD_IMPL static void qemu_wait_io_event_common(CPUState *env) { if (env->stop) { @@ -1220,54 +1220,11 @@ static void sig_ipi_handler(int n) { } -void on_vcpu(CPUState *env, void (*func)(void *data), void *data) -{ - struct qemu_work_item wi; - - if (env == current_env) { - func(data); - return; - } - - wi.func = func; - wi.data = data; - if (!env->kvm_cpu_state.queued_work_first) { - env->kvm_cpu_state.queued_work_first = &wi; - } else { - env->kvm_cpu_state.queued_work_last->next = &wi; - } - env->kvm_cpu_state.queued_work_last = &wi; - wi.next = NULL; - wi.done = false; - - pthread_kill(env->thread->thread, SIG_IPI); - while (!wi.done) { - kvm_cond_wait(&qemu_work_cond); - } -} - static int kvm_cpu_is_stopped(CPUState *env) { return !vm_running || env->stopped; } -static void flush_queued_work(CPUState *env) -{ - struct qemu_work_item *wi; - - if (!env->kvm_cpu_state.queued_work_first) { - return; - } - - while ((wi = env->kvm_cpu_state.queued_work_first)) { - env->kvm_cpu_state.queued_work_first = wi->next; - wi->func(wi->data); - wi->done = true; - } - env->kvm_cpu_state.queued_work_last = NULL; - qemu_cond_broadcast(&qemu_work_cond); -} - static void kvm_main_loop_wait(CPUState *env, int timeout) { struct timespec ts; diff --git a/kvm-all.c b/kvm-all.c index 8bef14a..e6a2b65 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -33,10 +33,6 @@ #include <sys/eventfd.h> #endif -#ifndef OBSOLETE_KVM_IMPL -#define run_on_cpu on_vcpu -#endif /* !OBSOLETE_KVM_IMPL */ - /* KVM uses PAGE_SIZE in it's definition of COALESCED_MMIO_MAX */ #define PAGE_SIZE TARGET_PAGE_SIZE diff --git a/qemu-kvm.c b/qemu-kvm.c index dfbf045..649af9c 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -602,7 +602,7 @@ int kvm_add_ioport_region(unsigned long start, unsigned long size) if (qemu_system_is_ready()) { for (env = first_cpu; env != NULL; env = env->next_cpu) { - on_vcpu(env, do_set_ioport_access, region); + run_on_cpu(env, do_set_ioport_access, region); if (region->status < 0) { r = region->status; kvm_remove_ioport_region(start, size); @@ -625,7 +625,7 @@ int kvm_remove_ioport_region(unsigned long start, unsigned long size) } if (qemu_system_is_ready()) { for (env = first_cpu; env != NULL; env = env->next_cpu) { - on_vcpu(env, do_set_ioport_access, region); + run_on_cpu(env, do_set_ioport_access, region); } } QLIST_REMOVE(region, entry); diff --git a/qemu-kvm.h b/qemu-kvm.h index 20e24e7..a577eba 100644 --- a/qemu-kvm.h +++ b/qemu-kvm.h @@ -274,8 +274,6 @@ void kvm_load_lapic(CPUState *env); void kvm_hpet_enable_kpit(void); void kvm_hpet_disable_kpit(void); -void on_vcpu(CPUState *env, void (*func)(void *data), void *data); - int kvm_set_boot_cpu_id(KVMState *s, uint32_t id); void kvm_tpr_access_report(CPUState *env, uint64_t rip, int is_write); diff --git a/target-i386/helper.c b/target-i386/helper.c index 2315c84..89df997 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -32,10 +32,6 @@ #include "monitor.h" #endif -#ifndef OBSOLETE_KVM_IMPL -#define run_on_cpu on_vcpu -#endif /* !OBSOLETE_KVM_IMPL */ - //#define DEBUG_MMU /* NOTE: must be called outside the CPU execute loop */ -- 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