Skip to content

Commit

Permalink
target/riscv: Reset henvcfg to zero
Browse files Browse the repository at this point in the history
The hypervisor should decide what it wants to enable. Zero all
configuration enable bits on reset.

Also, commit ed67d63 ("target/riscv: Update CSR bits name for
svadu extension") missed one reference to 'hade'. Change it now.

Fixes: 0af3f11 ("target/riscv: Add *envcfg.HADE related check in address translation")
Fixes: ed67d63 ("target/riscv: Update CSR bits name for svadu extension")
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20240215223955.969568-5-dbarboza@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
  • Loading branch information
jones-drew authored and alistair23 committed Mar 8, 2024
1 parent a0952c1 commit 148189f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions target/riscv/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -961,8 +961,7 @@ static void riscv_cpu_reset_hold(Object *obj)

env->menvcfg = (cpu->cfg.ext_svpbmt ? MENVCFG_PBMTE : 0) |
(cpu->cfg.ext_svadu ? MENVCFG_ADUE : 0);
env->henvcfg = (cpu->cfg.ext_svpbmt ? HENVCFG_PBMTE : 0) |
(cpu->cfg.ext_svadu ? HENVCFG_ADUE : 0);
env->henvcfg = 0;

/* Initialized default priorities of local interrupts. */
for (i = 0; i < ARRAY_SIZE(env->miprio); i++) {
Expand Down
2 changes: 1 addition & 1 deletion target/riscv/csr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2133,7 +2133,7 @@ static RISCVException read_henvcfg(CPURISCVState *env, int csrno,
/*
* henvcfg.pbmte is read_only 0 when menvcfg.pbmte = 0
* henvcfg.stce is read_only 0 when menvcfg.stce = 0
* henvcfg.hade is read_only 0 when menvcfg.hade = 0
* henvcfg.adue is read_only 0 when menvcfg.adue = 0
*/
*val = env->henvcfg & (~(HENVCFG_PBMTE | HENVCFG_STCE | HENVCFG_ADUE) |
env->menvcfg);
Expand Down

0 comments on commit 148189f

Please sign in to comment.