Skip to contentSkip to conversation

target/riscv: Fixes for Ibex and OpenTitan

PATCH Applied Alistair Francis 3 participants 6 messages Jun 29, 2022 – Jul 2, 2022 RISC-V

lore
Share & tools
lore
#0 lore raw

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
#1 lore raw

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

Fixes a4b2fa433125af0305b0695d7f8dda61db3364b0 target/riscv: Introduce privilege version field in the CSR ops.
---
 target/riscv/csr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/riscv/csr.c +1 -1
index 6dbe9b541f..6379bef5a5 100644
@@ -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
Reviewed-by on v1 1/2
#2 lore raw

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

Fixes 12 digits commit id ("commit title")
Quoted 11 lines
---
 target/riscv/csr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/riscv/csr.c +0 -0
index 6dbe9b541f..6379bef5a5 100644

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,

#3 lore raw

Re: [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
---
 target/riscv/csr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/riscv/csr.c +0 -0
index 6dbe9b541f..6379bef5a5 100644

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,

#4 lore raw

PATCH 2/2 target/riscv: Ibex: Support priv version 1.11

In reply to 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.

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
index 05e6521351..178b4de51f 100644
@@ -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
Reviewed-by on v1 2/2
#5 lore raw

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

---
 target/riscv/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)