cpus-common: move CPU work item management to common code

Make CPU work core functions common between system and user-mode
emulation. User-mode does not use run_on_cpu, so do not implement it.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <1470158864-17651-10-git-send-email-alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Sergey Fedorov 2016-08-29 09:51:00 +02:00 committed by Paolo Bonzini
parent 267f685b8b
commit d148d90ee8
5 changed files with 148 additions and 91 deletions

View file

@ -233,14 +233,7 @@ struct kvm_run;
/* work queue */
typedef void (*run_on_cpu_func)(CPUState *cpu, void *data);
struct qemu_work_item {
struct qemu_work_item *next;
run_on_cpu_func func;
void *data;
int done;
bool free;
};
struct qemu_work_item;
/**
* CPUState:
@ -629,6 +622,18 @@ void qemu_cpu_kick(CPUState *cpu);
*/
bool cpu_is_stopped(CPUState *cpu);
/**
* do_run_on_cpu:
* @cpu: The vCPU to run on.
* @func: The function to be executed.
* @data: Data to pass to the function.
* @mutex: Mutex to release while waiting for @func to run.
*
* Used internally in the implementation of run_on_cpu.
*/
void do_run_on_cpu(CPUState *cpu, run_on_cpu_func func, void *data,
QemuMutex *mutex);
/**
* run_on_cpu:
* @cpu: The vCPU to run on.
@ -807,6 +812,12 @@ void cpu_remove(CPUState *cpu);
*/
void cpu_remove_sync(CPUState *cpu);
/**
* process_queued_cpu_work() - process all items on CPU work queue
* @cpu: The CPU which work queue to process.
*/
void process_queued_cpu_work(CPUState *cpu);
/**
* qemu_init_vcpu:
* @cpu: The vCPU to initialize.