All of lore.kernel.org
 help / color / mirror / Atom feed
From: Abhigyan Kumar <314abh@gmail.com>
To: qemu-riscv@nongnu.org
Cc: qemu-devel@nongnu.org,
	Alistair Francis <alistair.francis@wdc.com>,
	Weiwei Li <liwei1518@gmail.com>,
	Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>,
	Liu Zhiwei <zhiwei_liu@linux.alibaba.com>,
	Chao Liu <chao.liu.zevorn@gmail.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Abhigyan Kumar <314abh@gmail.com>
Subject: [PATCH] target/riscv: make cbo helpers [ms]envcfg gating in user-mode
Date: Fri, 14 Aug 2026 13:52:17 +0530	[thread overview]
Message-ID: <20260814082217.278685-1-314abh@gmail.com> (raw)

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



                 reply	other threads:[~2026-08-14  8:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260814082217.278685-1-314abh@gmail.com \
    --to=314abh@gmail.com \
    --cc=alistair.francis@wdc.com \
    --cc=chao.liu.zevorn@gmail.com \
    --cc=daniel.barboza@oss.qualcomm.com \
    --cc=liwei1518@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=zhiwei_liu@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.