@samitouri / QOSamiQemu / commits / 9ebcec5cc4

target/riscv: Move debug.h include away from cpu.h

All debug.h definitions except for RV_MAX_TRIGGERS are internal to target/riscv. Move RV_MAX_TRIGGERS to cpu.h and include debug.h from all translation units which relied on the cpu.h include. Signed-off-by: Anton Johansson <anjo@rev.ng> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20260520125406.28693-23-anjo@rev.ng> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

Anton Johansson committed May 20, 2026 at 14:54 UTC 9ebcec5cc4a7922433fd20fd360d050c4815faf9
7 files changed +10 -4
target/riscv/cpu.c
+3
@@ -38,6 +38,9 @@
38 #include "kvm/kvm_riscv.h"
39 #include "tcg/tcg-cpu.h"
40 #include "tcg/tcg.h"
41 +#if !defined(CONFIG_USER_ONLY)
42 +#include "target/riscv/debug.h"
43 +#endif
44
45 /* RISC-V CPU definitions */
46 static const char riscv_single_letter_exts[] = "IEMAFDQCBPVH";
target/riscv/cpu.h
+1 -1
@@ -187,12 +187,12 @@ extern RISCVCPUImpliedExtsRule *riscv_multi_ext_implied_rules[];
187
188 #if !defined(CONFIG_USER_ONLY)
189 #include "pmp.h"
190 -#include "debug.h"
190 #endif
191
192 #define RV_VLEN_MAX 1024
193 #define RV_MAX_MHPMEVENTS 32
194 #define RV_MAX_MHPMCOUNTERS 32
195 +#define RV_MAX_TRIGGERS 2
196
197 FIELD(VTYPE, VLMUL, 0, 3)
198 FIELD(VTYPE, VSEW, 3, 3)
target/riscv/cpu_helper.c
+1 -1
@@ -34,7 +34,7 @@
34 #include "semihosting/common-semi.h"
35 #include "exec/icount.h"
36 #include "cpu_bits.h"
37 -#include "debug.h"
37 +#include "target/riscv/debug.h"
38 #include "pmp.h"
39 #include "qemu/plugin.h"
40
target/riscv/csr.c
+3
@@ -31,6 +31,9 @@
31 #include "qapi/error.h"
32 #include "tcg/insn-start-words.h"
33 #include "internals.h"
34 +#if !defined(CONFIG_USER_ONLY)
35 +#include "target/riscv/debug.h"
36 +#endif
37
38 /* CSR function table public API */
39 void riscv_get_csr_ops(int csrno, riscv_csr_operations *ops)
target/riscv/debug.c
+1
@@ -27,6 +27,7 @@
27 #include "qemu/log.h"
28 #include "qapi/error.h"
29 #include "cpu.h"
30 +#include "target/riscv/debug.h"
31 #include "trace.h"
32 #include "exec/helper-proto.h"
33 #include "exec/watchpoint.h"
target/riscv/debug.h
-2
@@ -25,8 +25,6 @@
25 #include "exec/breakpoint.h"
26 #include "exec/target_long.h"
27
28 -#define RV_MAX_TRIGGERS 2
29 -
28 /* register index of tdata CSRs */
29 enum {
30 TDATA1 = 0,
target/riscv/tcg/tcg-cpu.c
+1
@@ -37,6 +37,7 @@
37 #include "hw/core/boards.h"
38 #include "system/tcg.h"
39 #include "exec/icount.h"
40 +#include "target/riscv/debug.h"
41 #endif
42
43 /* Hash that stores user set extensions */