[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH for-8.1 v3 07/26] target/riscv: move pmp and epmp validations to
From: |
Daniel Henrique Barboza |
Subject: |
[PATCH for-8.1 v3 07/26] target/riscv: move pmp and epmp validations to validate_set_extensions() |
Date: |
Sat, 18 Mar 2023 17:04:17 -0300 |
In the near future, write_misa() will use a variation of what we have
now as riscv_cpu_validate_set_extensions(). The pmp and epmp validation
will be required in write_misa() and it's already required here in
riscv_cpu_realize(), so move it to riscv_cpu_validate_set_extensions().
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
---
target/riscv/cpu.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index 1a298e5e55..7458845fec 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -916,6 +916,15 @@ static void riscv_cpu_validate_set_extensions(RISCVCPU
*cpu, Error **errp)
Error *local_err = NULL;
uint32_t ext = 0;
+ if (cpu->cfg.epmp && !cpu->cfg.pmp) {
+ /*
+ * Enhanced PMP should only be available
+ * on harts with PMP support
+ */
+ error_setg(errp, "Invalid configuration: EPMP requires PMP support");
+ return;
+ }
+
/* Do some ISA extension error checking */
if (cpu->cfg.ext_g && !(cpu->cfg.ext_i && cpu->cfg.ext_m &&
cpu->cfg.ext_a && cpu->cfg.ext_f &&
@@ -1228,16 +1237,6 @@ static void riscv_cpu_realize(DeviceState *dev, Error
**errp)
return;
}
- if (cpu->cfg.epmp && !cpu->cfg.pmp) {
- /*
- * Enhanced PMP should only be available
- * on harts with PMP support
- */
- error_setg(errp, "Invalid configuration: EPMP requires PMP support");
- return;
- }
-
-
#ifndef CONFIG_USER_ONLY
if (cpu->cfg.ext_sstc) {
riscv_timer_init(cpu);
--
2.39.2
- [PATCH for-8.1 v3 01/26] target/riscv/cpu.c: add riscv_cpu_validate_v(), (continued)
- [PATCH for-8.1 v3 01/26] target/riscv/cpu.c: add riscv_cpu_validate_v(), Daniel Henrique Barboza, 2023/03/18
- [PATCH for-8.1 v3 02/26] target/riscv/cpu.c: remove set_vext_version(), Daniel Henrique Barboza, 2023/03/18
- [PATCH for-8.1 v3 03/26] target/riscv/cpu.c: remove set_priv_version(), Daniel Henrique Barboza, 2023/03/18
- [PATCH for-8.1 v3 04/26] target/riscv: add PRIV_VERSION_LATEST, Daniel Henrique Barboza, 2023/03/18
- [PATCH for-8.1 v3 05/26] target/riscv/cpu.c: add priv_spec validate/disable_exts helpers, Daniel Henrique Barboza, 2023/03/18
- [PATCH for-8.1 v3 06/26] target/riscv/cpu.c: add riscv_cpu_validate_misa_mxl(), Daniel Henrique Barboza, 2023/03/18
- [PATCH for-8.1 v3 07/26] target/riscv: move pmp and epmp validations to validate_set_extensions(),
Daniel Henrique Barboza <=
- [PATCH for-8.1 v3 08/26] target/riscv/cpu.c: validate extensions before riscv_timer_init(), Daniel Henrique Barboza, 2023/03/18
- [PATCH for-8.1 v3 09/26] target/riscv/cpu.c: remove cfg setup from riscv_cpu_init(), Daniel Henrique Barboza, 2023/03/18
- [PATCH for-8.1 v3 10/26] target/riscv/cpu.c: avoid set_misa() in validate_set_extensions(), Daniel Henrique Barboza, 2023/03/18
- [PATCH for-8.1 v3 11/26] target/riscv/cpu.c: set cpu config in set_misa(), Daniel Henrique Barboza, 2023/03/18
- [PATCH for-8.1 v3 12/26] target/riscv/cpu.c: redesign register_cpu_props(), Daniel Henrique Barboza, 2023/03/18
- [PATCH for-8.1 v3 13/26] target/riscv: put env->misa_ext <-> cpu->cfg code into helpers, Daniel Henrique Barboza, 2023/03/18
- [PATCH for-8.1 v3 14/26] target/riscv: add RVG, Daniel Henrique Barboza, 2023/03/18
- [PATCH for-8.1 v3 15/26] target/riscv/cpu.c: split RVG code from validate_set_extensions(), Daniel Henrique Barboza, 2023/03/18