RISCVMXL mlx = MXL_RV64;
cpu->cfg.mmu = true;
+ cpu->cfg.pmp = true;
#ifdef TARGET_RISCV32
mlx = MXL_RV32;
CPURISCVState *env = &cpu->env;
cpu->cfg.mmu = true;
+ cpu->cfg.pmp = true;
/* We set this in the realise function */
riscv_cpu_set_misa(env, MXL_RV64, 0);
}
cpu->cfg.mmu = true;
+ cpu->cfg.pmp = true;
/* We set this in the realise function */
riscv_cpu_set_misa(env, MXL_RV128, 0);
CPURISCVState *env = &cpu->env;
cpu->cfg.mmu = true;
+ cpu->cfg.pmp = true;
/* We set this in the realise function */
riscv_cpu_set_misa(env, MXL_RV32, 0);
.set = prop_mmu_set,
};
-Property riscv_cpu_options[] = {
- DEFINE_PROP_BOOL("pmp", RISCVCPU, cfg.pmp, true),
+static void prop_pmp_set(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ RISCVCPU *cpu = RISCV_CPU(obj);
+ bool value;
+
+ visit_type_bool(v, name, &value, errp);
+ if (cpu->cfg.pmp != value && riscv_cpu_is_vendor(obj)) {
+ cpu_set_prop_err(cpu, name, errp);
+ return;
+ }
+
+ cpu_option_add_user_setting(name, value);
+ cpu->cfg.pmp = value;
+}
+
+static void prop_pmp_get(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ bool value = RISCV_CPU(obj)->cfg.pmp;
+
+ visit_type_bool(v, name, &value, errp);
+}
+
+static const PropertyInfo prop_pmp = {
+ .name = "pmp",
+ .get = prop_pmp_get,
+ .set = prop_pmp_set,
+};
+
+Property riscv_cpu_options[] = {
DEFINE_PROP_STRING("priv_spec", RISCVCPU, cfg.priv_spec),
DEFINE_PROP_STRING("vext_spec", RISCVCPU, cfg.vext_spec),
{.name = "pmu-num", .info = &prop_pmu_num}, /* Deprecated */
{.name = "mmu", .info = &prop_mmu},
+ {.name = "pmp", .info = &prop_pmp},
#ifndef CONFIG_USER_ONLY
DEFINE_PROP_UINT64("resetvec", RISCVCPU, env.resetvec, DEFAULT_RSTVEC),