[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 06/11] target/riscv/cpu.c: error out if EPMP is enabled withou
From: |
Daniel Henrique Barboza |
Subject: |
[PATCH v2 06/11] target/riscv/cpu.c: error out if EPMP is enabled without PMP |
Date: |
Tue, 14 Feb 2023 16:23:51 -0300 |
Instead of silently ignoring the EPMP setting if there is no PMP
available, error out informing the user that EPMP depends on PMP
support:
$ ./qemu-system-riscv64 -cpu rv64,pmp=false,x-epmp=true
qemu-system-riscv64: Invalid configuration: EPMP requires PMP support
This will force users to pick saner options in the QEMU command line.
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
---
target/riscv/cpu.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index 272cf1a8bf..1e67e72f90 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -925,13 +925,18 @@ static void riscv_cpu_realize(DeviceState *dev, Error
**errp)
if (cpu->cfg.pmp) {
riscv_set_feature(env, RISCV_FEATURE_PMP);
+ }
+
+ if (cpu->cfg.epmp) {
+ riscv_set_feature(env, RISCV_FEATURE_EPMP);
/*
* Enhanced PMP should only be available
* on harts with PMP support
*/
- if (cpu->cfg.epmp) {
- riscv_set_feature(env, RISCV_FEATURE_EPMP);
+ if (!cpu->cfg.pmp) {
+ error_setg(errp, "Invalid configuration: EPMP requires PMP
support");
+ return;
}
}
--
2.39.1
- [PATCH v2 00/11] enable write_misa() and RISCV_FEATURE_* cleanups, Daniel Henrique Barboza, 2023/02/14
- [PATCH v2 01/11] target/riscv: do not mask unsupported QEMU extensions in write_misa(), Daniel Henrique Barboza, 2023/02/14
- [PATCH v2 02/11] target/riscv: introduce riscv_cpu_cfg(), Daniel Henrique Barboza, 2023/02/14
- [PATCH v2 03/11] target/riscv: allow users to actually write the MISA CSR, Daniel Henrique Barboza, 2023/02/14
- [PATCH v2 04/11] target/riscv: remove RISCV_FEATURE_MISA, Daniel Henrique Barboza, 2023/02/14
- [PATCH v2 05/11] target/riscv: remove RISCV_FEATURE_DEBUG, Daniel Henrique Barboza, 2023/02/14
- [PATCH v2 06/11] target/riscv/cpu.c: error out if EPMP is enabled without PMP,
Daniel Henrique Barboza <=
- [PATCH v2 07/11] target/riscv: remove RISCV_FEATURE_EPMP, Daniel Henrique Barboza, 2023/02/14
- [PATCH v2 08/11] target/riscv: remove RISCV_FEATURE_PMP, Daniel Henrique Barboza, 2023/02/14
- [PATCH v2 09/11] hw/riscv/virt.c: do not use RISCV_FEATURE_MMU in create_fdt_socket_cpus(), Daniel Henrique Barboza, 2023/02/14
- [PATCH v2 10/11] target/riscv: remove RISCV_FEATURE_MMU, Daniel Henrique Barboza, 2023/02/14
- [PATCH v2 11/11] target/riscv/cpu: remove CPUArchState::features and friends, Daniel Henrique Barboza, 2023/02/14