@samitouri / QOSamiQemu / commits / 7f69296d8e

target/riscv: do not set defaults in cpu prop callback

Do not rely on riscv_cpu_* arrays to set rv32/rv64 CPU defaults - add them to the CPU definition like we do with all other CPUs (aside from 'max'). Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com> Acked-by: Alistair Francis <alistair.francis@wdc.com> Message-ID: <20260512032926.1978818-13-daniel.barboza@oss.qualcomm.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

Daniel Henrique Barboza committed May 12, 2026 at 00:29 UTC 7f69296d8e84c967642a7795f86c8da86f05d0dc
2 files changed +40 -14
target/riscv/cpu.c
+40
@@ -3076,6 +3076,26 @@ static const TypeInfo riscv_cpu_type_infos[] = {
3076 DEFINE_RISCV_CPU(TYPE_RISCV_CPU_BASE32, TYPE_RISCV_DYNAMIC_CPU,
3077 .cfg.max_satp_mode = VM_1_10_SV32,
3078 .misa_mxl_max = MXL_RV32,
3079 +
3080 + /* Default extensions as of QEMU 11.1. */
3081 + .cfg.ext_zicbom = true,
3082 + .cfg.ext_zicbop = true,
3083 + .cfg.ext_zicboz = true,
3084 + .cfg.ext_zicntr = true,
3085 + .cfg.ext_zicsr = true,
3086 + .cfg.ext_zifencei = true,
3087 + .cfg.ext_zihintntl = true,
3088 + .cfg.ext_zihintpause = true,
3089 + .cfg.ext_zihpm = true,
3090 + .cfg.ext_zawrs = true,
3091 + .cfg.ext_zfa = true,
3092 + .cfg.ext_zba = true,
3093 + .cfg.ext_zbb = true,
3094 + .cfg.ext_zbc = true,
3095 + .cfg.ext_zbs = true,
3096 + .cfg.ext_sstc = true,
3097 + .cfg.ext_svadu = true,
3098 + .cfg.ext_svvptc = true,
3099 ),
3100
3101 DEFINE_RISCV_CPU(TYPE_RISCV_CPU_IBEX, TYPE_RISCV_VENDOR_CPU,
@@ -3128,6 +3148,26 @@ static const TypeInfo riscv_cpu_type_infos[] = {
3148 DEFINE_RISCV_CPU(TYPE_RISCV_CPU_BASE64, TYPE_RISCV_DYNAMIC_CPU,
3149 .cfg.max_satp_mode = VM_1_10_SV57,
3150 .misa_mxl_max = MXL_RV64,
3151 +
3152 + /* Default extensions as of QEMU 11.1. */
3153 + .cfg.ext_zicbom = true,
3154 + .cfg.ext_zicbop = true,
3155 + .cfg.ext_zicboz = true,
3156 + .cfg.ext_zicntr = true,
3157 + .cfg.ext_zicsr = true,
3158 + .cfg.ext_zifencei = true,
3159 + .cfg.ext_zihintntl = true,
3160 + .cfg.ext_zihintpause = true,
3161 + .cfg.ext_zihpm = true,
3162 + .cfg.ext_zawrs = true,
3163 + .cfg.ext_zfa = true,
3164 + .cfg.ext_zba = true,
3165 + .cfg.ext_zbb = true,
3166 + .cfg.ext_zbc = true,
3167 + .cfg.ext_zbs = true,
3168 + .cfg.ext_sstc = true,
3169 + .cfg.ext_svadu = true,
3170 + .cfg.ext_svvptc = true,
3171 ),
3172
3173 DEFINE_RISCV_CPU(TYPE_RISCV_CPU_SIFIVE_E51, TYPE_RISCV_CPU_SIFIVE_E,
target/riscv/tcg/tcg-cpu.c
-14
@@ -1553,24 +1553,10 @@ static void cpu_get_multi_ext_cfg(Object *obj, Visitor *v, const char *name,
1553 static void cpu_add_multi_ext_prop(Object *cpu_obj,
1554 const RISCVCPUMultiExtConfig *multi_cfg)
1555 {
1556 - bool generic_cpu = riscv_cpu_is_generic(cpu_obj);
1557 -
1556 object_property_add(cpu_obj, multi_cfg->name, "bool",
1557 cpu_get_multi_ext_cfg,
1558 cpu_set_multi_ext_cfg,
1559 NULL, (void *)&multi_cfg->offset);
1562 -
1563 - if (!generic_cpu) {
1564 - return;
1565 - }
1566 -
1567 - /*
1568 - * Set def val directly instead of using
1569 - * object_property_set_bool() to save the set()
1570 - * callback hash for user inputs.
1571 - */
1572 - isa_ext_update_enabled(RISCV_CPU(cpu_obj), multi_cfg->offset,
1573 - multi_cfg->enabled);
1560 }
1561
1562 static void riscv_cpu_add_multiext_prop_array(Object *obj,