target/riscv: Fixes for Ibex and OpenTitan
cover target/riscv: Fixes for Ibex and OpenTitan
From: Alistair Francis <[email protected]>
This fixes some issues discovered on the Ibex SoC when running OpenTitan tests.
Alistair Francis (2):
target/riscv: Fixup MSECCFG minimum priv check
target/riscv: Ibex: Support priv version 1.11
target/riscv/cpu.c | 2 +- target/riscv/csr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.36.1
PATCH 1/2 target/riscv: Fixup MSECCFG minimum priv check
From: Alistair Francis <[email protected]>
There is nothing in the RISC-V spec that mandates version 1.12 is required for ePMP and there is currently hardware [1] that implements ePMP (a draft version though) with the 1.11 priv spec.
1: https://ibex-core.readthedocs.io/en/latest/01_overview/compliance.html
--- target/riscv/csr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/riscv/csr.c +1 -1
@@ -3561,7 +3561,7 @@ riscv_csr_operations csr_ops[CSR_TABLE_SIZE] = { /* Physical Memory Protection */ [CSR_MSECCFG] = { "mseccfg", epmp, read_mseccfg, write_mseccfg, - .min_priv_ver = PRIV_VERSION_1_12_0 }, + .min_priv_ver = PRIV_VERSION_1_11_0 }, [CSR_PMPCFG0] = { "pmpcfg0", pmp, read_pmpcfg, write_pmpcfg }, [CSR_PMPCFG1] = { "pmpcfg1", pmp, read_pmpcfg, write_pmpcfg }, [CSR_PMPCFG2] = { "pmpcfg2", pmp, read_pmpcfg, write_pmpcfg },
Signature · 1 line
2.36.1
Re: [PATCH 1/2] target/riscv: Fixup MSECCFG minimum priv check
Quoted 10 lines · Alistair Francis
From: Alistair Francis <[email protected]>
There is nothing in the RISC-V spec that mandates version 1.12 is required for ePMP and there is currently hardware [1] that implements ePMP (a draft version though) with the 1.11 priv spec.
1: https://ibex-core.readthedocs.io/en/latest/01_overview/compliance.html
Fixes a4b2fa433125af0305b0695d7f8dda61db3364b0 target/riscv: Introduce privilege version field in the CSR ops.
The format is
Quoted 11 lines
Signed-off-by Alistair Francis <[email protected]>--- target/riscv/csr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/riscv/csr.c +0
-0
target/riscv/csr.c riscv_csr_operations csr_ops[CSR_TABLE_SIZE] = {
Quoted 9 lines
target/riscv/csr.c +1
-2@@ -3561,7 +3561,7 @@ riscv_csr_operations csr_ops[CSR_TABLE_SIZE] = { /* Physical Memory Protection */ [CSR_MSECCFG] = { "mseccfg", epmp, read_mseccfg, write_mseccfg, - .min_priv_ver = PRIV_VERSION_1_12_0 }, + .min_priv_ver = PRIV_VERSION_1_11_0 }, [CSR_PMPCFG0] = { "pmpcfg0", pmp, read_pmpcfg, write_pmpcfg }, [CSR_PMPCFG1] = { "pmpcfg1", pmp, read_pmpcfg, write_pmpcfg }, [CSR_PMPCFG2] = { "pmpcfg2", pmp, read_pmpcfg, write_pmpcfg }, --
Other than that,
Alistair Francis
AppliedRe: [PATCH 1/2] target/riscv: Fixup MSECCFG minimum priv check
Quoted 10 lines · Bin Meng
Quoted 7 lines · Alistair Francis
From: Alistair Francis <[email protected]>
There is nothing in the RISC-V spec that mandates version 1.12 is required for ePMP and there is currently hardware [1] that implements ePMP (a draft version though) with the 1.11 priv spec.
Quoted 7 lines
Quoted 3 lines
1: https://ibex-core.readthedocs.io/en/latest/01_overview/compliance.html
Fixes a4b2fa433125af0305b0695d7f8dda61db3364b0 target/riscv: Introduce privilege version field in the CSR ops.The format is
Fixes 12 digits commit id ("commit title")
Thanks! I meant to come back and fix this up but then forgot
Applied to riscv-to-apply.next
Alistair
Quoted 24 lines
Quoted 12 lines
Signed-off-by Alistair Francis <[email protected]>--- target/riscv/csr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/riscv/csr.c +0
-0target/riscv/csr.c riscv_csr_operations csr_ops[CSR_TABLE_SIZE] = {
Quoted 9 lines
target/riscv/csr.c +1
-2@@ -3561,7 +3561,7 @@ riscv_csr_operations csr_ops[CSR_TABLE_SIZE] = { /* Physical Memory Protection */ [CSR_MSECCFG] = { "mseccfg", epmp, read_mseccfg, write_mseccfg, - .min_priv_ver = PRIV_VERSION_1_12_0 }, + .min_priv_ver = PRIV_VERSION_1_11_0 }, [CSR_PMPCFG0] = { "pmpcfg0", pmp, read_pmpcfg, write_pmpcfg }, [CSR_PMPCFG1] = { "pmpcfg1", pmp, read_pmpcfg, write_pmpcfg }, [CSR_PMPCFG2] = { "pmpcfg2", pmp, read_pmpcfg, write_pmpcfg }, --Other than that,
Reviewed-by Bin Meng <[email protected]>
PATCH 2/2 target/riscv: Ibex: Support priv version 1.11
In reply to Alistair FrancisFrom: Alistair Francis <[email protected]>
The Ibex CPU supports version 1.11 of the priv spec [1], so let's correct that in QEMU as well.
1: https://ibex-core.readthedocs.io/en/latest/01_overview/compliance.html
--- target/riscv/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/riscv/cpu.c +1 -1
@@ -237,7 +237,7 @@ static void rv32_ibex_cpu_init(Object *obj)RISCVCPU *cpu =RISCV_CPU (obj);set_misa (env,MXL_RV32 ,RVI |RVM |RVC |RVU ); -set_priv_version (env,PRIV_VERSION_1_10_0 ); +set_priv_version (env,PRIV_VERSION_1_11_0 ); cpu->cfg.mmu = false; cpu->cfg.epmp = true; }
Signature · 1 line
2.36.1
Re: [PATCH 2/2] target/riscv: Ibex: Support priv version 1.11
Quoted 6 lines · Alistair Francis
From: Alistair Francis <[email protected]>
The Ibex CPU supports version 1.11 of the priv spec [1], so let's correct that in QEMU as well.
Quoted 7 lines
1: https://ibex-core.readthedocs.io/en/latest/01_overview/compliance.html
Signed-off-by Alistair Francis <[email protected]>--- target/riscv/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)