Skip to content

Commit

Permalink
target/riscv: Set VS* bits to one in mideleg when H-Ext is enabled
Browse files Browse the repository at this point in the history
With H-Ext supported, VS bits are all hardwired to one in MIDELEG
denoting always delegated interrupts. This is being done in rmw_mideleg
but given mideleg is used in other places when routing interrupts
this change initializes it in riscv_cpu_realize to be on the safe side.

Signed-off-by: Rajnesh Kanwal <rkanwal@rivosinc.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20231016111736.28721-4-rkanwal@rivosinc.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
  • Loading branch information
rajnesh-kanwal authored and alistair23 committed Nov 7, 2023
1 parent d17bcae commit b901c7e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion target/riscv/tcg/tcg-cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,12 @@ static bool tcg_cpu_realize(CPUState *cs, Error **errp)
cpu->pmu_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,
riscv_pmu_timer_cb, cpu);
}
}
}

/* With H-Ext, VSSIP, VSTIP, VSEIP and SGEIP are hardwired to one. */
if (riscv_has_ext(env, RVH)) {
env->mideleg = MIP_VSSIP | MIP_VSTIP | MIP_VSEIP | MIP_SGEIP;
}
#endif

return true;
Expand Down

0 comments on commit b901c7e

Please sign in to comment.