[PATCH] target/riscv/cpu.c: Fix elen check

Elta posted 1 patch 1 year, 4 months ago
Failed in applying to current master (apply log)
 target/riscv/cpu.c | 2 +-
[PATCH] target/riscv/cpu.c: Fix elen check
Posted by Elta 1 year, 4 months ago
Should be cpu->cfg.elen in range [8, 64].


Signed-off-by: Dongxue Zhang <elta.era@gmail.com&gt;
---
&nbsp;target/riscv/cpu.c | 2 +-
&nbsp;1 file changed, 1 insertion(+), 1 deletion(-)


diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index d14e95c9dc..1e8032c969 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -870,7 +870,7 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"Vector extension ELEN must be power of 2");
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (cpu-&gt;cfg.elen &gt; 64 || cpu-&gt;cfg.vlen < 8) {
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (cpu-&gt;cfg.elen &gt; 64 || cpu-&gt;cfg.elen < 8) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;error_setg(errp,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"Vector extension implementation only supports ELEN "
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"in the range [8, 64]");
--&nbsp;
2.17.1
Re: [PATCH] target/riscv/cpu.c: Fix elen check
Posted by Alistair Francis 1 year, 4 months ago
On Fri, Dec 16, 2022 at 1:10 AM Elta <503386372@qq.com> wrote:
>
> Should be cpu->cfg.elen in range [8, 64].
>
> Signed-off-by: Dongxue Zhang <elta.era@gmail.com>

Thanks for the patch!

I'm seeing weird formatting issues though, it looks like the encoding
is incorrect.

Did you use `git send-email` to send the patch? If not can you try
sending it again following the instructions here
https://www.qemu.org/docs/master/devel/submitting-a-patch.html#submitting-your-patches

Alistair

> ---
>  target/riscv/cpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> index d14e95c9dc..1e8032c969 100644
> --- a/target/riscv/cpu.c
> +++ b/target/riscv/cpu.c
> @@ -870,7 +870,7 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp)
>                          "Vector extension ELEN must be power of 2");
>                  return;
>              }
> -            if (cpu->cfg.elen > 64 || cpu->cfg.vlen < 8) {
> +            if (cpu->cfg.elen > 64 || cpu->cfg.elen < 8) {
>                  error_setg(errp,
>                          "Vector extension implementation only supports ELEN "
>                          "in the range [8, 64]");
> --
> 2.17.1
>
Re: [PATCH] target/riscv/cpu.c: Fix elen check
Posted by Frank Chang 1 year, 4 months ago
Reviewed-by: Frank Chang <frank.chang@sifive.com>

On Thu, Dec 15, 2022 at 11:09 PM Elta <503386372@qq.com> wrote:

> Should be cpu->cfg.elen in range [8, 64].
>
> Signed-off-by: Dongxue Zhang <elta.era@gmail.com>
> ---
>  target/riscv/cpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> index d14e95c9dc..1e8032c969 100644
> --- a/target/riscv/cpu.c
> +++ b/target/riscv/cpu.c
> @@ -870,7 +870,7 @@ static void riscv_cpu_realize(DeviceState *dev, Error
> **errp)
>                          "Vector extension ELEN must be power of 2");
>                  return;
>              }
> -            if (cpu->cfg.elen > 64 || cpu->cfg.vlen < 8) {
> +            if (cpu->cfg.elen > 64 || cpu->cfg.elen < 8) {
>                  error_setg(errp,
>                          "Vector extension implementation only supports
> ELEN "
>                          "in the range [8, 64]");
> --
> 2.17.1
>
>
Re: [PATCH] target/riscv/cpu.c: Fix elen check
Posted by LIU Zhiwei 1 year, 4 months ago
On 2022/12/15 16:46, Elta wrote:
> Should be cpu->cfg.elen in range [8, 64].
>
> Signed-off-by: Dongxue Zhang <elta.era@gmail.com>
> ---
>  target/riscv/cpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> index d14e95c9dc..1e8032c969 100644
> --- a/target/riscv/cpu.c
> +++ b/target/riscv/cpu.c
> @@ -870,7 +870,7 @@ static void riscv_cpu_realize(DeviceState *dev, 
> Error **errp)
>                          "Vector extension ELEN must be power of 2");
>                  return;
>              }
> -            if (cpu->cfg.elen > 64 || cpu->cfg.vlen < 8) {
> +            if (cpu->cfg.elen > 64 || cpu->cfg.elen < 8) {

Oops. You are right.

Reviewed-by: LIU Zhiwei <zhiwe_liu@linux.alibaba.com>

Zhiwei

>                  error_setg(errp,
>                          "Vector extension implementation only 
> supports ELEN "
>                          "in the range [8, 64]");
> -- 
> 2.17.1
>