qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: liweiwei <liweiwei@iscas.ac.cn>
To: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>, qemu-devel@nongnu.org
Cc: liweiwei@iscas.ac.cn, Alistair.Francis@wdc.com,
	palmer@dabbelt.com, bin.meng@windriver.com,
	dbarboza@ventanamicro.com, qemu-riscv@nongnu.org
Subject: Re: [PATCH] target/riscv: Fix itrigger when icount is used
Date: Fri, 24 Mar 2023 21:45:27 +0800	[thread overview]
Message-ID: <b3c51b9c-fdd2-7e28-b9c6-2651e758eb87@iscas.ac.cn> (raw)
In-Reply-To: <20230324064011.976-1-zhiwei_liu@linux.alibaba.com>


On 2023/3/24 14:40, LIU Zhiwei wrote:
> When I boot a ubuntu image, QEMU output a "Bad icount read" message and exit.
> The reason is that when execute helper_mret or helper_sret, it will
> cause a call to icount_get_raw_locked (), which needs set can_do_io flag
> on cpustate.
>
> Thus we setting this flag when execute these two instructions.
>
> Signed-off-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
> ---

LGTM.

Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>

Weiwei L

>   target/riscv/insn_trans/trans_privileged.c.inc | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/target/riscv/insn_trans/trans_privileged.c.inc b/target/riscv/insn_trans/trans_privileged.c.inc
> index 59501b2780..e3bee971c6 100644
> --- a/target/riscv/insn_trans/trans_privileged.c.inc
> +++ b/target/riscv/insn_trans/trans_privileged.c.inc
> @@ -77,6 +77,9 @@ static bool trans_sret(DisasContext *ctx, arg_sret *a)
>   #ifndef CONFIG_USER_ONLY
>       if (has_ext(ctx, RVS)) {
>           decode_save_opc(ctx);
> +        if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
> +            gen_io_start();
> +        }
>           gen_helper_sret(cpu_pc, cpu_env);
>           exit_tb(ctx); /* no chaining */
>           ctx->base.is_jmp = DISAS_NORETURN;
> @@ -93,6 +96,9 @@ static bool trans_mret(DisasContext *ctx, arg_mret *a)
>   {
>   #ifndef CONFIG_USER_ONLY
>       decode_save_opc(ctx);
> +    if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
> +        gen_io_start();
> +    }
>       gen_helper_mret(cpu_pc, cpu_env);
>       exit_tb(ctx); /* no chaining */
>       ctx->base.is_jmp = DISAS_NORETURN;



  reply	other threads:[~2023-03-24 15:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-24  6:40 [PATCH] target/riscv: Fix itrigger when icount is used LIU Zhiwei
2023-03-24 13:45 ` liweiwei [this message]
2023-04-05  5:09 ` Alistair Francis
2023-04-05  5:10 ` Alistair Francis

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=b3c51b9c-fdd2-7e28-b9c6-2651e758eb87@iscas.ac.cn \
    --to=liweiwei@iscas.ac.cn \
    --cc=Alistair.Francis@wdc.com \
    --cc=bin.meng@windriver.com \
    --cc=dbarboza@ventanamicro.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 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).