From: Frank Chang <frank.chang@sifive.com>
To: Alistair Francis <alistair23@gmail.com>
Cc: qemu-devel@nongnu.org, Palmer Dabbelt <palmer@dabbelt.com>,
Alistair Francis <alistair.francis@wdc.com>,
Bin Meng <bmeng.cn@gmail.com>, Weiwei Li <liwei1518@gmail.com>,
Daniel Henrique Barboza <dbarboza@ventanamicro.com>,
Liu Zhiwei <zhiwei_liu@linux.alibaba.com>,
"open list:RISC-V TCG CPUs" <qemu-riscv@nongnu.org>
Subject: Re: [PATCH RESEND 1/6] target/riscv: Introduce extension implied rules definition
Date: Tue, 11 Jun 2024 09:56:29 +0800 [thread overview]
Message-ID: <CAE_xrPhZPghZmv81n4hvV=fpGege0MO0v-SHAKbL_30WNbCtNA@mail.gmail.com> (raw)
In-Reply-To: <CAKmqyKN8J1g_1XyAVxpjWiSQDDhPuKrQk9x3ys2JCbiaGyf=AA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2913 bytes --]
Hi Alistair,
On Tue, Jun 11, 2024 at 9:35 AM Alistair Francis <alistair23@gmail.com>
wrote:
> On Wed, Jun 5, 2024 at 4:35 PM <frank.chang@sifive.com> wrote:
> >
> > From: Frank Chang <frank.chang@sifive.com>
> >
> > RISCVCPUImpliedExtsRule is created to store the implied rules.
> > 'is_misa' flag is used to distinguish whether the rule is derived
> > from the MISA or other extensions.
> > 'ext' stores the MISA bit if 'is_misa' is true. Otherwise, it stores
> > the offset of the extension defined in RISCVCPUConfig. 'ext' will also
> > serve as the key of the hash tables to look up the rule in the following
> > commit.
> >
> > Signed-off-by: Frank Chang <frank.chang@sifive.com>
> > ---
> > target/riscv/cpu.c | 8 ++++++++
> > target/riscv/cpu.h | 18 ++++++++++++++++++
> > 2 files changed, 26 insertions(+)
> >
> > diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> > index cee6fc4a9a..c7e5cec7ef 100644
> > --- a/target/riscv/cpu.c
> > +++ b/target/riscv/cpu.c
> > @@ -2242,6 +2242,14 @@ RISCVCPUProfile *riscv_profiles[] = {
> > NULL,
> > };
> >
> > +RISCVCPUImpliedExtsRule *riscv_misa_implied_rules[] = {
> > + NULL
> > +};
> > +
> > +RISCVCPUImpliedExtsRule *riscv_ext_implied_rules[] = {
> > + NULL
> > +};
> > +
> > static Property riscv_cpu_properties[] = {
> > DEFINE_PROP_BOOL("debug", RISCVCPU, cfg.debug, true),
> >
> > diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
> > index 1501868008..b5a036cf27 100644
> > --- a/target/riscv/cpu.h
> > +++ b/target/riscv/cpu.h
> > @@ -122,6 +122,24 @@ typedef enum {
> > EXT_STATUS_DIRTY,
> > } RISCVExtStatus;
> >
> > +typedef struct riscv_cpu_implied_exts_rule RISCVCPUImpliedExtsRule;
> > +
> > +struct riscv_cpu_implied_exts_rule {
> > + /* Bitmask indicates the rule enabled status for the harts. */
> > + uint64_t enabled;
>
> I'm not clear why we need this
>
This is because a rule may be implied more than once.
e.g. Zcf implies RVF, Zfa also implies RVF.
There's no need to check RVF's implied rule again for Zfa after Zcf's
implied rules are enabled.
The implied rules are checked recursively, so once the rule has been
enabled (per-CPU basis),
the rule (and all its implied rules) will not be rechecked.
Regards,
Frank Chang
> Alistair
>
> > + /* True if this is a MISA implied rule. */
> > + bool is_misa;
> > + /* ext is MISA bit if is_misa flag is true, else extension offset.
> */
> > + const uint32_t ext;
> > + const uint32_t implied_misas;
> > + const uint32_t implied_exts[];
> > +};
> > +
> > +extern RISCVCPUImpliedExtsRule *riscv_misa_implied_rules[];
> > +extern RISCVCPUImpliedExtsRule *riscv_ext_implied_rules[];
> > +
> > +#define RISCV_IMPLIED_EXTS_RULE_END -1
> > +
> > #define MMU_USER_IDX 3
> >
> > #define MAX_RISCV_PMPS (16)
> > --
> > 2.43.2
> >
> >
>
[-- Attachment #2: Type: text/html, Size: 4093 bytes --]
next prev parent reply other threads:[~2024-06-11 1:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-05 6:31 [PATCH RESEND 0/6] Introduce extension implied rules frank.chang
2024-06-05 6:31 ` [PATCH RESEND 1/6] target/riscv: Introduce extension implied rules definition frank.chang
2024-06-11 1:35 ` Alistair Francis
2024-06-11 1:56 ` Frank Chang [this message]
2024-06-05 6:31 ` [PATCH RESEND 2/6] target/riscv: Introduce extension implied rule helpers frank.chang
2024-06-12 1:21 ` Frank Chang
2024-06-05 6:31 ` [PATCH RESEND 3/6] target/riscv: Add MISA implied rules frank.chang
2024-06-11 1:41 ` Alistair Francis
2024-06-05 6:31 ` [PATCH RESEND 4/6] target/riscv: Add standard extension " frank.chang
2024-06-11 1:45 ` Alistair Francis
2024-06-05 6:31 ` [PATCH RESEND 5/6] target/riscv: Add Zc extension implied rule frank.chang
2024-06-05 6:31 ` [PATCH RESEND 6/6] target/riscv: Remove extension auto-update check statements frank.chang
2024-06-05 7:48 ` [PATCH RESEND 0/6] Introduce extension implied rules Jerry Zhang Jian
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='CAE_xrPhZPghZmv81n4hvV=fpGege0MO0v-SHAKbL_30WNbCtNA@mail.gmail.com' \
--to=frank.chang@sifive.com \
--cc=alistair.francis@wdc.com \
--cc=alistair23@gmail.com \
--cc=bmeng.cn@gmail.com \
--cc=dbarboza@ventanamicro.com \
--cc=liwei1518@gmail.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).