diff mbox series

target/riscv: Use check for relationship between Zdinx/Zhinx{min} and Zfinx

Message ID 20230408135908.25269-1-liweiwei@iscas.ac.cn (mailing list archive)
State New, archived
Headers show
Series target/riscv: Use check for relationship between Zdinx/Zhinx{min} and Zfinx | expand

Commit Message

Weiwei Li April 8, 2023, 1:59 p.m. UTC
Zdinx/Zhinx{min} require Zfinx. And require relationship is usually done
by check currently.

Signed-off-by: Weiwei Li <liweiwei@iscas.ac.cn>
Signed-off-by: Junqiang Wang <wangjunqiang@iscas.ac.cn>
---
 target/riscv/cpu.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Alistair Francis April 11, 2023, 5:42 a.m. UTC | #1
On Sun, Apr 9, 2023 at 12:00 AM Weiwei Li <liweiwei@iscas.ac.cn> wrote:
>
> Zdinx/Zhinx{min} require Zfinx. And require relationship is usually done
> by check currently.
>
> Signed-off-by: Weiwei Li <liweiwei@iscas.ac.cn>
> Signed-off-by: Junqiang Wang <wangjunqiang@iscas.ac.cn>

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

Alistair

> ---
>  target/riscv/cpu.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> index 1a5099382c..35bee8ff42 100644
> --- a/target/riscv/cpu.c
> +++ b/target/riscv/cpu.c
> @@ -930,8 +930,9 @@ static void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)
>          cpu->cfg.ext_zhinxmin = true;
>      }
>
> -    if (cpu->cfg.ext_zdinx || cpu->cfg.ext_zhinxmin) {
> -        cpu->cfg.ext_zfinx = true;
> +    if ((cpu->cfg.ext_zdinx || cpu->cfg.ext_zhinxmin) && !cpu->cfg.ext_zfinx) {
> +        error_setg(errp, "Zdinx/Zhinx/Zhinxmin extensions require Zfinx");
> +        return;
>      }
>
>      if (cpu->cfg.ext_zfinx) {
> --
> 2.25.1
>
>
Alistair Francis April 11, 2023, 7:50 a.m. UTC | #2
On Sun, Apr 9, 2023 at 12:00 AM Weiwei Li <liweiwei@iscas.ac.cn> wrote:
>
> Zdinx/Zhinx{min} require Zfinx. And require relationship is usually done
> by check currently.
>
> Signed-off-by: Weiwei Li <liweiwei@iscas.ac.cn>
> Signed-off-by: Junqiang Wang <wangjunqiang@iscas.ac.cn>

Thanks!

Applied to riscv-to-apply.next

Alistair

> ---
>  target/riscv/cpu.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> index 1a5099382c..35bee8ff42 100644
> --- a/target/riscv/cpu.c
> +++ b/target/riscv/cpu.c
> @@ -930,8 +930,9 @@ static void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)
>          cpu->cfg.ext_zhinxmin = true;
>      }
>
> -    if (cpu->cfg.ext_zdinx || cpu->cfg.ext_zhinxmin) {
> -        cpu->cfg.ext_zfinx = true;
> +    if ((cpu->cfg.ext_zdinx || cpu->cfg.ext_zhinxmin) && !cpu->cfg.ext_zfinx) {
> +        error_setg(errp, "Zdinx/Zhinx/Zhinxmin extensions require Zfinx");
> +        return;
>      }
>
>      if (cpu->cfg.ext_zfinx) {
> --
> 2.25.1
>
>
diff mbox series

Patch

diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index 1a5099382c..35bee8ff42 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -930,8 +930,9 @@  static void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)
         cpu->cfg.ext_zhinxmin = true;
     }
 
-    if (cpu->cfg.ext_zdinx || cpu->cfg.ext_zhinxmin) {
-        cpu->cfg.ext_zfinx = true;
+    if ((cpu->cfg.ext_zdinx || cpu->cfg.ext_zhinxmin) && !cpu->cfg.ext_zfinx) {
+        error_setg(errp, "Zdinx/Zhinx/Zhinxmin extensions require Zfinx");
+        return;
     }
 
     if (cpu->cfg.ext_zfinx) {