[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/7] target/riscv: Add new CSR fields for S{sn,mn,m}pm extens
From: |
Richard Henderson |
Subject: |
Re: [PATCH 2/7] target/riscv: Add new CSR fields for S{sn,mn,m}pm extensions as part of Zjpm v1.0 |
Date: |
Mon, 11 Nov 2024 07:27:15 -0800 |
User-agent: |
Mozilla Thunderbird |
On 11/7/24 22:01, baturo.alexey@gmail.com wrote:
@@ -2424,6 +2433,12 @@ static RISCVException write_senvcfg(CPURISCVState *env,
int csrno,
target_ulong val)
{
uint64_t mask = SENVCFG_FIOM | SENVCFG_CBIE | SENVCFG_CBCFE |
SENVCFG_CBZE;
+ /* Update PMM field only if the value is valid according to Zjpm v1.0 */
+ if (env_archcpu(env)->cfg.ext_ssnpm &&
+ riscv_cpu_mxl(env) == MXL_RV64 &&
+ (get_field(val, SENVCFG_PMM) != PMM_FIELD_RESERVED)) {
+ mask |= SENVCFG_PMM;
+ }
RISCVException ret;
ret = smstateen_acc_ok(env, 0, SMSTATEEN0_HSENVCFG);
Do not insert statements into the declarations at the start of the block.
Drop the unnecessary () around != (multiple instances).
@@ -3525,6 +3546,15 @@ static RISCVException read_hstatus(CPURISCVState *env,
int csrno,
static RISCVException write_hstatus(CPURISCVState *env, int csrno,
target_ulong val)
{
+ uint64_t mask = (target_ulong)-1;
+ /* Update PMM field only if the value is valid according to Zjpm v1.0 */
+ if (env_archcpu(env)->cfg.ext_ssnpm &&
+ (riscv_cpu_mxl(env) == MXL_RV64) &&
+ (get_field(val, HSTATUS_HUPMM) == PMM_FIELD_RESERVED)) {
+ mask &= ~HSTATUS_HUPMM;
+ }
Surely you'd not install HUPMM if ext_ssnpm is false?
Is this missing other extension checks?
+ env->hstatus = (env->hstatus & ~mask) | (val & mask);
+
env->hstatus = val;
Failure to remove previous assignment.
r~
- [PATCH 0/7] Pointer Masking update for Zjpm v1.0, baturo . alexey, 2024/11/08
- [PATCH 1/7] target/riscv: Remove obsolete pointer masking extension code., baturo . alexey, 2024/11/08
- [PATCH 3/7] target/riscv: Add helper functions to calculate current number of masked bits for pointer masking, baturo . alexey, 2024/11/08
- [PATCH 2/7] target/riscv: Add new CSR fields for S{sn, mn, m}pm extensions as part of Zjpm v1.0, baturo . alexey, 2024/11/08
- Re: [PATCH 2/7] target/riscv: Add new CSR fields for S{sn,mn,m}pm extensions as part of Zjpm v1.0,
Richard Henderson <=
- [PATCH 4/7] target/riscv: Add pointer masking tb flags, baturo . alexey, 2024/11/08
- [PATCH 5/7] target/riscv: Update address modify functions to take into account pointer masking, baturo . alexey, 2024/11/08
- [PATCH 6/7] target/riscv: Apply pointer masking for virtualized memory accesses, baturo . alexey, 2024/11/08
- [PATCH 7/7] target/riscv: Enable updates for pointer masking variables and thus enable pointer masking extension, baturo . alexey, 2024/11/08