Philippe Mathieu-Daudé <phi...@linaro.org> writes:

> In order to have a generic function creating threads,
> introduce the thread_precreate() and cpu_thread_routine()
> handlers.
>
> Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
> ---
>  include/system/accel-ops.h |  2 ++
>  accel/accel-common.c       | 16 +++++++++++++++-
>  2 files changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/include/system/accel-ops.h b/include/system/accel-ops.h
> index 44b37592d02..a6535a07343 100644
> --- a/include/system/accel-ops.h
> +++ b/include/system/accel-ops.h
> @@ -37,6 +37,8 @@ struct AccelOpsClass {
>      bool (*cpus_are_resettable)(void);
>      void (*cpu_reset_hold)(CPUState *cpu);
>  
> +    void *(*cpu_thread_routine)(void *);
> +    void (*thread_precreate)(CPUState *cpu);
>      void (*create_vcpu_thread)(CPUState *cpu); /* MANDATORY NON-NULL
> */

After this you start switching *create_vcpu_thread to
*cpu_thread_routine despite this being a mandatory non-null. You should
fix the comment and maybe the assert?

modified   system/cpus.c
@@ -682,7 +682,7 @@ void cpu_remove_sync(CPUState *cpu)
 void cpus_register_accel(const AccelOpsClass *ops)
 {
     assert(ops != NULL);
-    assert(ops->create_vcpu_thread != NULL); /* mandatory */
+    assert(ops->create_vcpu_thread || ops->cpu_thread_routine); /* mandatory */
     cpus_accel = ops;
 }

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro

Reply via email to