From: Bin Meng <bmeng.cn@gmail.com>
To: Alistair Francis <alistair.francis@opensource.wdc.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>,
Alistair Francis <alistair.francis@wdc.com>,
"open list:RISC-V" <qemu-riscv@nongnu.org>,
"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
Alistair Francis <alistair23@gmail.com>
Subject: Re: [PATCH v2 3/3] target/riscv: Set mtval and stval support
Date: Wed, 8 Sep 2021 13:55:42 +0800 [thread overview]
Message-ID: <CAEUhbmUjg_LttOLwFMgZueA7L1aRSRTAdy78-EVybJ=a-ax-8w@mail.gmail.com> (raw)
In-Reply-To: <be4c59ab0a3468f1962671e7cf5a947c151d31d9.1631076834.git.alistair.francis@wdc.com>
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
prev parent reply other threads:[~2021-09-08 5:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-08 4:54 [PATCH v2 0/3] RISC-V: Populate mtval and stval Alistair Francis
2021-09-08 4:54 ` [PATCH v2 1/3] target/riscv: Set the opcode in DisasContext Alistair Francis
2021-09-08 5:42 ` Bin Meng
2021-09-08 6:27 ` Richard Henderson
2021-09-08 4:54 ` [PATCH v2 2/3] target/riscv: Implement the stval/mtval illegal instruction Alistair Francis
2021-09-08 5:53 ` Bin Meng
2021-09-08 6:48 ` Richard Henderson
2021-09-24 6:48 ` Alistair Francis
2021-09-24 12:57 ` Richard Henderson
2021-09-29 3:56 ` Alistair Francis
2021-09-08 4:54 ` [PATCH v2 3/3] target/riscv: Set mtval and stval support Alistair Francis
2021-09-08 5:55 ` Bin Meng [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAEUhbmUjg_LttOLwFMgZueA7L1aRSRTAdy78-EVybJ=a-ax-8w@mail.gmail.com' \
--to=bmeng.cn@gmail.com \
--cc=alistair.francis@opensource.wdc.com \
--cc=alistair.francis@wdc.com \
--cc=alistair23@gmail.com \
--cc=palmer@dabbelt.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).