All of lore.kernel.org
 help / color / mirror / Atom feed
From: Abhigyan Kumar <314abh@gmail.com>
To: qemu-devel@nongnu.org
Cc: qemu-riscv@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: fix invalid sstc predicate in gdbstub
Date: Sat, 30 May 2026 11:02:00 +0530	[thread overview]
Message-ID: <20260530053200.902591-1-314abh@gmail.com> (raw)

sstc function incorrectly checks for avaibility of env->rdtime_fn.
This causes it to fail each time it's called because rdtime_fn is setup
later in the procedure (when timer devices are created). This prevents
stimecmp's addition to gdb.

This change ensures only the riscv_cpu_cfg(env) check is done. rdtime_fn
will always be NULL otherwise and fail.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3496
Signed-off-by: Abhigyan Kumar <314abh@gmail.com>
---
 target/riscv/csr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/riscv/csr.c b/target/riscv/csr.c
index f5b0895fd..d72df945f 100644
--- a/target/riscv/csr.c
+++ b/target/riscv/csr.c
@@ -590,7 +590,7 @@ static RISCVException sstc(CPURISCVState *env, int csrno)
 {
     bool hmode_check = false;
 
-    if (!riscv_cpu_cfg(env)->ext_sstc || !env->rdtime_fn) {
+    if (!riscv_cpu_cfg(env)->ext_sstc) {
         return RISCV_EXCP_ILLEGAL_INST;
     }
 
-- 
2.54.0



             reply	other threads:[~2026-05-30  5:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-30  5:32 Abhigyan Kumar [this message]
2026-05-31 20:21 ` [PATCH] target/riscv: fix invalid sstc predicate in gdbstub Daniel Henrique Barboza
2026-08-14 13:12 ` abh

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=20260530053200.902591-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.