[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH for-8.1 v2 19/26] target/riscv/cpu:c add misa_ext V-> D & F depen
From: |
Daniel Henrique Barboza |
Subject: |
[PATCH for-8.1 v2 19/26] target/riscv/cpu:c add misa_ext V-> D & F dependency |
Date: |
Tue, 14 Mar 2023 13:49:41 -0300 |
We have a chained dependency in riscv_cpu_validate_set_extensions()
related to RVV. If RVV is set, we enable other extensions such as
Zve64d, Zve64f and Zve32f, and these depends on misa bits RVD and RVF.
Thus, we're making RVV depend on RVD and RVF.
Let's add this dependency in riscv_cpu_validate_misa_ext() to fail
earlier.
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
---
target/riscv/cpu.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index 83b1b874ee..fa1954a850 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -1060,6 +1060,20 @@ static void riscv_cpu_validate_misa_ext(RISCVCPU *cpu,
Error **errp)
error_setg(errp, "D extension requires F extension");
return;
}
+
+ if (cpu->cfg.ext_v) {
+ /*
+ * V depends on Zve64d, which requires D. It also
+ * depends on Zve64f, which depends on Zve32f,
+ * which requires F.
+ *
+ * This means that V depends on both D and F.
+ */
+ if (!(cpu->cfg.ext_d && cpu->cfg.ext_f)) {
+ error_setg(errp, "V extension requires D and F extensions");
+ return;
+ }
+ }
}
static void riscv_cpu_validate_misa_mxl(RISCVCPU *cpu, Error **errp)
--
2.39.2
- [PATCH for-8.1 v2 12/26] target/riscv/cpu.c: redesign register_cpu_props(), (continued)
- [PATCH for-8.1 v2 12/26] target/riscv/cpu.c: redesign register_cpu_props(), Daniel Henrique Barboza, 2023/03/14
- [PATCH for-8.1 v2 13/26] target/riscv: put env->misa_ext <-> cpu->cfg code into helpers, Daniel Henrique Barboza, 2023/03/14
- [PATCH for-8.1 v2 14/26] target/riscv: add RVG, Daniel Henrique Barboza, 2023/03/14
- [PATCH for-8.1 v2 15/26] target/riscv: do not allow RVG in write_misa(), Daniel Henrique Barboza, 2023/03/14
- [PATCH for-8.1 v2 16/26] target/riscv/cpu.c: split RVG code from validate_set_extensions(), Daniel Henrique Barboza, 2023/03/14
- [PATCH for-8.1 v2 17/26] target/riscv: write env->misa_ext* in register_generic_cpu_props(), Daniel Henrique Barboza, 2023/03/14
- [PATCH for-8.1 v2 18/26] target/risc/cpu.c: add riscv_cpu_validate_misa_ext(), Daniel Henrique Barboza, 2023/03/14
- [PATCH for-8.1 v2 19/26] target/riscv/cpu:c add misa_ext V-> D & F dependency,
Daniel Henrique Barboza <=
- [PATCH for-8.1 v2 20/26] target/riscv: move riscv_cpu_validate_v() to validate_misa_ext(), Daniel Henrique Barboza, 2023/03/14
- [PATCH for-8.1 v2 21/26] target/riscv: validate_misa_ext() now validates a misa_ext val, Daniel Henrique Barboza, 2023/03/14
- [PATCH for-8.1 v2 23/26] target/riscv: split riscv_cpu_validate_set_extensions(), Daniel Henrique Barboza, 2023/03/14
- [PATCH for-8.1 v2 22/26] target/riscv: error out on priv failure for RVH, Daniel Henrique Barboza, 2023/03/14
- [PATCH for-8.1 v2 24/26] target/riscv: use misa_ext val in riscv_cpu_validate_extensions(), Daniel Henrique Barboza, 2023/03/14
- [PATCH for-8.1 v2 25/26] target/riscv: rework write_misa(), Daniel Henrique Barboza, 2023/03/14