All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] target/riscv: make cbo helpers [ms]envcfg gating in user-mode
@ 2026-08-14  8:22 Abhigyan Kumar
  0 siblings, 0 replies; only message in thread
From: Abhigyan Kumar @ 2026-08-14  8:22 UTC (permalink / raw)
  To: qemu-riscv
  Cc: qemu-devel, Alistair Francis, Weiwei Li, Daniel Henrique Barboza,
	Liu Zhiwei, Chao Liu, Palmer Dabbelt, Abhigyan Kumar

Current implementation of check_zicbo_envcfg is wrapped in an if-else
macro that eliminates the function during compilation for user-modde.
But, the zicbo spec states that [ms]envcfg gating is to be used.

Fixes: https://gitlab.com/qemu-project/qemu/-/work_items/4107
Signed-off-by: Abhigyan Kumar <314abh@gmail.com>
---
 target/riscv/tcg/op_helper.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/target/riscv/tcg/op_helper.c b/target/riscv/tcg/op_helper.c
index ba3c7da..bc899c4 100644
--- a/target/riscv/tcg/op_helper.c
+++ b/target/riscv/tcg/op_helper.c
@@ -160,6 +160,11 @@ static void check_zicbo_envcfg(CPURISCVState *env, target_ulong envbits,
     if ((env->priv < PRV_S) && !get_field(env->senvcfg, envbits)) {
         riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, ra);
     }
+#else
+    if (!get_field(env->senvcfg, envbits) ||
+        !get_field(env->menvcfg, envbits)) {
+        riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, ra);
+    }
 #endif
 }
 
-- 
2.55.0



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-14  8:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-14  8:22 [PATCH] target/riscv: make cbo helpers [ms]envcfg gating in user-mode Abhigyan Kumar

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.