@@ -996,7 +996,7 @@ static void riscv_cpu_reset_hold(Object *obj)
set_default_nan_mode(1, &env->fp_status);
#ifndef CONFIG_USER_ONLY
- if (cpu->cfg.debug) {
+ if (cpu->cfg.ext_sdtrig) {
riscv_trigger_reset_hold(env);
}
@@ -1156,7 +1156,7 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp)
riscv_cpu_register_gdb_regs_for_features(cs);
#ifndef CONFIG_USER_ONLY
- if (cpu->cfg.debug) {
+ if (cpu->cfg.ext_sdtrig) {
riscv_trigger_realize(&cpu->env);
}
#endif
@@ -1718,6 +1718,37 @@ static const PropertyInfo prop_mmu = {
.set = prop_mmu_set,
};
+static void prop_debug_set(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ RISCVCPU *cpu = RISCV_CPU(obj);
+ bool value;
+
+ warn_report("\"debug\" property is being deprecated.");
+
+ visit_type_bool(v, name, &value, errp);
+
+ if (cpu->cfg.ext_sdtrig != value && !riscv_cpu_is_dynamic(obj)) {
+ return;
+ }
+
+ cpu->cfg.ext_sdtrig = value;
+}
+
+static void prop_debug_get(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ bool value = RISCV_CPU(obj)->cfg.ext_sdtrig;
+
+ visit_type_bool(v, name, &value, errp);
+}
+
+static const PropertyInfo prop_debug = {
+ .name = "debug",
+ .get = prop_debug_get,
+ .set = prop_debug_set,
+};
+
static void prop_pmp_set(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
@@ -2229,7 +2260,7 @@ RISCVCPUProfile *riscv_profiles[] = {
};
static Property riscv_cpu_properties[] = {
- DEFINE_PROP_BOOL("debug", RISCVCPU, cfg.debug, true),
+ {.name = "debug", .info = &prop_debug}, /* Deprecated */
{.name = "pmu-mask", .info = &prop_pmu_mask},
{.name = "pmu-num", .info = &prop_pmu_num}, /* Deprecated */
@@ -113,6 +113,7 @@ struct RISCVCPUConfig {
bool ext_zvfbfwma;
bool ext_zvfh;
bool ext_zvfhmin;
+ bool ext_sdtrig;
bool ext_smaia;
bool ext_ssaia;
bool ext_sscofpmf;
@@ -148,7 +149,6 @@ struct RISCVCPUConfig {
uint16_t cboz_blocksize;
bool mmu;
bool pmp;
- bool debug;
bool misa_w;
bool short_isa_string;
@@ -129,7 +129,7 @@ void cpu_get_tb_cpu_state(CPURISCVState *env, vaddr *pc,
? EXT_STATUS_DIRTY : EXT_STATUS_DISABLED;
}
- if (cpu->cfg.debug && !icount_enabled()) {
+ if (cpu->cfg.ext_sdtrig && !icount_enabled()) {
flags = FIELD_DP32(flags, TB_FLAGS, ITRIGGER, env->itrigger_enabled);
}
#endif
@@ -546,7 +546,7 @@ static RISCVException have_mseccfg(CPURISCVState *env, int csrno)
static RISCVException debug(CPURISCVState *env, int csrno)
{
- if (riscv_cpu_cfg(env)->debug) {
+ if (riscv_cpu_cfg(env)->ext_sdtrig) {
return RISCV_EXCP_NONE;
}
@@ -230,7 +230,7 @@ static bool debug_needed(void *opaque)
{
RISCVCPU *cpu = opaque;
- return cpu->cfg.debug;
+ return cpu->cfg.ext_sdtrig;
}
static int debug_post_load(void *opaque, int version_id)
The debug property implements the ratified debug specification v0.13. This specification is superseded by (now frozen) RISC-V debug specification v1.0 It defines sdtrig ISA extension which is forward and backward comptible with the debug specification v0.13. This patch deprecates the debug property and replaces with ext_sdtrig. A deprecation warning is displayed if debug property is used. Signed-off-by: Himanshu Chauhan <hchauhan@ventanamicro.com> --- target/riscv/cpu.c | 37 ++++++++++++++++++++++++++++++++++--- target/riscv/cpu_cfg.h | 2 +- target/riscv/cpu_helper.c | 2 +- target/riscv/csr.c | 2 +- target/riscv/machine.c | 2 +- 5 files changed, 38 insertions(+), 7 deletions(-)