qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Nutty Liu" <liujingqi@lanxincomputing.com>
To: "Max Chou" <max.chou@sifive.com>, <qemu-devel@nongnu.org>,
	 <qemu-riscv@nongnu.org>
Cc: "Palmer Dabbelt" <palmer@dabbelt.com>,
	 "Alistair Francis" <alistair.francis@wdc.com>,
	 "Weiwei Li" <liwei1518@gmail.com>,
	 "Daniel Henrique Barboza" <dbarboza@ventanamicro.com>,
	 "Liu Zhiwei" <zhiwei_liu@linux.alibaba.com>
Subject: Re: [PATCH] target/riscv: rvv: Minimum VLEN needs to respect V/Zve extensions
Date: Tue, 1 Jul 2025 12:11:05 +0800	[thread overview]
Message-ID: <4dc2ea0e-5869-4913-9cde-bb8e40705ca3@lanxincomputing.com> (raw)
In-Reply-To: <20250627132156.440214-1-max.chou@sifive.com>

On 6/27/2025 9:21 PM, Max Chou wrote:
> According to the RISC-V instruction set manual, the minimum VLEN needs
> to respect the following extensions:
>
>    Extension     Minimum VLEN
> * V             128
> * Zve64[d|f|x]   64
> * Zve32[f|x]     32
>
> Signed-off-by: Max Chou <max.chou@sifive.com>
> ---
>   target/riscv/tcg/tcg-cpu.c | 13 +++++++++++--
>   1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c
> index 163e7ce3642..187534009dd 100644
> --- a/target/riscv/tcg/tcg-cpu.c
> +++ b/target/riscv/tcg/tcg-cpu.c
> @@ -416,12 +416,21 @@ static void riscv_cpu_validate_misa_priv(CPURISCVState *env, Error **errp)
>   static void riscv_cpu_validate_v(CPURISCVState *env, RISCVCPUConfig *cfg,
>                                    Error **errp)
>   {
> +    uint32_t min_vlen;
>       uint32_t vlen = cfg->vlenb << 3;
>   
> -    if (vlen > RV_VLEN_MAX || vlen < 128) {
> +    if (riscv_has_ext(env, RVV)) {
> +        min_vlen = 128;
> +    } else if (cfg->ext_zve64x) {
> +        min_vlen = 64;
> +    } else if (cfg->ext_zve32x) {
> +        min_vlen = 32;
> +    }
> +
> +    if (vlen > RV_VLEN_MAX || vlen < min_vlen) {
>           error_setg(errp,
>                      "Vector extension implementation only supports VLEN "
> -                   "in the range [128, %d]", RV_VLEN_MAX);
> +                   "in the range [%d, %d]", min_vlen, RV_VLEN_MAX);
>           return;
>       }
>   

Reviewed-by: Nutty Liu<liujingqi@lanxincomputing.com>

Thanks,
Nutty


  reply	other threads:[~2025-07-01  4:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-27 13:21 [PATCH] target/riscv: rvv: Minimum VLEN needs to respect V/Zve extensions Max Chou
2025-07-01  4:11 ` Nutty Liu [this message]
2025-07-02 14:48 ` Daniel Henrique Barboza
2025-07-07 10:37   ` Max Chou

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=4dc2ea0e-5869-4913-9cde-bb8e40705ca3@lanxincomputing.com \
    --to=liujingqi@lanxincomputing.com \
    --cc=alistair.francis@wdc.com \
    --cc=dbarboza@ventanamicro.com \
    --cc=liwei1518@gmail.com \
    --cc=max.chou@sifive.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).