mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
target/riscv: Add *envcfg* CSRs support
The RISC-V privileged specification v1.12 defines few execution environment configuration CSRs that can be used enable/disable extensions per privilege levels. Add the basic support for these CSRs. Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Signed-off-by: Atish Patra <atishp@rivosinc.com> Message-Id: <20220303185440.512391-6-atishp@rivosinc.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
3e6a417c8a
commit
29a9ec9bd8
4 changed files with 174 additions and 0 deletions
|
@ -231,6 +231,28 @@ static int riscv_cpu_post_load(void *opaque, int version_id)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static bool envcfg_needed(void *opaque)
|
||||
{
|
||||
RISCVCPU *cpu = opaque;
|
||||
CPURISCVState *env = &cpu->env;
|
||||
|
||||
return (env->priv_ver >= PRIV_VERSION_1_12_0 ? 1 : 0);
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_envcfg = {
|
||||
.name = "cpu/envcfg",
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.needed = envcfg_needed,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_UINT64(env.menvcfg, RISCVCPU),
|
||||
VMSTATE_UINTTL(env.senvcfg, RISCVCPU),
|
||||
VMSTATE_UINT64(env.henvcfg, RISCVCPU),
|
||||
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
const VMStateDescription vmstate_riscv_cpu = {
|
||||
.name = "cpu",
|
||||
.version_id = 3,
|
||||
|
@ -292,6 +314,7 @@ const VMStateDescription vmstate_riscv_cpu = {
|
|||
&vmstate_pointermasking,
|
||||
&vmstate_rv128,
|
||||
&vmstate_kvmtimer,
|
||||
&vmstate_envcfg,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue