From: "Heiko Stübner" <heiko@sntech.de>
To: qemu-devel@nongnu.org, Atish Patra <atishp@rivosinc.com>
Cc: qemu-riscv@nongnu.org, Anup Patel <anup@brainfault.org>,
Bin Meng <bin.meng@windriver.com>,
Atish Patra <atishp@rivosinc.com>,
Alistair Francis <alistair.francis@wdc.com>,
Palmer Dabbelt <palmer@dabbelt.com>
Subject: Re: [RFC 4/5] target/riscv: Add *envcfg* CSRs support
Date: Thu, 03 Feb 2022 13:23:44 +0100 [thread overview]
Message-ID: <2696860.3DGziXre4Q@diego> (raw)
In-Reply-To: <20220120200735.2739543-5-atishp@rivosinc.com>
Hi Atish,
Am Donnerstag, 20. Januar 2022, 21:07:34 CET schrieb Atish Patra:
> The RISC-V privileged specification v1.12 defines few execution
> environment configuration CSRs that can be used enable/disable
> extensions per privilege levels.
>
> Add the basic support for these CSRs.
>
> Signed-off-by: Atish Patra <atishp@rivosinc.com>
> ---
> target/riscv/cpu.h | 8 ++++
> target/riscv/cpu_bits.h | 31 +++++++++++++++
> target/riscv/csr.c | 84 +++++++++++++++++++++++++++++++++++++++++
> target/riscv/machine.c | 26 +++++++++++++
> 4 files changed, 149 insertions(+)
>
> diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h
> index f6f90b5cbd52..afb237c2313b 100644
> --- a/target/riscv/cpu_bits.h
> +++ b/target/riscv/cpu_bits.h
[...]
> @@ -578,6 +589,26 @@ typedef enum RISCVException {
> #define PM_EXT_CLEAN 0x00000002ULL
> #define PM_EXT_DIRTY 0x00000003ULL
>
> +/* Execution enviornment configuration bits */
> +#define MENVCFG_FIOM (1 << 0)
> +#define MENVCFG_CBE 0x30000ULL
Looking both at the cmo spec as well as the most recent privileged spec
(draft) the field is called CBIE it seems.
Also the shift looks wrong. Both cmo as well as privileged spec show
it at bits [5:4] and _not_ [17:16].
Also wouldn't doing it like (_UL(3) << 4) be better to catch such things?
> +#define MENVCFG_CBCFE (1 << 6)
> +#define MENVCFG_CBZE (1 << 7)
> +#define MENVCFG_PBMTE (1 << 62)
> +#define MENVCFG_STCE (1 << 63)
> +
> +#define SENVCFG_FIOM MENVCFG_FIOM
> +#define SENVCFG_CBE MENVCFG_CBE
> +#define SENVCFG_CBCFE MENVCFG_CBCFE
> +#define SENVCFG_CBZE MENVCFG_CBZE
> +
> +#define HENVCFG_FIOM MENVCFG_FIOM
> +#define HENVCFG_CBE MENVCFG_CBE
> +#define HENVCFG_CBCFE MENVCFG_CBCFE
> +#define HENVCFG_CBZE MENVCFG_CBZE
> +#define HENVCFG_PBMTE MENVCFG_PBMTE
> +#define HENVCFG_STCE MENVCFG_STCE
> +
> /* Offsets for every pair of control bits per each priv level */
> #define XS_OFFSET 0ULL
> #define U_OFFSET 2ULL
Heiko
next prev parent reply other threads:[~2022-02-03 12:28 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-20 20:07 [RFC 0/5] Privilege version update Atish Patra
2022-01-20 20:07 ` Atish Patra
2022-01-20 20:07 ` [RFC 1/5] target/riscv: Add the privileged spec version 1.12.0 Atish Patra
2022-01-20 20:07 ` Atish Patra
2022-01-24 7:59 ` Richard Henderson
2022-01-24 7:59 ` Richard Henderson
2022-01-29 0:52 ` Atish Kumar Patra
2022-01-29 0:52 ` Atish Kumar Patra
2022-01-31 6:33 ` Alistair Francis
2022-01-31 6:33 ` Alistair Francis
2022-01-20 20:07 ` [RFC 2/5] target/riscv: Introduce privilege version field in the CSR ops Atish Patra
2022-01-20 20:07 ` Atish Patra
2022-01-24 7:56 ` Richard Henderson
2022-01-24 7:56 ` Richard Henderson
2022-01-29 0:52 ` Atish Kumar Patra
2022-01-29 0:52 ` Atish Kumar Patra
2022-01-20 20:07 ` [RFC 3/5] target/riscv: Add support for mconfigptr Atish Patra
2022-01-20 20:07 ` Atish Patra
2022-01-20 20:07 ` [RFC 4/5] target/riscv: Add *envcfg* CSRs support Atish Patra
2022-01-20 20:07 ` Atish Patra
2022-01-26 8:37 ` Weiwei Li
2022-01-26 8:37 ` Weiwei Li
2022-01-29 1:28 ` Atish Patra
2022-01-29 1:28 ` Atish Patra
2022-01-29 1:50 ` angell1518
2022-01-31 20:05 ` Atish Kumar Patra
2022-01-31 20:05 ` Atish Kumar Patra
2022-02-03 12:23 ` Heiko Stübner [this message]
2022-02-03 20:39 ` Atish Kumar Patra
2022-02-03 20:39 ` Atish Kumar Patra
2022-01-20 20:07 ` [RFC 5/5] target/riscv: Enable privileged spec version 1.12 Atish Patra
2022-01-20 20:07 ` Atish Patra
2022-01-24 13:32 ` Christoph Müllner
2022-01-24 13:32 ` Christoph Müllner
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=2696860.3DGziXre4Q@diego \
--to=heiko@sntech.de \
--cc=alistair.francis@wdc.com \
--cc=anup@brainfault.org \
--cc=atishp@rivosinc.com \
--cc=bin.meng@windriver.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.