From: "Radim Krčmář" <rkrcmar@ventanamicro.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 <dbarboza@ventanamicro.com>,
Liu Zhiwei <zhiwei_liu@linux.alibaba.com>,
Atish Patra <atishp@rivosinc.com>
Subject: [PATCH 2/2] target/riscv: disarm timer when writing past value
Date: Mon, 23 Jun 2025 18:53:29 +0200 [thread overview]
Message-ID: <20250623165329.2759651-3-rkrcmar@ventanamicro.com> (raw)
In-Reply-To: <20250623165329.2759651-1-rkrcmar@ventanamicro.com>
There is no need to keep the timer running when writing a past value to
the *stimecmp. The behavior was correct before, but I think it makes a
bit more sense like this.
Signed-off-by: Radim Krčmář <rkrcmar@ventanamicro.com>
---
target/riscv/time_helper.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/target/riscv/time_helper.c b/target/riscv/time_helper.c
index 8198a2d8d92d..81a6a6394502 100644
--- a/target/riscv/time_helper.c
+++ b/target/riscv/time_helper.c
@@ -64,6 +64,8 @@ void riscv_timer_write_timecmp(CPURISCVState *env, QEMUTimer *timer,
* If we're setting an stimecmp value in the "past",
* immediately raise the timer interrupt
*/
+ timer_del(timer);
+
if (timer_irq == MIP_VSTIP) {
env->vstime_irq = 1;
riscv_cpu_update_mip(env, 0, BOOL_TO_MASK(1));
--
2.49.0
prev parent reply other threads:[~2025-06-23 16:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-23 16:53 [PATCH 0/2] riscv: fix envcfg.STCE Radim Krčmář
2025-06-23 16:53 ` [PATCH 1/2] target/riscv: disable *stimecmp interrupts without *envcfg.STCE Radim Krčmář
2025-06-23 21:39 ` Daniel Henrique Barboza
2025-06-24 12:48 ` Andrew Jones
2025-06-24 13:48 ` Radim Krčmář
2025-06-25 6:24 ` Jim Shu
2025-06-25 7:26 ` Radim Krčmář
2025-06-23 16:53 ` Radim Krčmář [this message]
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=20250623165329.2759651-3-rkrcmar@ventanamicro.com \
--to=rkrcmar@ventanamicro.com \
--cc=alistair.francis@wdc.com \
--cc=atishp@rivosinc.com \
--cc=dbarboza@ventanamicro.com \
--cc=liwei1518@gmail.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.