]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
target/riscv: rvv: Replace checking V by checking Zve32x
authorMax Chou <max.chou@sifive.com>
Tue, 23 Sep 2025 09:07:28 +0000 (17:07 +0800)
committerAlistair Francis <alistair.francis@wdc.com>
Fri, 3 Oct 2025 03:15:14 +0000 (13:15 +1000)
The Zve32x extension will be applied by the V and Zve* extensions.
Therefore we can replace the original V checking with Zve32x checking for both
the V and Zve* extensions.

Signed-off-by: Max Chou <max.chou@sifive.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20250923090729.1887406-2-max.chou@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
target/riscv/cpu.c
target/riscv/csr.c
target/riscv/machine.c
target/riscv/riscv-qmp-cmds.c
target/riscv/tcg/tcg-cpu.c

index d055ddf462311e306de7ac5c55b3d113feaaf45d..a877018ab0c294d06c69c9a097e9699c1c361ec7 100644 (file)
@@ -604,7 +604,7 @@ static void riscv_cpu_dump_state(CPUState *cs, FILE *f, int flags)
             }
         }
     }
-    if (riscv_has_ext(env, RVV) && (flags & CPU_DUMP_VPU)) {
+    if (riscv_cpu_cfg(env)->ext_zve32x && (flags & CPU_DUMP_VPU)) {
         static const int dump_rvv_csrs[] = {
                     CSR_VSTART,
                     CSR_VXSAT,
index ea36eccb3dc9d8d6c76322299425d271ffb3f808..5c91658c3dc412c6f0e6db89120b935b4c0ea6cf 100644 (file)
@@ -2005,7 +2005,8 @@ static RISCVException write_mstatus(CPURISCVState *env, int csrno,
     if (riscv_has_ext(env, RVF)) {
         mask |= MSTATUS_FS;
     }
-    if (riscv_has_ext(env, RVV)) {
+
+    if (riscv_cpu_cfg(env)->ext_zve32x) {
         mask |= MSTATUS_VS;
     }
 
index 51e0567ed30cbab5e791ea904165bc1854709192..18d790af0d0730ecbf4ef1d3996c3a7b3cce73b7 100644 (file)
@@ -131,7 +131,8 @@ static bool vector_needed(void *opaque)
     RISCVCPU *cpu = opaque;
     CPURISCVState *env = &cpu->env;
 
-    return riscv_has_ext(env, RVV);
+    return kvm_enabled() ? riscv_has_ext(env, RVV) :
+                           riscv_cpu_cfg(env)->ext_zve32x;
 }
 
 static const VMStateDescription vmstate_vector = {
index b63de8dd457aa789f7783c2b650f36534118c76f..c499f9b9a7d6b99d4e9536af67b80b26ec83b3c9 100644 (file)
@@ -342,7 +342,7 @@ int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval)
     }
 
     if (reg_is_vreg(name)) {
-        if (!riscv_has_ext(env, RVV)) {
+        if (!riscv_cpu_cfg(env)->ext_zve32x) {
             return -EINVAL;
         }
 
index 143ab079d49bf19247b45f3ceb50639cb5819888..b3b7f14503a653a1b39a9c36aa3cdb278e5aaa30 100644 (file)
@@ -661,7 +661,7 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)
         return;
     }
 
-    if (riscv_has_ext(env, RVV)) {
+    if (cpu->cfg.ext_zve32x) {
         riscv_cpu_validate_v(env, &cpu->cfg, &local_err);
         if (local_err != NULL) {
             error_propagate(errp, local_err);