From 9ba63f9442067729c3fe41c88b1eb414874d46ea Mon Sep 17 00:00:00 2001 From: Weiwei Li Date: Sat, 8 Apr 2023 21:59:08 +0800 Subject: [PATCH] target/riscv: Use check for relationship between Zdinx/Zhinx{min} and Zfinx Zdinx/Zhinx{min} require Zfinx. And require relationship is usually done by check currently. Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang Acked-by: Alistair Francis Message-Id: <20230408135908.25269-1-liweiwei@iscas.ac.cn> Signed-off-by: Alistair Francis --- 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 d1769fd218..fab38859ec 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -916,8 +916,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) {