diff mbox series

[05/10] accel/tcg: remove the fake_user_interrupt guards

Message ID 20230320101035.2214196-6-alex.bennee@linaro.org
State New
Headers show
Series accel/tcg: refactor the cpu-exec loop | expand

Commit Message

Alex Bennée March 20, 2023, 10:10 a.m. UTC
At the cost of an empty tcg_ops field for most targets we can avoid
target specific hacks in cpu-exec.c

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 include/hw/core/tcg-cpu-ops.h |  2 +-
 accel/tcg/cpu-exec.c          | 14 +++++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)

Comments

Richard Henderson March 20, 2023, 4:18 p.m. UTC | #1
On 3/20/23 03:10, Alex Bennée wrote:
> At the cost of an empty tcg_ops field for most targets we can avoid
> target specific hacks in cpu-exec.c
> 
> Signed-off-by: Alex Bennée<alex.bennee@linaro.org>
> ---
>   include/hw/core/tcg-cpu-ops.h |  2 +-
>   accel/tcg/cpu-exec.c          | 14 +++++++-------
>   2 files changed, 8 insertions(+), 8 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
diff mbox series

Patch

diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h
index 20e3c0ffbb..66c0cecdde 100644
--- a/include/hw/core/tcg-cpu-ops.h
+++ b/include/hw/core/tcg-cpu-ops.h
@@ -50,7 +50,7 @@  struct TCGCPUOps {
     void (*debug_excp_handler)(CPUState *cpu);
 
 #ifdef NEED_CPU_H
-#if defined(CONFIG_USER_ONLY) && defined(TARGET_I386)
+#if defined(CONFIG_USER_ONLY)
     /**
      * @fake_user_interrupt: Callback for 'fake exception' handling.
      *
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index f883be197f..ea2e7004fe 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -698,13 +698,13 @@  static inline bool cpu_handle_exception(CPUState *cpu, int *ret)
         return true;
     } else {
 #if defined(CONFIG_USER_ONLY)
-        /* if user mode only, we simulate a fake exception
-           which will be handled outside the cpu execution
-           loop */
-#if defined(TARGET_I386)
-        CPUClass *cc = CPU_GET_CLASS(cpu);
-        cc->tcg_ops->fake_user_interrupt(cpu);
-#endif /* TARGET_I386 */
+        /*
+         * For some user mode handling we simulate a fake exception
+         * which will be handled outside the cpu execution loop
+         */
+        if (cpu->cc->tcg_ops->fake_user_interrupt) {
+            cpu->cc->tcg_ops->fake_user_interrupt(cpu);
+        }
         *ret = cpu->exception_index;
         cpu->exception_index = -1;
         return true;