Reviewed-by: Pavel Dovgalyuk <pavel.dovgal...@ispras.ru>

On 24.01.2024 13:16, Philippe Mathieu-Daudé wrote:
In order to make accel/tcg/ target agnostic,
introduce the need_replay_interrupt() handler.

Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
---
  include/hw/core/tcg-cpu-ops.h | 5 +++++
  accel/tcg/cpu-exec.c          | 5 ++++-
  2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h
index 479713a36e..2fae3ac70f 100644
--- a/include/hw/core/tcg-cpu-ops.h
+++ b/include/hw/core/tcg-cpu-ops.h
@@ -170,6 +170,11 @@ struct TCGCPUOps {
       */
      bool (*io_recompile_replay_branch)(CPUState *cpu,
                                         const TranslationBlock *tb);
+    /**
+     * @need_replay_interrupt: Return %true if @interrupt_request
+     * needs to be recorded for replay purposes.
+     */
+    bool (*need_replay_interrupt)(int interrupt_request);
  #endif /* !CONFIG_USER_ONLY */
  #endif /* NEED_CPU_H */
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index b10472cbc7..4ab7d6c896 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -778,7 +778,10 @@ static inline bool need_replay_interrupt(CPUClass *cc, int 
interrupt_request)
  #if defined(TARGET_I386)
      return !(interrupt_request & CPU_INTERRUPT_POLL);
  #else
-    return true;
+    if (!cc->tcg_ops->need_replay_interrupt) {
+        return true;
+    }
+    return cc->tcg_ops->need_replay_interrupt(interrupt_request);
  #endif
  }
  #endif /* !CONFIG_USER_ONLY */


Reply via email to