[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 2/6] target/riscv: Support senvcfg[UKTE] bit when svukte exten
From: |
Fea.Wang |
Subject: |
[PATCH v4 2/6] target/riscv: Support senvcfg[UKTE] bit when svukte extension is enabled |
Date: |
Wed, 20 Nov 2024 15:48:50 +0800 |
Svukte extension add UKTE bit, bit[8] in senvcfg CSR. The bit will be
supported when the svukte extension is enabled.
When senvcfg[UKTE] bit is set, the memory access from U-mode should do
the svukte check only except HLV/HLVX/HSV H-mode instructions which
depend on hstatus[HUKTE].
Signed-off-by: Fea.Wang <fea.wang@sifive.com>
Reviewed-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Jim Shu <jim.shu@sifive.com>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
---
target/riscv/cpu_bits.h | 1 +
target/riscv/csr.c | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h
index 385a2c67c2..4b9f899217 100644
--- a/target/riscv/cpu_bits.h
+++ b/target/riscv/cpu_bits.h
@@ -785,6 +785,7 @@ typedef enum RISCVException {
#define SENVCFG_CBIE MENVCFG_CBIE
#define SENVCFG_CBCFE MENVCFG_CBCFE
#define SENVCFG_CBZE MENVCFG_CBZE
+#define SENVCFG_UKTE BIT(8)
#define HENVCFG_FIOM MENVCFG_FIOM
#define HENVCFG_LPE MENVCFG_LPE
diff --git a/target/riscv/csr.c b/target/riscv/csr.c
index 9846770820..1936a6f32a 100644
--- a/target/riscv/csr.c
+++ b/target/riscv/csr.c
@@ -2453,6 +2453,10 @@ static RISCVException write_senvcfg(CPURISCVState *env,
int csrno,
mask |= SENVCFG_SSE;
}
+ if (env_archcpu(env)->cfg.ext_svukte) {
+ mask |= SENVCFG_UKTE;
+ }
+
env->senvcfg = (env->senvcfg & ~mask) | (val & mask);
return RISCV_EXCP_NONE;
}
--
2.34.1
- [PATCH v4 0/6] Introduce svukte ISA extension, Fea.Wang, 2024/11/20
- [PATCH v4 1/6] target/riscv: Add svukte extension capability variable, Fea.Wang, 2024/11/20
- [PATCH v4 2/6] target/riscv: Support senvcfg[UKTE] bit when svukte extension is enabled,
Fea.Wang <=
- [PATCH v4 3/6] target/riscv: Support hstatus[HUKTE] bit when svukte extension is enabled, Fea.Wang, 2024/11/20
- [PATCH v4 6/6] target/riscv: Check svukte is not enabled in RV32, Fea.Wang, 2024/11/20
- [PATCH v4 4/6] target/riscv: Check memory access to meet svukte rule, Fea.Wang, 2024/11/20
- [PATCH v4 5/6] target/riscv: Expose svukte ISA extension, Fea.Wang, 2024/11/20