From: Alistair Francis <alistair23@gmail.com>
To: Anup Patel <apatel@ventanamicro.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Alistair Francis <Alistair.Francis@wdc.com>,
Sagar Karandikar <sagark@eecs.berkeley.edu>,
Atish Patra <atishp@atishpatra.org>,
Richard Henderson <richard.henderson@linaro.org>,
Anup Patel <anup@brainfault.org>,
qemu-riscv@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH 2/5] target/riscv: Update VS timer whenever htimedelta changes
Date: Mon, 31 Oct 2022 10:42:36 +1000 [thread overview]
Message-ID: <CAKmqyKOC429UT17ZmtsLNK8wyBVVOE6iFCLJLU=1_7fJ_LYX7Q@mail.gmail.com> (raw)
In-Reply-To: <20221027164743.194265-3-apatel@ventanamicro.com>
On Fri, Oct 28, 2022 at 2:52 AM Anup Patel <apatel@ventanamicro.com> wrote:
>
> The htimedelta[h] CSR has impact on the VS timer comparison so we
> should call riscv_timer_write_timecmp() whenever htimedelta changes.
>
> Fixes: 3ec0fe18a31f ("target/riscv: Add vstimecmp suppor")
> Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> target/riscv/csr.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/target/riscv/csr.c b/target/riscv/csr.c
> index 716f9d960e..4b1a608260 100644
> --- a/target/riscv/csr.c
> +++ b/target/riscv/csr.c
> @@ -2722,6 +2722,8 @@ static RISCVException read_htimedelta(CPURISCVState *env, int csrno,
> static RISCVException write_htimedelta(CPURISCVState *env, int csrno,
> target_ulong val)
> {
> + RISCVCPU *cpu = env_archcpu(env);
> +
> if (!env->rdtime_fn) {
> return RISCV_EXCP_ILLEGAL_INST;
> }
> @@ -2731,6 +2733,12 @@ static RISCVException write_htimedelta(CPURISCVState *env, int csrno,
> } else {
> env->htimedelta = val;
> }
> +
> + if (cpu->cfg.ext_sstc && env->rdtime_fn) {
> + riscv_timer_write_timecmp(cpu, env->vstimer, env->vstimecmp,
> + env->htimedelta, MIP_VSTIP);
> + }
> +
> return RISCV_EXCP_NONE;
> }
>
> @@ -2748,11 +2756,19 @@ static RISCVException read_htimedeltah(CPURISCVState *env, int csrno,
> static RISCVException write_htimedeltah(CPURISCVState *env, int csrno,
> target_ulong val)
> {
> + RISCVCPU *cpu = env_archcpu(env);
> +
> if (!env->rdtime_fn) {
> return RISCV_EXCP_ILLEGAL_INST;
> }
>
> env->htimedelta = deposit64(env->htimedelta, 32, 32, (uint64_t)val);
> +
> + if (cpu->cfg.ext_sstc && env->rdtime_fn) {
> + riscv_timer_write_timecmp(cpu, env->vstimer, env->vstimecmp,
> + env->htimedelta, MIP_VSTIP);
> + }
> +
> return RISCV_EXCP_NONE;
> }
>
> --
> 2.34.1
>
>
next prev parent reply other threads:[~2022-10-31 0:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-27 16:47 [PATCH 0/5] Nested virtualization fixes for QEMU Anup Patel
2022-10-27 16:47 ` [PATCH 1/5] target/riscv: Typo fix in sstc() predicate Anup Patel
2022-10-31 0:40 ` Alistair Francis
2022-10-27 16:47 ` [PATCH 2/5] target/riscv: Update VS timer whenever htimedelta changes Anup Patel
2022-10-31 0:42 ` Alistair Francis [this message]
2022-10-27 16:47 ` [PATCH 3/5] target/riscv: Don't clear mask in riscv_cpu_update_mip() for VSTIP Anup Patel
2022-10-31 0:44 ` Alistair Francis
2022-10-27 16:47 ` [PATCH 4/5] target/riscv: No need to re-start QEMU timer when timecmp == UINT64_MAX Anup Patel
2022-10-31 0:55 ` Alistair Francis
2022-10-31 3:49 ` Anup Patel
2022-11-02 0:10 ` Alistair Francis
2022-11-07 2:48 ` Anup Patel
2022-10-27 16:47 ` [PATCH 5/5] target/riscv: Ensure opcode is saved for all relevant instructions Anup Patel
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='CAKmqyKOC429UT17ZmtsLNK8wyBVVOE6iFCLJLU=1_7fJ_LYX7Q@mail.gmail.com' \
--to=alistair23@gmail.com \
--cc=Alistair.Francis@wdc.com \
--cc=anup@brainfault.org \
--cc=apatel@ventanamicro.com \
--cc=atishp@atishpatra.org \
--cc=palmer@dabbelt.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=sagark@eecs.berkeley.edu \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).