@samitouri / QOSamiQemu / commits / 77bdae789a

accel/tcg: Move cpu_exec() out of 'exec/cpu-common.h'

In order to keep TCG-specific functions under a TCG API namespace, add the "accel/tcg/cpu-loop.h" header and move cpu_exec() declaration to it. Add a bit of documentation. 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-5-philmd@oss.qualcomm.com>

Philippe Mathieu-Daudé committed Jun 16, 2026 at 18:23 UTC 77bdae789a19092c04a6ce46d24c0b6187d53094
7 files changed +26 -4
accel/tcg/cpu-exec.c
+1
@@ -22,6 +22,7 @@
22 #include "qapi/error.h"
23 #include "qapi/type-helpers.h"
24 #include "hw/core/cpu.h"
25 +#include "accel/tcg/cpu-loop.h"
26 #include "accel/tcg/cpu-ops.h"
27 #include "accel/tcg/helper-retaddr.h"
28 #include "trace.h"
accel/tcg/tcg-accel-ops.c
+1
@@ -28,6 +28,7 @@
28 #include "qemu/osdep.h"
29 #include "accel/accel-ops.h"
30 #include "accel/accel-cpu-ops.h"
31 +#include "accel/tcg/cpu-loop.h"
32 #include "system/tcg.h"
33 #include "system/replay.h"
34 #include "exec/icount.h"
bsd-user/freebsd/os-proc.h
+1
@@ -14,6 +14,7 @@
14 #include <sys/procdesc.h>
15 #include <sys/wait.h>
16
17 +#include "accel/tcg/cpu-loop.h"
18 #include "target_arch_cpu.h"
19
20 pid_t safe_wait4(pid_t wpid, int *status, int options, struct rusage *rusage);
bsd-user/main.c
+1
@@ -39,6 +39,7 @@
39 #include "user/guest-base.h"
40 #include "user/page-protection.h"
41 #include "accel/accel-ops.h"
42 +#include "accel/tcg/cpu-loop.h"
43 #include "tcg/startup.h"
44 #include "qemu/timer.h"
45 #include "qemu/envlist.h"
include/accel/tcg/cpu-loop.h new
+21
@@ -0,0 +1,21 @@
1 +/*
2 + * QEMU TCG CPU loop API
3 + *
4 + * SPDX-License-Identifier: GPL-2.0-or-later
5 + */
6 +#ifndef ACCEL_TCG_CPU_LOOP_COMMON_H
7 +#define ACCEL_TCG_CPU_LOOP_COMMON_H
8 +
9 +#ifndef CONFIG_TCG
10 +#error Can only include this header with TCG
11 +#endif
12 +
13 +/**
14 + * cpu_exec:
15 + * @cpu: the cpu context
16 + *
17 + * Returns one of the EXCP_* definitions (see "exec/cpu-common.h").
18 + */
19 +int cpu_exec(CPUState *cpu);
20 +
21 +#endif
include/exec/cpu-common.h
-3
@@ -111,9 +111,6 @@ G_NORETURN void cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc);
111 #endif /* CONFIG_TCG */
112 G_NORETURN void cpu_loop_exit(CPUState *cpu);
113
114 -/* accel/tcg/cpu-exec.c */
115 -int cpu_exec(CPUState *cpu);
116 -
114 /**
115 * env_archcpu(env)
116 * @env: The architecture environment
include/user/cpu_loop.h
+1 -1
@@ -22,7 +22,7 @@
22
23 #include "exec/vaddr.h"
24 #include "exec/mmu-access-type.h"
25 -
25 +#include "accel/tcg/cpu-loop.h"
26
27 /**
28 * adjust_signal_pc: