[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 45/59] accel/tcg: Declare cpu_loop_exit_requested() in 'exec/cpu-c
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 45/59] accel/tcg: Declare cpu_loop_exit_requested() in 'exec/cpu-common.h' |
Date: |
Fri, 20 Dec 2024 17:15:36 +0100 |
Move cpu_loop_exit_requested() declaration to "exec/cpu-common.h",
along with the related cpu_loop_exit_noexc(), cpu_loop_exit(),
cpu_loop_exit_atomic() and cpu_loop_exit_restore() methods.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20241217140648.98538-1-philmd@linaro.org>
---
include/exec/cpu-common.h | 18 ++++++++++++++++++
include/exec/exec-all.h | 17 -----------------
accel/tcg/cpu-exec.c | 2 +-
target/arm/tcg/helper-a64.c | 1 +
target/s390x/tcg/mem_helper.c | 1 +
5 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index 638dc806a5f..0cf9a3d369c 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -186,6 +186,7 @@ int cpu_memory_rw_debug(CPUState *cpu, vaddr addr,
void list_cpus(void);
#ifdef CONFIG_TCG
+#include "qemu/atomic.h"
bool tcg_cflags_has(CPUState *cpu, uint32_t flags);
void tcg_cflags_set(CPUState *cpu, uint32_t flags);
@@ -218,6 +219,23 @@ bool cpu_unwind_state_data(CPUState *cpu, uintptr_t
host_pc, uint64_t *data);
*/
bool cpu_restore_state(CPUState *cpu, uintptr_t host_pc);
+/**
+ * cpu_loop_exit_requested:
+ * @cpu: The CPU state to be tested
+ *
+ * Indicate if somebody asked for a return of the CPU to the main loop
+ * (e.g., via cpu_exit() or cpu_interrupt()).
+ *
+ * This is helpful for architectures that support interruptible
+ * instructions. After writing back all state to registers/memory, this
+ * call can be used to check if it makes sense to return to the main loop
+ * or to continue executing the interruptible instruction.
+ */
+static inline bool cpu_loop_exit_requested(CPUState *cpu)
+{
+ return (int32_t)qatomic_read(&cpu->neg.icount_decr.u32) < 0;
+}
+
G_NORETURN void cpu_loop_exit_noexc(CPUState *cpu);
G_NORETURN void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc);
#endif /* CONFIG_TCG */
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index c4a6ad3af2d..d9045c9ac4c 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -27,23 +27,6 @@
#include "exec/mmu-access-type.h"
#include "exec/translation-block.h"
-/**
- * cpu_loop_exit_requested:
- * @cpu: The CPU state to be tested
- *
- * Indicate if somebody asked for a return of the CPU to the main loop
- * (e.g., via cpu_exit() or cpu_interrupt()).
- *
- * This is helpful for architectures that support interruptible
- * instructions. After writing back all state to registers/memory, this
- * call can be used to check if it makes sense to return to the main loop
- * or to continue executing the interruptible instruction.
- */
-static inline bool cpu_loop_exit_requested(CPUState *cpu)
-{
- return (int32_t)qatomic_read(&cpu->neg.icount_decr.u32) < 0;
-}
-
#if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG)
/* cputlb.c */
/**
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index e9eaab223f9..c07e59cd0b1 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -25,7 +25,7 @@
#include "hw/core/tcg-cpu-ops.h"
#include "trace.h"
#include "disas/disas.h"
-#include "exec/exec-all.h"
+#include "exec/cpu-common.h"
#include "exec/page-protection.h"
#include "tcg/tcg.h"
#include "qemu/atomic.h"
diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c
index b6af2a59d63..0e130501fd6 100644
--- a/target/arm/tcg/helper-a64.c
+++ b/target/arm/tcg/helper-a64.c
@@ -28,6 +28,7 @@
#include "qemu/bitops.h"
#include "internals.h"
#include "qemu/crc32c.h"
+#include "exec/cpu-common.h"
#include "exec/exec-all.h"
#include "exec/cpu_ldst.h"
#include "qemu/int128.h"
diff --git a/target/s390x/tcg/mem_helper.c b/target/s390x/tcg/mem_helper.c
index 307388e5bd1..32717acb7d1 100644
--- a/target/s390x/tcg/mem_helper.c
+++ b/target/s390x/tcg/mem_helper.c
@@ -24,6 +24,7 @@
#include "s390x-internal.h"
#include "tcg_s390x.h"
#include "exec/helper-proto.h"
+#include "exec/cpu-common.h"
#include "exec/exec-all.h"
#include "exec/page-protection.h"
#include "exec/cpu_ldst.h"
--
2.47.1
- [PULL 33/59] accel/tcg: Move user-related declarations out of 'exec/cpu-all.h' (1/4), (continued)
- [PULL 33/59] accel/tcg: Move user-related declarations out of 'exec/cpu-all.h' (1/4), Philippe Mathieu-Daudé, 2024/12/20
- [PULL 35/59] accel/tcg: Move user-related declarations out of 'exec/cpu-all.h' (3/4), Philippe Mathieu-Daudé, 2024/12/20
- [PULL 36/59] accel/tcg: Move user-related declarations out of 'exec/cpu-all.h' (4/4), Philippe Mathieu-Daudé, 2024/12/20
- [PULL 39/59] user: Declare cpu_loop() once in 'user/cpu_loop.h', Philippe Mathieu-Daudé, 2024/12/20
- [PULL 37/59] user: Forward declare target_cpu_copy_regs structure, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 40/59] user: Move various declarations out of 'exec/exec-all.h', Philippe Mathieu-Daudé, 2024/12/20
- [PULL 41/59] target/loongarch: Declare loongarch_cpu_dump_state() locally, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 43/59] target/sparc: Move sparc_restore_state_to_opc() to cpu.c, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 42/59] target/sparc: Uninline cpu_get_tb_cpu_state(), Philippe Mathieu-Daudé, 2024/12/20
- [PULL 44/59] exec/cpu-all: Include 'cpu.h' earlier so MMU_USER_IDX is always defined, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 45/59] accel/tcg: Declare cpu_loop_exit_requested() in 'exec/cpu-common.h',
Philippe Mathieu-Daudé <=
- [PULL 46/59] exec/translation-block: Include missing 'qemu/atomic.h' header, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 47/59] qemu/coroutine: Include missing 'qemu/atomic.h' header, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 48/59] accel/tcg: Restrict curr_cflags() declaration to 'internal-common.h', Philippe Mathieu-Daudé, 2024/12/20
- [PULL 49/59] accel/tcg: Move tcg_cflags_has/set() to 'exec/translation-block.h', Philippe Mathieu-Daudé, 2024/12/20
- [PULL 50/59] accel/tcg: Include missing 'exec/translation-block.h' header, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 51/59] accel/tcg: Un-inline translator_is_same_page(), Philippe Mathieu-Daudé, 2024/12/20
- [PULL 52/59] target/xtensa: Remove tswap() calls in semihosting simcall() helper, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 53/59] target/mips: Remove tswap() calls in semihosting uhi_fstat_cb(), Philippe Mathieu-Daudé, 2024/12/20
- [PULL 55/59] hw/xen: Remove unnecessary 'exec/cpu-common.h' header, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 54/59] target/mips: Drop left-over comment about Jazz machine, Philippe Mathieu-Daudé, 2024/12/20