All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] target/riscv/csr.c: Turn off mstatus.vs when misa.v is turned off
@ 2025-01-14  9:20 Evgenii Prokopiev
  2025-01-14 13:02 ` Daniel Henrique Barboza
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Evgenii Prokopiev @ 2025-01-14  9:20 UTC (permalink / raw)
  To: palmer
  Cc: alistair.francis, bmeng.cn, liwei1518, dbarboza, zhiwei_liu,
	qemu-riscv, qemu-devel, Evgenii Prokopiev

A behavior of misa.v must be similar as misa.f.
So when this bit's field is turned off, mstatus.vs must be turned off
too. It follows from the privileged manual of RISC-V, paragraph 3.1.1.
"Machine ISA (misa) Register".

Signed-off-by: Evgenii Prokopiev <evgenii.prokopiev@syntacore.com>
---
 target/riscv/csr.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target/riscv/csr.c b/target/riscv/csr.c
index eab8e50012..fca2b1b40f 100644
--- a/target/riscv/csr.c
+++ b/target/riscv/csr.c
@@ -1537,6 +1537,10 @@ static RISCVException write_misa(CPURISCVState *env, int csrno,
         env->mstatus &= ~MSTATUS_FS;
     }
 
+    if (!(env->misa_ext & RVV)) {
+        env->mstatus &= ~MSTATUS_VS;
+    }
+
     /* flush translation cache */
     tb_flush(env_cpu(env));
     env->xl = riscv_cpu_mxl(env);
-- 
2.34.1




^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-01-29  1:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-14  9:20 [PATCH] target/riscv/csr.c: Turn off mstatus.vs when misa.v is turned off Evgenii Prokopiev
2025-01-14 13:02 ` Daniel Henrique Barboza
2025-01-29  1:24 ` Alistair Francis
2025-01-29  1:28 ` Alistair Francis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.