All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alistair Francis <Alistair.Francis@wdc.com>
To: "314abh@gmail.com" <314abh@gmail.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "qemu-riscv@nongnu.org" <qemu-riscv@nongnu.org>,
	"chao.liu.zevorn@gmail.com" <chao.liu.zevorn@gmail.com>,
	"daniel.barboza@oss.qualcomm.com"
	<daniel.barboza@oss.qualcomm.com>,
	"palmer@dabbelt.com" <palmer@dabbelt.com>,
	"liwei1518@gmail.com" <liwei1518@gmail.com>,
	"zhiwei_liu@linux.alibaba.com" <zhiwei_liu@linux.alibaba.com>
Subject: Re: [PATCH] target/riscv: prevent abrupt abortion on unassigned value write to tdata
Date: Thu, 3 Sep 2026 04:31:42 +0000	[thread overview]
Message-ID: <a01a324d4fe5be25d0359cc0cb44d5a8ad66bd8a.camel@wdc.com> (raw)
In-Reply-To: <20260729230028.1797355-1-314abh@gmail.com>

On Thu, 2026-07-30 at 04:30 +0530, Abhigyan Kumar wrote:
> tdata_csr_write is approachable by guest programs. In case of
> unassigned
> values written to a tdata CSR in debug mode, the switch-case falls
> through straight to default causing an immediate abort. The risc-v
> spec
> says:
> 
>     All tdata registers follow write-any-read-legal semantics. If a
> debugger
>     writes an unsupported configuration, the register will read back
> a value
>     that is supported (which may simply be a disabled trigger). This
> means
>     that a debugger must always read back values it writes to tdata
>     registers, unless it already knows what is supported.
> 
> This fix correctly ensures that the WARL behaviour of tdata CSRs.
> 
> Fixes: a42bd001 ("target/riscv: debug: Determine the trigger type
> from
> tdata1.type")
> Signed-off-by: Abhigyan Kumar <314abh@gmail.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  target/riscv/tcg/debug.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/target/riscv/tcg/debug.c b/target/riscv/tcg/debug.c
> index 3c0fe7010..ae493235d 100644
> --- a/target/riscv/tcg/debug.c
> +++ b/target/riscv/tcg/debug.c
> @@ -913,7 +913,8 @@ void tdata_csr_write(CPURISCVState *env, int
> tdata_index, target_ulong val)
>                        trigger_type);
>          break;
>      default:
> -        g_assert_not_reached();
> +        qemu_log_mask(LOG_GUEST_ERROR, "trigger type: %d is
> unassigned\n",
> +                trigger_type);
>      }
>  }
>  

  parent reply	other threads:[~2026-09-03  4:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29 23:00 [PATCH] target/riscv: prevent abrupt abortion on unassigned value write to tdata Abhigyan Kumar
2026-08-14 13:14 ` abh
2026-09-03  4:31 ` Alistair Francis [this message]
2026-09-03  4:57 ` 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=a01a324d4fe5be25d0359cc0cb44d5a8ad66bd8a.camel@wdc.com \
    --to=alistair.francis@wdc.com \
    --cc=314abh@gmail.com \
    --cc=chao.liu.zevorn@gmail.com \
    --cc=daniel.barboza@oss.qualcomm.com \
    --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.