From: Alistair Francis <alistair23@gmail.com>
To: "Fea.Wang" <fea.wang@sifive.com>
Cc: qemu-devel@nongnu.org, qemu-riscv@nongnu.org,
Frank Chang <frank.chang@sifive.com>,
Weiwei Li <liwei1518@gmail.com>,
LIU Zhiwei <zhiwei_liu@linux.alibaba.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Alistair Francis <alistair.francis@wdc.com>,
Bin Meng <bmeng.cn@gmail.com>,
Daniel Henrique Barboza <dbarboza@ventanamicro.com>,
Andrew Jones <ajones@ventanamicro.com>,
Max Chou <max.chou@sifive.com>
Subject: Re: [RESEND PATCH v2 2/5] target/riscv: Support the version for ss1p13
Date: Tue, 4 Jun 2024 10:56:26 +1000 [thread overview]
Message-ID: <CAKmqyKP4pDZdq7mdouTOSznATuGg7jX4QurVvyVEFFRXF3ab4Q@mail.gmail.com> (raw)
In-Reply-To: <CAKmqyKMPy40UQxvVAyuJ+tvC3-58nMvYB1UqMDcoDOT5_A8u1A@mail.gmail.com>
On Tue, Jun 4, 2024 at 10:46 AM Alistair Francis <alistair23@gmail.com> wrote:
>
> On Wed, May 15, 2024 at 6:02 PM Fea.Wang <fea.wang@sifive.com> wrote:
> >
> > Add RISC-V privilege 1.13 support.
> >
> > Signed-off-by: Fea.Wang <fea.wang@sifive.com>
> > Reviewed-by: Frank Chang <frank.chang@sifive.com>
> > Reviewed-by: Weiwei Li <liwei1518@gmail.com>
> > Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
>
> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Whoops, ignore this.
>
> Alistair
>
> > ---
> > target/riscv/cpu.c | 6 +++++-
> > target/riscv/cpu.h | 4 +++-
> > target/riscv/cpu_cfg.h | 1 +
> > target/riscv/tcg/tcg-cpu.c | 4 ++++
> > 4 files changed, 13 insertions(+), 2 deletions(-)
> >
> > diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> > index 6dd3d7f4a3..ee2ec4c4e5 100644
> > --- a/target/riscv/cpu.c
> > +++ b/target/riscv/cpu.c
> > @@ -1775,7 +1775,9 @@ static int priv_spec_from_str(const char *priv_spec_str)
> > {
> > int priv_version = -1;
> >
> > - if (!g_strcmp0(priv_spec_str, PRIV_VER_1_12_0_STR)) {
> > + if (!g_strcmp0(priv_spec_str, PRIV_VER_1_13_0_STR)) {
> > + priv_version = PRIV_VERSION_1_13_0;
> > + } else if (!g_strcmp0(priv_spec_str, PRIV_VER_1_12_0_STR)) {
This patch should be split in half. We only want to expose this to
user after it has been implemented.
Alistair
> > priv_version = PRIV_VERSION_1_12_0;
> > } else if (!g_strcmp0(priv_spec_str, PRIV_VER_1_11_0_STR)) {
> > priv_version = PRIV_VERSION_1_11_0;
> > @@ -1795,6 +1797,8 @@ const char *priv_spec_to_str(int priv_version)
> > return PRIV_VER_1_11_0_STR;
> > case PRIV_VERSION_1_12_0:
> > return PRIV_VER_1_12_0_STR;
> > + case PRIV_VERSION_1_13_0:
> > + return PRIV_VER_1_13_0_STR;
> > default:
> > return NULL;
> > }
> > diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
> > index 140eb43fcb..f691c7d828 100644
> > --- a/target/riscv/cpu.h
> > +++ b/target/riscv/cpu.h
> > @@ -96,12 +96,14 @@ extern RISCVCPUProfile *riscv_profiles[];
> > #define PRIV_VER_1_10_0_STR "v1.10.0"
> > #define PRIV_VER_1_11_0_STR "v1.11.0"
> > #define PRIV_VER_1_12_0_STR "v1.12.0"
> > +#define PRIV_VER_1_13_0_STR "v1.13.0"
> > enum {
> > PRIV_VERSION_1_10_0 = 0,
> > PRIV_VERSION_1_11_0,
> > PRIV_VERSION_1_12_0,
> > + PRIV_VERSION_1_13_0,
> >
> > - PRIV_VERSION_LATEST = PRIV_VERSION_1_12_0,
> > + PRIV_VERSION_LATEST = PRIV_VERSION_1_13_0,
> > };
> >
> > #define VEXT_VERSION_1_00_0 0x00010000
> > diff --git a/target/riscv/cpu_cfg.h b/target/riscv/cpu_cfg.h
> > index e1e4f32698..fb7eebde52 100644
> > --- a/target/riscv/cpu_cfg.h
> > +++ b/target/riscv/cpu_cfg.h
> > @@ -136,6 +136,7 @@ struct RISCVCPUConfig {
> > * TCG always implement/can't be user disabled,
> > * based on spec version.
> > */
> > + bool has_priv_1_13;
> > bool has_priv_1_12;
> > bool has_priv_1_11;
> >
> > diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c
> > index fa186093fb..f53422d605 100644
> > --- a/target/riscv/tcg/tcg-cpu.c
> > +++ b/target/riscv/tcg/tcg-cpu.c
> > @@ -318,6 +318,10 @@ static void riscv_cpu_update_named_features(RISCVCPU *cpu)
> > cpu->cfg.has_priv_1_12 = true;
> > }
> >
> > + if (cpu->env.priv_ver >= PRIV_VERSION_1_13_0) {
> > + cpu->cfg.has_priv_1_13 = true;
> > + }
> > +
> > /* zic64b is 1.12 or later */
> > cpu->cfg.ext_zic64b = cpu->cfg.cbom_blocksize == 64 &&
> > cpu->cfg.cbop_blocksize == 64 &&
> > --
> > 2.34.1
> >
> >
next prev parent reply other threads:[~2024-06-04 0:57 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-15 8:05 [RESEND PATCH v2 0/5] target/riscv: Support RISC-V privilege 1.13 spec Fea.Wang
2024-05-15 8:05 ` [RESEND PATCH v2 1/5] target/riscv: Reuse the conversion function of priv_spec Fea.Wang
2024-06-04 0:30 ` Alistair Francis
2024-05-15 8:05 ` [RESEND PATCH v2 2/5] target/riscv: Support the version for ss1p13 Fea.Wang
2024-06-04 0:46 ` Alistair Francis
2024-06-04 0:56 ` Alistair Francis [this message]
2024-06-04 3:39 ` Fea Wang
2024-05-15 8:06 ` [RESEND PATCH v2 3/5] target/riscv: Add 'P1P13' bit in SMSTATEEN0 Fea.Wang
2024-05-21 6:49 ` LIU Zhiwei
2024-06-04 0:54 ` Alistair Francis
2024-06-04 3:56 ` Fea Wang
2024-05-15 8:06 ` [RESEND PATCH v2 4/5] target/riscv: Add MEDELEGH, HEDELEGH csrs for RV32 Fea.Wang
2024-06-04 0:53 ` Alistair Francis
2024-05-15 8:06 ` [RESEND PATCH v2 5/5] target/riscv: Reserve exception codes for sw-check and hw-err Fea.Wang
2024-06-04 0:54 ` Alistair Francis
2024-05-27 9:21 ` [RESEND PATCH v2 0/5] target/riscv: Support RISC-V privilege 1.13 spec Daniel Henrique Barboza
2024-05-30 3:30 ` Fea Wang
2024-05-30 9:21 ` Daniel Henrique Barboza
2024-05-30 10:37 ` Andrew Jones
2024-06-03 6:37 ` Fea Wang
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=CAKmqyKP4pDZdq7mdouTOSznATuGg7jX4QurVvyVEFFRXF3ab4Q@mail.gmail.com \
--to=alistair23@gmail.com \
--cc=ajones@ventanamicro.com \
--cc=alistair.francis@wdc.com \
--cc=bmeng.cn@gmail.com \
--cc=dbarboza@ventanamicro.com \
--cc=fea.wang@sifive.com \
--cc=frank.chang@sifive.com \
--cc=liwei1518@gmail.com \
--cc=max.chou@sifive.com \
--cc=palmer@dabbelt.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=zhiwei_liu@linux.alibaba.com \
/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).