[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 3/3] target/riscv: Set mtval and stval support
From: |
Bin Meng |
Subject: |
Re: [PATCH v2 3/3] target/riscv: Set mtval and stval support |
Date: |
Wed, 8 Sep 2021 13:55:42 +0800 |
On Wed, Sep 8, 2021 at 12:55 PM Alistair Francis
<alistair.francis@opensource.wdc.com> wrote:
>
> From: Alistair Francis <alistair.francis@wdc.com>
>
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> ---
> target/riscv/cpu.h | 1 +
> target/riscv/cpu.c | 6 +++++-
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
> index d11db1f031..5b0bbf2fca 100644
> --- a/target/riscv/cpu.h
> +++ b/target/riscv/cpu.h
> @@ -309,6 +309,7 @@ struct RISCVCPU {
> bool mmu;
> bool pmp;
> bool epmp;
> + bool mtval_inst;
> uint64_t resetvec;
> } cfg;
> };
> diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> index 1a2b03d579..537f2af341 100644
> --- a/target/riscv/cpu.c
> +++ b/target/riscv/cpu.c
> @@ -437,6 +437,10 @@ static void riscv_cpu_realize(DeviceState *dev, Error
> **errp)
> }
> }
>
> + if (cpu->cfg.mtval_inst) {
> + set_feature(env, RISCV_FEATURE_MTVAL_INST);
> + }
> +
> set_resetvec(env, cpu->cfg.resetvec);
>
> /* If only XLEN is set for misa, then set misa from properties */
> @@ -600,7 +604,7 @@ static Property riscv_cpu_properties[] = {
> DEFINE_PROP_BOOL("mmu", RISCVCPU, cfg.mmu, true),
> DEFINE_PROP_BOOL("pmp", RISCVCPU, cfg.pmp, true),
> DEFINE_PROP_BOOL("x-epmp", RISCVCPU, cfg.epmp, false),
> -
> + DEFINE_PROP_BOOL("tval-inst", RISCVCPU, cfg.mtval_inst, true),
Should we tweak such on a per-CPU basis instead of globally enabling
it, e.g.: update sifive_u54 per the real hardware implementation?
> DEFINE_PROP_UINT64("resetvec", RISCVCPU, cfg.resetvec, DEFAULT_RSTVEC),
> DEFINE_PROP_END_OF_LIST(),
> };
>
Regards,
Bin
- [PATCH v2 1/3] target/riscv: Set the opcode in DisasContext, (continued)
[PATCH v2 3/3] target/riscv: Set mtval and stval support, Alistair Francis, 2021/09/08
- Re: [PATCH v2 3/3] target/riscv: Set mtval and stval support,
Bin Meng <=