fold vcpu_info into CPUState
PATCH 1/1 fold vcpu_info into CPUState
Hi,
Here's the 6th version of this patch. I've split out the part with the opaque env pointer through libkvm and the tiny patch for the bool. Hence, this patch obviously require my two previous patches.
Let me know if there's further objections.
Thanks,
Jes
Merge vcpu_info into CPUState.
Move contents of struct vcpu_info directly into CPU_COMMON. Rename struct qemu_kvm_work_item to qemu_work_item as it really isn't KVM specific.
This eliminates the ugly static sized array of struct vcpu_info.
--- qemu/cpu-defs.h | 18 +++++- qemu/hw/acpi.c | 18 ++++++ qemu/qemu-common.h | 8 ++ qemu/qemu-kvm.c | 155 +++++++++++++++++++++++------------------------------ qemu/qemu-kvm.h | 2 5 files changed, 113 insertions(+), 88 deletions(-)
qemu/cpu-defs.h +17 -1
@@ -27,6 +27,7 @@#include "config.h" #include <setjmp.h> #include <inttypes.h> +#include <pthread.h> #include "osdep.h" #ifndef TARGET_LONG_BITS
@@ -145,6 +146,20 @@struct kvm_run ;struct KVMState ; +/* forward decleration */ +struct qemu_work_item ; + +struct KVMCPUState { +int sipi_needed; +int init; +pthread_t thread; +int signalled; +int stop; +int stopped; +int created; +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 */ \
@@ -206,6 +221,7 @@const char *cpu_model_str; \struct KVMState *kvm_state; \struct kvm_run *kvm_run; \ -int kvm_fd; +int kvm_fd; \ +struct KVMCPUState kvm_cpu_state;#endif
qemu/hw/acpi.c +18 -0
@@ -729,6 +729,24 @@ }#if defined(TARGET_I386 ) || defined(TARGET_X86_64 ) +#ifdef USE_KVM +static CPUState *qemu_kvm_cpu_env (int index) +{ +CPUState *penv; + + penv = first_cpu; + +while (penv) { +if (penv->cpu_index == index) +return penv; + penv = (CPUState *)penv->next_cpu; + } + +return NULL ; +} +#endif + +void qemu_system_cpu_hot_add (int cpu,int state) {CPUState *env;
qemu/qemu-common.h +8 -0
@@ -150,4 +150,12 @@void cpu_save (QEMUFile *f,void *opaque);int cpu_load (QEMUFile *f,void *opaque,int version_id); +/* work queue */ +struct qemu_work_item { +struct qemu_work_item *next; +void (*func)(void *data); +void *data; +int done; +}; +#endif
qemu/qemu-kvm.c +70 -85
339 lines not on this page · raw message
qemu/qemu-kvm.h +0 -2
@@ -70,8 +70,6 @@void kvm_arch_update_regs_for_sipi (CPUState *env);void kvm_arch_cpu_reset (CPUState *env); -CPUState *qemu_kvm_cpu_env (int index); -void qemu_kvm_aio_wait_start (void );void qemu_kvm_aio_wait (void );void qemu_kvm_aio_wait_end (void );
Avi Kivity
AppliedQuoted 4 lines · Jes Sorensen
Here's the 6th version of this patch. I've split out the part with the opaque env pointer through libkvm and the tiny patch for the bool. Hence, this patch obviously require my two previous patches.
Applied, thanks.
Signature · 1 line
error compiling committee.c: too many arguments to function