accel/tcg: Move cpu_loop_exit_*() out of 'exec/cpu-common.h'
Move the following TCG-specific cpu_loop_exit_*() declarations out of the generic "exec/cpu-common.h" header, to the recently created "accel/tcg/cpu-loop.h" one, documenting them: - cpu_loop_exit_noexc() - cpu_loop_exit_atomic() - cpu_loop_exit_restore() - cpu_loop_exit() Include "accel/tcg/cpu-loop.h" where appropriate. Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20260617171438.75914-11-philmd@oss.qualcomm.com>
Philippe Mathieu-Daudé committed
Jun 17, 2026 at 19:11 UTC
2368ea9744c463902c85305c1ffc5bb5e265f0ca
42 files changed
+70
-5
accel/tcg/cputlb.c
+1
@@ -20,6 +20,7 @@
20
#include "qemu/osdep.h"
21
#include "qemu/main-loop.h"
22
#include "qemu/target-info.h"
23
+#include "accel/tcg/cpu-loop.h"
24
#include "accel/tcg/cpu-ops.h"
25
#include "accel/tcg/iommu.h"
26
#include "accel/tcg/probe.h"
accel/tcg/tb-maint.c
+1
@@ -26,6 +26,7 @@
26
#include "exec/mmap-lock.h"
27
#include "exec/tb-flush.h"
28
#include "exec/target_page.h"
29
+#include "accel/tcg/cpu-loop.h"
30
#include "accel/tcg/cpu-ops.h"
31
#include "tb-internal.h"
32
#include "system/tcg.h"
accel/tcg/tcg-runtime.c
+1
@@ -25,6 +25,7 @@
25
#include "qemu/host-utils.h"
26
#include "exec/cpu-common.h"
27
#include "exec/helper-proto-common.h"
28
+#include "accel/tcg/cpu-loop.h"
29
#include "accel/tcg/getpc.h"
30
31
#define HELPER_H "accel/tcg/tcg-runtime.h"
accel/tcg/watchpoint.c
+1
@@ -25,6 +25,7 @@
25
#include "exec/translation-block.h"
26
#include "system/tcg.h"
27
#include "system/replay.h"
28
+#include "accel/tcg/cpu-loop.h"
29
#include "accel/tcg/cpu-ops.h"
30
#include "hw/core/cpu.h"
31
#include "internal-common.h"
hw/misc/mips_itu.c
+1
@@ -25,6 +25,7 @@
25
#include "hw/core/cpu.h"
26
#include "hw/misc/mips_itu.h"
27
#include "hw/core/qdev-properties.h"
28
+#include "accel/tcg/cpu-loop.h"
29
#include "target/mips/cpu.h"
30
31
#define ITC_TAG_ADDRSPACE_SZ (ITC_ADDRESSMAP_NUM * 8)
include/accel/tcg/cpu-loop.h
+28
@@ -45,4 +45,32 @@ bool cpu_unwind_state_data(CPUState *cpu, uintptr_t host_pc, uint64_t *data);
45
*/
46
bool cpu_restore_state(CPUState *cpu, uintptr_t host_pc);
47
48
+/**
49
+ * cpu_loop_exit_noexc:
50
+ * @cpu: the cpu context
51
+ *
52
+ * Exit the current TB, but without causing any exception to be raised.
53
+ */
54
+G_NORETURN void cpu_loop_exit_noexc(CPUState *cpu);
55
+
56
+/**
57
+ * cpu_loop_exit_restore:
58
+ * @cpu: the cpu context
59
+ * @host_pc: the host pc within the translation
60
+ *
61
+ * Attempt to restore the state for a fault occurring in translated
62
+ * code. If @host_pc is not in translated code no state is
63
+ * restored. Finally, exit the current TB.
64
+ */
65
+G_NORETURN void cpu_loop_exit_restore(CPUState *cpu, uintptr_t host_pc);
66
+G_NORETURN void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t host_pc);
67
+
68
+/**
69
+ * cpu_loop_exit:
70
+ * @cpu: the cpu context
71
+ *
72
+ * Exit the current TB.
73
+ */
74
+G_NORETURN void cpu_loop_exit(CPUState *cpu);
75
+
76
#endif
include/exec/cpu-common.h
-5
@@ -77,12 +77,7 @@ static inline bool cpu_loop_exit_requested(const CPUState *cpu)
77
{
78
return (int32_t)qatomic_read(&cpu->neg.icount_decr.u32) < 0;
79
}
80
-
81
-G_NORETURN void cpu_loop_exit_noexc(CPUState *cpu);
82
-G_NORETURN void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc);
83
-G_NORETURN void cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc);
80
#endif /* CONFIG_TCG */
85
-G_NORETURN void cpu_loop_exit(CPUState *cpu);
81
82
/**
83
* env_archcpu(env)
plugins/api.c
+1
@@ -40,6 +40,7 @@
40
#include "qemu/plugin.h"
41
#include "qemu/log.h"
42
#include "system/memory.h"
43
+#include "accel/tcg/cpu-loop.h"
44
#include "tcg/tcg.h"
45
#include "exec/cpu-common.h"
46
#include "exec/gdbstub.h"
semihosting/console.c
+1
@@ -18,6 +18,7 @@
18
#include "qemu/osdep.h"
19
#include "semihosting/semihost.h"
20
#include "semihosting/console.h"
21
+#include "accel/tcg/cpu-loop.h"
22
#include "exec/cpu-common.h"
23
#include "exec/gdbstub.h"
24
#include "qemu/log.h"
target/arm/tcg/helper-a64.c
+1
@@ -31,6 +31,7 @@
31
#include "qemu/crc32c.h"
32
#include "exec/cpu-common.h"
33
#include "accel/tcg/cpu-ldst.h"
34
+#include "accel/tcg/cpu-loop.h"
35
#include "accel/tcg/helper-retaddr.h"
36
#include "accel/tcg/probe.h"
37
#include "exec/target_page.h"
target/avr/helper.c
+1
@@ -23,6 +23,7 @@
23
#include "qemu/error-report.h"
24
#include "cpu.h"
25
#include "accel/tcg/cpu-ops.h"
26
+#include "accel/tcg/cpu-loop.h"
27
#include "exec/cputlb.h"
28
#include "exec/page-protection.h"
29
#include "exec/target_page.h"
target/hexagon/op_helper.c
+1
@@ -18,6 +18,7 @@
18
#include "qemu/osdep.h"
19
#include "qemu/log.h"
20
#include "accel/tcg/cpu-ldst.h"
21
+#include "accel/tcg/cpu-loop.h"
22
#include "accel/tcg/probe.h"
23
#include "exec/helper-proto.h"
24
#include "fpu/softfloat.h"
target/i386/tcg/excp_helper.c
+1
@@ -18,6 +18,7 @@
18
*/
19
20
#include "qemu/osdep.h"
21
+#include "accel/tcg/cpu-loop.h"
22
#include "cpu.h"
23
#include "qemu/log.h"
24
#include "system/runstate.h"
target/i386/tcg/misc_helper.c
+1
@@ -19,6 +19,7 @@
19
20
#include "qemu/osdep.h"
21
#include "qemu/log.h"
22
+#include "accel/tcg/cpu-loop.h"
23
#include "cpu.h"
24
#include "exec/helper-proto.h"
25
#include "exec/cputlb.h"
target/i386/tcg/system/bpt_helper.c
+1
@@ -18,6 +18,7 @@
18
*/
19
20
#include "qemu/osdep.h"
21
+#include "accel/tcg/cpu-loop.h"
22
#include "cpu.h"
23
#include "exec/helper-proto.h"
24
#include "exec/watchpoint.h"
target/i386/tcg/system/misc_helper.c
+1
@@ -22,6 +22,7 @@
22
#include "cpu.h"
23
#include "exec/helper-proto.h"
24
#include "accel/tcg/cpu-ldst.h"
25
+#include "accel/tcg/cpu-loop.h"
26
#include "system/address-spaces.h"
27
#include "system/memory.h"
28
#include "exec/cputlb.h"
target/i386/tcg/user/excp_helper.c
+1
@@ -18,6 +18,7 @@
18
*/
19
20
#include "qemu/osdep.h"
21
+#include "accel/tcg/cpu-loop.h"
22
#include "cpu.h"
23
#include "tcg/helper-tcg.h"
24
target/i386/tcg/user/seg_helper.c
+1
@@ -22,6 +22,7 @@
22
#include "cpu.h"
23
#include "exec/helper-proto.h"
24
#include "accel/tcg/cpu-ldst.h"
25
+#include "accel/tcg/cpu-loop.h"
26
#include "tcg/helper-tcg.h"
27
#include "tcg/seg_helper.h"
28
target/loongarch/tcg/tcg_cpu.c
+1
@@ -10,6 +10,7 @@
10
#include "qemu/log.h"
11
#include "qemu/plugin.h"
12
#include "accel/tcg/cpu-ldst.h"
13
+#include "accel/tcg/cpu-loop.h"
14
#include "accel/tcg/cpu-ops.h"
15
#include "exec/translation-block.h"
16
#include "exec/target_page.h"
target/loongarch/tcg/tlb_helper.c
+1
@@ -17,6 +17,7 @@
17
#include "exec/page-protection.h"
18
#include "exec/target_page.h"
19
#include "accel/tcg/cpu-ldst.h"
20
+#include "accel/tcg/cpu-loop.h"
21
#include "exec/log.h"
22
#include "cpu-csr.h"
23
#include "tcg/tcg_loongarch.h"
target/m68k/helper.c
+1
@@ -25,6 +25,7 @@
25
#include "exec/target_page.h"
26
#include "exec/gdbstub.h"
27
#include "exec/helper-proto.h"
28
+#include "accel/tcg/cpu-loop.h"
29
#include "system/memory.h"
30
#include "gdbstub/helpers.h"
31
#include "fpu/softfloat.h"
target/microblaze/op_helper.c
+1
@@ -24,6 +24,7 @@
24
#include "exec/helper-proto.h"
25
#include "qemu/host-utils.h"
26
#include "accel/tcg/cpu-ldst-common.h"
27
+#include "accel/tcg/cpu-loop.h"
28
#include "fpu/softfloat.h"
29
30
void helper_put(uint32_t id, uint32_t ctrl, uint32_t data)
target/mips/tcg/exception.c
+1
@@ -24,6 +24,7 @@
24
#include "internal.h"
25
#include "exec/helper-proto.h"
26
#include "exec/translation-block.h"
27
+#include "accel/tcg/cpu-loop.h"
28
29
target_ulong exception_resume_pc(CPUMIPSState *env)
30
{
target/mips/tcg/system/tlb_helper.c
+1
@@ -26,6 +26,7 @@
26
#include "exec/page-protection.h"
27
#include "exec/target_page.h"
28
#include "accel/tcg/cpu-ldst.h"
29
+#include "accel/tcg/cpu-loop.h"
30
#include "exec/log.h"
31
#include "exec/helper-proto.h"
32
target/or1k/exception.c
+1
@@ -18,6 +18,7 @@
18
*/
19
20
#include "qemu/osdep.h"
21
+#include "accel/tcg/cpu-loop.h"
22
#include "cpu.h"
23
#include "exception.h"
24
target/or1k/exception_helper.c
+1
@@ -19,6 +19,7 @@
19
20
#include "qemu/osdep.h"
21
#include "cpu.h"
22
+#include "accel/tcg/cpu-loop.h"
23
#include "exec/helper-proto.h"
24
#include "exception.h"
25
target/or1k/fpu_helper.c
+1
@@ -19,6 +19,7 @@
19
*/
20
21
#include "qemu/osdep.h"
22
+#include "accel/tcg/cpu-loop.h"
23
#include "cpu.h"
24
#include "exec/helper-proto.h"
25
#include "fpu/softfloat.h"
target/or1k/mmu.c
+1
@@ -24,6 +24,7 @@
24
#include "exec/cputlb.h"
25
#include "exec/page-protection.h"
26
#include "exec/target_page.h"
27
+#include "accel/tcg/cpu-loop.h"
28
#include "qemu/host-utils.h"
29
#include "hw/core/loader.h"
30
target/ppc/user_only_helper.c
+1
@@ -19,6 +19,7 @@
19
*/
20
21
#include "qemu/osdep.h"
22
+#include "accel/tcg/cpu-loop.h"
23
#include "cpu.h"
24
#include "internal.h"
25
target/riscv/cpu_helper.c
+1
@@ -29,6 +29,7 @@
29
#include "system/memory.h"
30
#include "instmap.h"
31
#include "tcg/tcg-op.h"
32
+#include "accel/tcg/cpu-loop.h"
33
#include "accel/tcg/cpu-ops.h"
34
#include "trace.h"
35
#include "semihosting/common-semi.h"
target/riscv/op_helper.c
+1
@@ -24,6 +24,7 @@
24
#include "internals.h"
25
#include "exec/cputlb.h"
26
#include "accel/tcg/cpu-ldst.h"
27
+#include "accel/tcg/cpu-loop.h"
28
#include "accel/tcg/probe.h"
29
#include "exec/helper-proto.h"
30
#include "exec/tlb-flags.h"
target/rx/op_helper.c
+1
@@ -21,6 +21,7 @@
21
#include "cpu.h"
22
#include "exec/helper-proto.h"
23
#include "accel/tcg/cpu-ldst.h"
24
+#include "accel/tcg/cpu-loop.h"
25
#include "fpu/softfloat.h"
26
#include "tcg/debug-assert.h"
27
target/s390x/mmu_helper.c
+3
@@ -24,6 +24,9 @@
24
#include "system/kvm.h"
25
#include "system/tcg.h"
26
#include "system/memory.h"
27
+#ifdef CONFIG_TCG
28
+#include "accel/tcg/cpu-loop.h"
29
+#endif
30
#include "exec/page-protection.h"
31
#include "exec/target_page.h"
32
#include "hw/core/hw-error.h"
target/s390x/tcg/cc_helper.c
+1
@@ -20,6 +20,7 @@
20
21
#include "qemu/osdep.h"
22
#include "cpu.h"
23
+#include "accel/tcg/cpu-loop.h"
24
#include "s390x-internal.h"
25
#include "tcg_s390x.h"
26
#include "exec/helper-proto.h"
target/s390x/tcg/debug.c
+1
@@ -7,6 +7,7 @@
7
#include "qemu/osdep.h"
8
#include "exec/breakpoint.h"
9
#include "exec/watchpoint.h"
10
+#include "accel/tcg/cpu-loop.h"
11
#include "target/s390x/cpu.h"
12
#include "target/s390x/s390x-internal.h"
13
#include "tcg_s390x.h"
target/s390x/tcg/mem_helper.c
+1
@@ -28,6 +28,7 @@
28
#include "exec/cputlb.h"
29
#include "exec/page-protection.h"
30
#include "accel/tcg/cpu-ldst.h"
31
+#include "accel/tcg/cpu-loop.h"
32
#include "accel/tcg/probe.h"
33
#include "exec/target_page.h"
34
#include "exec/tlb-flags.h"
target/s390x/tcg/misc_helper.c
+1
@@ -28,6 +28,7 @@
28
#include "qemu/timer.h"
29
#include "exec/cputlb.h"
30
#include "accel/tcg/cpu-ldst-common.h"
31
+#include "accel/tcg/cpu-loop.h"
32
#include "accel/tcg/cpu-mmu-index.h"
33
#include "exec/target_page.h"
34
#include "qapi/error.h"
target/sh4/helper.c
+1
@@ -24,6 +24,7 @@
24
#include "exec/page-protection.h"
25
#include "exec/target_page.h"
26
#include "exec/log.h"
27
+#include "accel/tcg/cpu-loop.h"
28
#include "qemu/plugin.h"
29
30
#if !defined(CONFIG_USER_ONLY)
target/sparc/helper.c
+1
@@ -21,6 +21,7 @@
21
#include "cpu.h"
22
#include "qemu/timer.h"
23
#include "qemu/host-utils.h"
24
+#include "accel/tcg/cpu-loop.h"
25
#include "exec/cpu-common.h"
26
#include "exec/helper-proto.h"
27
target/sparc/mmu_helper.c
+1
@@ -21,6 +21,7 @@
21
#include "qemu/log.h"
22
#include "cpu.h"
23
#include "exec/cputlb.h"
24
+#include "accel/tcg/cpu-loop.h"
25
#include "accel/tcg/cpu-mmu-index.h"
26
#include "exec/page-protection.h"
27
#include "exec/target_page.h"
target/tricore/helper.c
+1
@@ -20,6 +20,7 @@
20
#include "hw/core/registerfields.h"
21
#include "cpu.h"
22
#include "exec/cputlb.h"
23
+#include "accel/tcg/cpu-loop.h"
24
#include "accel/tcg/cpu-mmu-index.h"
25
#include "exec/page-protection.h"
26
#include "exec/target_page.h"
target/xtensa/exc_helper.c
+1
@@ -28,6 +28,7 @@
28
#include "qemu/osdep.h"
29
#include "qemu/log.h"
30
#include "qemu/main-loop.h"
31
+#include "accel/tcg/cpu-loop.h"
32
#include "cpu.h"
33
#include "exec/helper-proto.h"
34
#include "qemu/host-utils.h"