From: Atish Kumar Patra <atishp@rivosinc.com> To: "Heiko Stübner" <heiko@sntech.de> Cc: "open list:RISC-V" <qemu-riscv@nongnu.org>, Anup Patel <anup@brainfault.org>, Bin Meng <bin.meng@windriver.com>, "qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>, Alistair Francis <alistair.francis@wdc.com>, Palmer Dabbelt <palmer@dabbelt.com> Subject: Re: [RFC 4/5] target/riscv: Add *envcfg* CSRs support Date: Thu, 3 Feb 2022 12:39:39 -0800 [thread overview] Message-ID: <CAHBxVyESyQqLi0bvRUcH=4UCSfs5ZzN+EK5Uxjc71okXu2Nk1A@mail.gmail.com> (raw) In-Reply-To: <2696860.3DGziXre4Q@diego> [-- Attachment #1: Type: text/plain, Size: 2744 bytes --] On Thu, Feb 3, 2022 at 4:23 AM Heiko Stübner <heiko@sntech.de> wrote: > 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]. > > This looks like a typo from my side. These bits are reserved in the spec! Apologies for such a silly mistake. Fixed it in v2. > Also wouldn't doing it like (_UL(3) << 4) be better to catch such things? > > Of course. > > +#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 > > > [-- Attachment #2: Type: text/html, Size: 3980 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Atish Kumar Patra <atishp@rivosinc.com> To: "Heiko Stübner" <heiko@sntech.de> Cc: "qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>, "open list:RISC-V" <qemu-riscv@nongnu.org>, Anup Patel <anup@brainfault.org>, Bin Meng <bin.meng@windriver.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, 3 Feb 2022 12:39:39 -0800 [thread overview] Message-ID: <CAHBxVyESyQqLi0bvRUcH=4UCSfs5ZzN+EK5Uxjc71okXu2Nk1A@mail.gmail.com> (raw) In-Reply-To: <2696860.3DGziXre4Q@diego> [-- Attachment #1: Type: text/plain, Size: 2744 bytes --] On Thu, Feb 3, 2022 at 4:23 AM Heiko Stübner <heiko@sntech.de> wrote: > 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]. > > This looks like a typo from my side. These bits are reserved in the spec! Apologies for such a silly mistake. Fixed it in v2. > Also wouldn't doing it like (_UL(3) << 4) be better to catch such things? > > Of course. > > +#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 > > > [-- Attachment #2: Type: text/html, Size: 3980 bytes --]
next prev parent reply other threads:[~2022-02-03 21: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 2022-02-03 20:39 ` Atish Kumar Patra [this message] 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='CAHBxVyESyQqLi0bvRUcH=4UCSfs5ZzN+EK5Uxjc71okXu2Nk1A@mail.gmail.com' \ --to=atishp@rivosinc.com \ --cc=alistair.francis@wdc.com \ --cc=anup@brainfault.org \ --cc=bin.meng@windriver.com \ --cc=heiko@sntech.de \ --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: linkBe 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.