From: Sergey Fedorov <serge.f...@gmail.com> This will be useful to enable CPU work on user mode emulation.
Signed-off-by: Sergey Fedorov <serge.f...@gmail.com> Signed-off-by: Sergey Fedorov <sergey.fedo...@linaro.org> Reviewed-by: Alex Bennée <alex.ben...@linaro.org> --- cpus.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cpus.c b/cpus.c index 04687c85bcd4..f80ed2aeefdd 100644 --- a/cpus.c +++ b/cpus.c @@ -910,6 +910,11 @@ void qemu_init_cpu_loop(void) qemu_thread_get_self(&io_thread); } +static QemuMutex *qemu_get_cpu_work_mutex(void) +{ + return &qemu_global_mutex; +} + static void queue_work_on_cpu(CPUState *cpu, struct qemu_work_item *wi) { qemu_mutex_lock(&cpu->work_mutex); @@ -943,7 +948,7 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, void *data) while (!atomic_mb_read(&wi.done)) { CPUState *self_cpu = current_cpu; - qemu_cond_wait(&qemu_work_cond, &qemu_global_mutex); + qemu_cond_wait(&qemu_work_cond, qemu_get_cpu_work_mutex()); current_cpu = self_cpu; } } -- 2.9.1