qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alistair Francis <alistair23@gmail.com>
To: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Cc: qemu-devel@nongnu.org, Alistair.Francis@wdc.com,
	palmer@dabbelt.com,  bin.meng@windriver.com, liwei1518@gmail.com,
	dbarboza@ventanamicro.com,  qemu-riscv@nongnu.org
Subject: Re: [PATCH 1/1] target/riscv: Not allow write mstatus_vs without RVV
Date: Mon, 18 Dec 2023 08:46:33 +1000	[thread overview]
Message-ID: <CAKmqyKNzqXSSWN19MCuDKjWpaHxvbP29gkPK4E1QLW4ebkPeog@mail.gmail.com> (raw)
In-Reply-To: <20231215023313.1708-1-zhiwei_liu@linux.alibaba.com>

On Fri, Dec 15, 2023 at 12:34 PM LIU Zhiwei
<zhiwei_liu@linux.alibaba.com> wrote:
>
> If CPU does not implement the Vector extension, it usually means
> mstatus vs hardwire to zero. So we should not allow write a
> non-zero value to this field.
>
> Signed-off-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>

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

Alistair

> ---
>  target/riscv/csr.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/target/riscv/csr.c b/target/riscv/csr.c
> index fde7ce1a53..d1de6b2390 100644
> --- a/target/riscv/csr.c
> +++ b/target/riscv/csr.c
> @@ -1328,11 +1328,14 @@ static RISCVException write_mstatus(CPURISCVState *env, int csrno,
>      mask = MSTATUS_SIE | MSTATUS_SPIE | MSTATUS_MIE | MSTATUS_MPIE |
>          MSTATUS_SPP | MSTATUS_MPRV | MSTATUS_SUM |
>          MSTATUS_MPP | MSTATUS_MXR | MSTATUS_TVM | MSTATUS_TSR |
> -        MSTATUS_TW | MSTATUS_VS;
> +        MSTATUS_TW;
>
>      if (riscv_has_ext(env, RVF)) {
>          mask |= MSTATUS_FS;
>      }
> +    if (riscv_has_ext(env, RVV)) {
> +        mask |= MSTATUS_VS;
> +    }
>
>      if (xl != MXL_RV32 || env->debugger) {
>          if (riscv_has_ext(env, RVH)) {
> --
> 2.25.1
>
>


  reply	other threads:[~2023-12-17 22:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15  2:33 [PATCH 1/1] target/riscv: Not allow write mstatus_vs without RVV LIU Zhiwei
2023-12-17 22:46 ` Alistair Francis [this message]
2023-12-17 22:54 ` 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=CAKmqyKNzqXSSWN19MCuDKjWpaHxvbP29gkPK4E1QLW4ebkPeog@mail.gmail.com \
    --to=alistair23@gmail.com \
    --cc=Alistair.Francis@wdc.com \
    --cc=bin.meng@windriver.com \
    --cc=dbarboza@ventanamicro.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 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).