* [PATCH] target/riscv: rvv: Fix missing exit TB flow for ldff_trans
@ 2025-06-27 13:30 Max Chou
2025-06-28 10:03 ` Richard Henderson
2025-06-30 0:52 ` Alistair Francis
0 siblings, 2 replies; 3+ messages in thread
From: Max Chou @ 2025-06-27 13:30 UTC (permalink / raw)
To: qemu-devel, qemu-riscv
Cc: Palmer Dabbelt, Alistair Francis, Weiwei Li,
Daniel Henrique Barboza, Liu Zhiwei, Max Chou
According to the V spec, the vector fault-only-first load instructions
may change the VL CSR.
So the ldff_trans TCG translation function should generate the
lookup_and_goto_ptr flow as the vsetvl/vsetvli translation function to
make sure the vl_eq_vlmax TB flag is correct.
Signed-off-by: Max Chou <max.chou@sifive.com>
---
target/riscv/insn_trans/trans_rvv.c.inc | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc
index 2b6077ac067..4cd030c7eb3 100644
--- a/target/riscv/insn_trans/trans_rvv.c.inc
+++ b/target/riscv/insn_trans/trans_rvv.c.inc
@@ -1361,6 +1361,12 @@ static bool ldff_trans(uint32_t vd, uint32_t rs1, uint32_t data,
fn(dest, mask, base, tcg_env, desc);
finalize_rvv_inst(s);
+
+ /* vector unit-stride fault-only-first load may modify vl CSR */
+ gen_update_pc(s, s->cur_insn_len);
+ lookup_and_goto_ptr(s);
+ s->base.is_jmp = DISAS_NORETURN;
+
return true;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] target/riscv: rvv: Fix missing exit TB flow for ldff_trans
2025-06-27 13:30 [PATCH] target/riscv: rvv: Fix missing exit TB flow for ldff_trans Max Chou
@ 2025-06-28 10:03 ` Richard Henderson
2025-06-30 0:52 ` Alistair Francis
1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2025-06-28 10:03 UTC (permalink / raw)
To: qemu-devel
On 6/27/25 06:30, Max Chou wrote:
> According to the V spec, the vector fault-only-first load instructions
> may change the VL CSR.
> So the ldff_trans TCG translation function should generate the
> lookup_and_goto_ptr flow as the vsetvl/vsetvli translation function to
> make sure the vl_eq_vlmax TB flag is correct.
>
> Signed-off-by: Max Chou <max.chou@sifive.com>
> ---
> target/riscv/insn_trans/trans_rvv.c.inc | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc
> index 2b6077ac067..4cd030c7eb3 100644
> --- a/target/riscv/insn_trans/trans_rvv.c.inc
> +++ b/target/riscv/insn_trans/trans_rvv.c.inc
> @@ -1361,6 +1361,12 @@ static bool ldff_trans(uint32_t vd, uint32_t rs1, uint32_t data,
> fn(dest, mask, base, tcg_env, desc);
>
> finalize_rvv_inst(s);
> +
> + /* vector unit-stride fault-only-first load may modify vl CSR */
> + gen_update_pc(s, s->cur_insn_len);
> + lookup_and_goto_ptr(s);
> + s->base.is_jmp = DISAS_NORETURN;
> +
> return true;
> }
>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] target/riscv: rvv: Fix missing exit TB flow for ldff_trans
2025-06-27 13:30 [PATCH] target/riscv: rvv: Fix missing exit TB flow for ldff_trans Max Chou
2025-06-28 10:03 ` Richard Henderson
@ 2025-06-30 0:52 ` Alistair Francis
1 sibling, 0 replies; 3+ messages in thread
From: Alistair Francis @ 2025-06-30 0:52 UTC (permalink / raw)
To: Max Chou
Cc: qemu-devel, qemu-riscv, Palmer Dabbelt, Alistair Francis,
Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei
On Fri, Jun 27, 2025 at 11:31 PM Max Chou <max.chou@sifive.com> wrote:
>
> According to the V spec, the vector fault-only-first load instructions
> may change the VL CSR.
> So the ldff_trans TCG translation function should generate the
> lookup_and_goto_ptr flow as the vsetvl/vsetvli translation function to
> make sure the vl_eq_vlmax TB flag is correct.
>
> Signed-off-by: Max Chou <max.chou@sifive.com>
Thanks!
Applied to riscv-to-apply.next
Alistair
> ---
> target/riscv/insn_trans/trans_rvv.c.inc | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc
> index 2b6077ac067..4cd030c7eb3 100644
> --- a/target/riscv/insn_trans/trans_rvv.c.inc
> +++ b/target/riscv/insn_trans/trans_rvv.c.inc
> @@ -1361,6 +1361,12 @@ static bool ldff_trans(uint32_t vd, uint32_t rs1, uint32_t data,
> fn(dest, mask, base, tcg_env, desc);
>
> finalize_rvv_inst(s);
> +
> + /* vector unit-stride fault-only-first load may modify vl CSR */
> + gen_update_pc(s, s->cur_insn_len);
> + lookup_and_goto_ptr(s);
> + s->base.is_jmp = DISAS_NORETURN;
> +
> return true;
> }
>
> --
> 2.43.0
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-06-30 0:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-27 13:30 [PATCH] target/riscv: rvv: Fix missing exit TB flow for ldff_trans Max Chou
2025-06-28 10:03 ` Richard Henderson
2025-06-30 0:52 ` Alistair Francis
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).