On Wed, Oct 15, 2025 at 6:38 AM Anton Johansson via <[email protected]> wrote: > > 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 <[email protected]> > Reviewed-by: Pierrick Bouvier <[email protected]>
Reviewed-by: Alistair Francis <[email protected]> Alistair > --- > target/riscv/cpu.h | 2 +- > target/riscv/debug.h | 2 -- > target/riscv/cpu.c | 3 +++ > target/riscv/csr.c | 3 +++ > target/riscv/debug.c | 1 + > target/riscv/tcg/tcg-cpu.c | 1 + > 6 files changed, 9 insertions(+), 3 deletions(-) > > diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h > index 5e9fa0ab10..c02c813259 100644 > --- a/target/riscv/cpu.h > +++ b/target/riscv/cpu.h > @@ -185,12 +185,12 @@ extern RISCVCPUImpliedExtsRule > *riscv_multi_ext_implied_rules[]; > > #if !defined(CONFIG_USER_ONLY) > #include "pmp.h" > -#include "debug.h" > #endif > > #define RV_VLEN_MAX 1024 > #define RV_MAX_MHPMEVENTS 32 > #define RV_MAX_MHPMCOUNTERS 32 > +#define RV_MAX_TRIGGERS 2 > > FIELD(VTYPE, VLMUL, 0, 3) > FIELD(VTYPE, VSEW, 3, 3) > diff --git a/target/riscv/debug.h b/target/riscv/debug.h > index f76b8f944a..d3aae619db 100644 > --- a/target/riscv/debug.h > +++ b/target/riscv/debug.h > @@ -24,8 +24,6 @@ > > #include "exec/breakpoint.h" > > -#define RV_MAX_TRIGGERS 2 > - > /* register index of tdata CSRs */ > enum { > TDATA1 = 0, > diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c > index f169eb4bba..f4dd3b48d5 100644 > --- a/target/riscv/cpu.c > +++ b/target/riscv/cpu.c > @@ -37,6 +37,9 @@ > #include "kvm/kvm_riscv.h" > #include "tcg/tcg-cpu.h" > #include "tcg/tcg.h" > +#if !defined(CONFIG_USER_ONLY) > +#include "debug.h" > +#endif > > /* RISC-V CPU definitions */ > static const char riscv_single_letter_exts[] = "IEMAFDQCBPVH"; > diff --git a/target/riscv/csr.c b/target/riscv/csr.c > index 491186d9c7..da3c24fa6b 100644 > --- a/target/riscv/csr.c > +++ b/target/riscv/csr.c > @@ -32,6 +32,9 @@ > #include "qapi/error.h" > #include "tcg/insn-start-words.h" > #include "internals.h" > +#if !defined(CONFIG_USER_ONLY) > +#include "debug.h" > +#endif > #include <stdbool.h> > > /* CSR function table public API */ > diff --git a/target/riscv/debug.c b/target/riscv/debug.c > index 5664466749..f5b2043405 100644 > --- a/target/riscv/debug.c > +++ b/target/riscv/debug.c > @@ -27,6 +27,7 @@ > #include "qemu/log.h" > #include "qapi/error.h" > #include "cpu.h" > +#include "debug.h" > #include "trace.h" > #include "exec/helper-proto.h" > #include "exec/watchpoint.h" > diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c > index db3cbc1625..f24c4128c9 100644 > --- a/target/riscv/tcg/tcg-cpu.c > +++ b/target/riscv/tcg/tcg-cpu.c > @@ -37,6 +37,7 @@ > #include "hw/boards.h" > #include "system/tcg.h" > #include "exec/icount.h" > +#include "debug.h" > #endif > > /* Hash that stores user set extensions */ > -- > 2.51.0 > >
