On 24/01/24, Philippe Mathieu-Daudé wrote:
> In order to make accel/tcg/ target agnostic,
> introduce the cpu_exec_halt() handler.
> 
> Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
> ---
>  include/hw/core/tcg-cpu-ops.h | 2 ++
>  accel/tcg/cpu-exec.c          | 3 +++
>  2 files changed, 5 insertions(+)
> 
> diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h
> index 2fae3ac70f..3307338c80 100644
> --- a/include/hw/core/tcg-cpu-ops.h
> +++ b/include/hw/core/tcg-cpu-ops.h
> @@ -114,6 +114,8 @@ struct TCGCPUOps {
>      void (*record_sigbus)(CPUState *cpu, vaddr addr,
>                            MMUAccessType access_type, uintptr_t ra);
>  #else
> +    /** @cpu_exec_halt: Callback for handling halt in cpu_exec */
> +    void (*cpu_exec_halt)(CPUState *cpu);
>      /** @cpu_exec_interrupt: Callback for processing interrupts in cpu_exec 
> */
>      bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request);
>      /**
> diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
> index 5a978a9e72..390a9644da 100644
> --- a/accel/tcg/cpu-exec.c
> +++ b/accel/tcg/cpu-exec.c
> @@ -681,6 +681,9 @@ static inline bool cpu_handle_halt(CPUClass *cc, CPUState 
> *cpu)
>              bql_unlock();
>          }
>  #endif /* TARGET_I386 */
> +        if (cc->tcg_ops->cpu_exec_halt) {
> +            cc->tcg_ops->cpu_exec_halt(cpu);
> +        }
>          if (!cpu_has_work(cpu)) {
>              return true;
>          }
> -- 
> 2.41.0
> 
Reviewed-by: Anton Johansson <a...@rev.ng>

Reply via email to