From: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
To: Christian <christianslima@proton.me>,
qemu-riscv@nongnu.org, qemu-devel@nongnu.org,
Palmer Dabbelt <palmer@dabbelt.com>,
Alistair Francis <alistair.francis@wdc.com>,
Weiwei Li <liwei1518@gmail.com>,
Liu Zhiwei <zhiwei_liu@linux.alibaba.com>,
Chao Liu <chao.liu@processmission.com>
Subject: Re: [PATCH v2] target/riscv/tcg: svinval instructions raise virtual instruction
Date: Fri, 11 Sep 2026 17:03:45 -0300 [thread overview]
Message-ID: <7ba0c51f-e68b-4ea9-8df7-275aa2ccadea@oss.qualcomm.com> (raw)
In-Reply-To: <UsHsyQAUZK5YOC-OaXZqSE8qAXWXiU7Vyc04UDwogGZTOENNyPKxg8yrg5xHGbHelQh2VV709xWz_gGU5WGBhYc7FcMthw4Od7m8oAhu3nE=@proton.me>
Hey,
On 9/11/2026 4:22 PM, Christian wrote:
>
> Hi,
>
>> The risc v privileged specification requires hinval.vvma, hinval.gvma,
>> sfence.w.inval and sfence.inval.ir should raise a virtual instruction
>> exception when executed in the vu-mode. This patch add the check to
>> raise the virtual instruction exception when is in the vu-mode.
>>
>> changes in v2:
>> - Remove the wrong `return true;` from macro
>>
>> Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3621
>>
>> Signed-off-by: Christian S. Lima <christianslima@proton.me>
>> ---
>> target/riscv/tcg/insn_trans/trans_svinval.c.inc | 3 +++
>> target/riscv/tcg/insn_trans/trans_xthead.c.inc | 12 +++++++-----
>> 2 files changed, 10 insertions(+), 5 deletions(-)
>>
>> diff --git a/target/riscv/tcg/insn_trans/trans_svinval.c.inc b/target/riscv/tcg/insn_trans/trans_svinval.c.inc
>> index 4614c1489c..5b1172672e 100644
>> --- a/target/riscv/tcg/insn_trans/trans_svinval.c.inc
>> +++ b/target/riscv/tcg/insn_trans/trans_svinval.c.inc
>> @@ -25,6 +25,9 @@
>> /* Test if priv level is M or S. */
>> #define REQUIRE_PRIV_MS(ctx) do { \
>> if (ctx->priv == PRV_U) { \
>> + if (ctx->virt_enabled) { \
>> + ctx->virt_inst_excp = true \
>
> I missed a `;` here and below, should I resend a v3?
Yes, please send a v3. I believe the patch as is will not compile.
Thanks,
Daniel
>> + } \
>> return false; \
>> } \
>> } while (0)
>> diff --git a/target/riscv/tcg/insn_trans/trans_xthead.c.inc b/target/riscv/tcg/insn_trans/trans_xthead.c.inc
>> index f4e3051000..4bf6594747 100644
>> --- a/target/riscv/tcg/insn_trans/trans_xthead.c.inc
>> +++ b/target/riscv/tcg/insn_trans/trans_xthead.c.inc
>> @@ -267,11 +267,13 @@ static bool trans_th_tst(DisasContext *ctx, arg_th_tst *a)
>> #define REQUIRE_PRIV_MSU(ctx)
>>
>> /* Test if priv level is M or S. */
>> -#define REQUIRE_PRIV_MS(ctx) \
>> -do { \
>> - if (ctx->priv == PRV_U) { \
>> - return false; \
>> - } \
>> +#define REQUIRE_PRIV_MS(ctx) do { \
>> + if (ctx->priv == PRV_U) { \
>> + if (ctx->virt_enabled) { \
>> + ctx->virt_inst_excp = true \
>> + } \
>> + return false; \
>> + } \
>> } while (0)
>>
>> #define NOP_PRIVCHECK(insn, extcheck, privcheck) \
>> --
>> 2.55.0
>>
>>
>
> Thanks,
> Christian
prev parent reply other threads:[~2026-09-11 20:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 19:14 [PATCH v2] target/riscv/tcg: svinval instructions raise virtual instruction Christian S. Lima
2026-09-11 19:22 ` Christian
2026-09-11 20:03 ` Daniel Henrique Barboza [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=7ba0c51f-e68b-4ea9-8df7-275aa2ccadea@oss.qualcomm.com \
--to=daniel.barboza@oss.qualcomm.com \
--cc=alistair.francis@wdc.com \
--cc=chao.liu@processmission.com \
--cc=christianslima@proton.me \
--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.