From: Andrew Jones <ajones@ventanamicro.com>
To: Rob Bradford <rbradford@rivosinc.com>
Cc: qemu-devel@nongnu.org, qemu-riscv@nongnu.org,
atishp@rivosinc.com, palmer@dabbelt.com,
alistair.francis@wdc.com, bin.meng@windriver.com,
liwei1518@gmail.com, dbarboza@ventanamicro.com,
zhiwei_liu@linux.alibaba.com
Subject: Re: [PATCH 2/3] target/riscv: Add step to validate 'B' extension
Date: Thu, 11 Jan 2024 14:09:31 +0100 [thread overview]
Message-ID: <20240111-cbafb19054363e2e33dbd317@orel> (raw)
In-Reply-To: <20240109171848.32237-3-rbradford@rivosinc.com>
On Tue, Jan 09, 2024 at 05:07:36PM +0000, Rob Bradford wrote:
> If the B extension is enabled warn if the user has disabled any of the
> required extensions that are part of the 'B' extension. Conversely
> enable the extensions that make up the 'B' extension if it is enabled.
>
> Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
> ---
> target/riscv/tcg/tcg-cpu.c | 33 +++++++++++++++++++++++++++++++++
> 1 file changed, 33 insertions(+)
>
> diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c
> index fda54671d5..f10871d352 100644
> --- a/target/riscv/tcg/tcg-cpu.c
> +++ b/target/riscv/tcg/tcg-cpu.c
> @@ -273,6 +273,35 @@ static void riscv_cpu_disable_priv_spec_isa_exts(RISCVCPU *cpu)
> }
> }
>
> +static void riscv_cpu_validate_b(RISCVCPU *cpu)
> +{
> + const char *warn_msg = "RVB mandates disabled extension %s";
> +
> + if (!cpu->cfg.ext_zba) {
> + if (!cpu_cfg_ext_is_user_set(CPU_CFG_OFFSET(ext_zba))) {
> + cpu->cfg.ext_zba = true;
> + } else {
> + warn_report(warn_msg, "zba");
> + }
> + }
> +
> + if (!cpu->cfg.ext_zbb) {
> + if (!cpu_cfg_ext_is_user_set(CPU_CFG_OFFSET(ext_zbb))) {
> + cpu->cfg.ext_zbb = true;
> + } else {
> + warn_report(warn_msg, "zbb");
> + }
> + }
> +
> + if (!cpu->cfg.ext_zbs) {
> + if (!cpu_cfg_ext_is_user_set(CPU_CFG_OFFSET(ext_zbs))) {
> + cpu->cfg.ext_zbs = true;
> + } else {
> + warn_report(warn_msg, "zbs");
> + }
> + }
> +}
> +
> /*
> * Check consistency between chosen extensions while setting
> * cpu->cfg accordingly.
> @@ -309,6 +338,10 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)
> env->misa_ext_mask |= RVI | RVM | RVA | RVF | RVD;
> }
>
> + if (riscv_has_ext(env, RVB)) {
> + riscv_cpu_validate_b(cpu);
> + }
> +
> if (riscv_has_ext(env, RVI) && riscv_has_ext(env, RVE)) {
> error_setg(errp,
> "I and E extensions are incompatible");
> --
> 2.43.0
>
>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
next prev parent reply other threads:[~2024-01-11 13:10 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-09 17:07 [PATCH 0/3] target/riscv: Add support for 'B' extension Rob Bradford
2024-01-09 17:07 ` [PATCH 1/3] target/riscv: Add infrastructure for 'B' MISA extension Rob Bradford
2024-01-10 18:18 ` Daniel Henrique Barboza
2024-01-11 13:07 ` Andrew Jones
2024-01-11 13:14 ` Andrew Jones
2024-01-11 15:17 ` Rob Bradford
2024-01-12 16:08 ` Andrew Jones
2024-01-12 16:54 ` Rob Bradford
2024-01-13 0:28 ` Ved Shanbhogue
2024-01-11 13:15 ` Andrew Jones
2024-01-09 17:07 ` [PATCH 2/3] target/riscv: Add step to validate 'B' extension Rob Bradford
2024-01-10 18:26 ` Daniel Henrique Barboza
2024-01-11 13:09 ` Andrew Jones [this message]
2024-01-09 17:07 ` [PATCH 3/3] target/riscv: Enable 'B' extension on max CPU type Rob Bradford
2024-01-10 18:32 ` Daniel Henrique Barboza
2024-01-10 18:41 ` Daniel Henrique Barboza
2024-01-11 13:02 ` Andrew Jones
2024-01-11 14:53 ` Daniel Henrique Barboza
2024-01-11 15:49 ` Rob Bradford
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=20240111-cbafb19054363e2e33dbd317@orel \
--to=ajones@ventanamicro.com \
--cc=alistair.francis@wdc.com \
--cc=atishp@rivosinc.com \
--cc=bin.meng@windriver.com \
--cc=dbarboza@ventanamicro.com \
--cc=liwei1518@gmail.com \
--cc=palmer@dabbelt.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=rbradford@rivosinc.com \
--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).