]> 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)
committerMichael Tokarev <mjt@tls.msk.ru>
Sat, 4 Oct 2025 07:43:45 +0000 (10:43 +0300)
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>
(cherry picked from commit ae4a37f57818e47e212272821a5a86ad54620eb8)
(Mjt: drop the MonitorDef change due to missing v10.1.0-850-ge06d209aa6 "target/riscv: implement MonitorDef HMP API")
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
target/riscv/cpu.c
target/riscv/csr.c
target/riscv/machine.c
target/riscv/tcg/tcg-cpu.c

index 09ded6829a2ccce880be2163dc2269a4f3109299..2ff56bd017d9f4982daa9fd8743c93f5cbf0dd80 100644 (file)
@@ -945,7 +945,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 66d572af1f86ec2679b0547f7c1fb0b3d138f3f4..76e2f7e1d5cc575c71d2cf83953e345074348d88 100644 (file)
@@ -1990,7 +1990,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 889e2b6570132950c25df6395794875df604cd11..0697d813b7a94a0a158524f1c5e2a141784e78bd 100644 (file)
@@ -130,7 +130,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 5aef9eef3666536708185debf3092e00c7929918..2b21580ef71d74b94cbd2fd9cf356811d9d30160 100644 (file)
@@ -515,7 +515,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);