From: Alistair Francis <alistair23@gmail.com>
To: Alexey Baturo <baturo.alexey@gmail.com>
Cc: "open list:RISC-V" <qemu-riscv@nongnu.org>,
Sagar Karandikar <sagark@eecs.berkeley.edu>,
Bastian Koppelmann <kbastian@mail.uni-paderborn.de>,
Bin Meng <bin.meng@windriver.com>,
Richard Henderson <richard.henderson@linaro.org>,
"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
space.monkey.delivers@gmail.com,
Alistair Francis <alistair.francis@wdc.com>,
Dave Smith <kupokupokupopo@gmail.com>,
Palmer Dabbelt <palmer@dabbelt.com>
Subject: Re: [PATCH v10 2/7] [RISCV_PM] Add CSR defines for RISC-V PM extension
Date: Thu, 9 Sep 2021 14:34:44 +1000 [thread overview]
Message-ID: <CAKmqyKNNdmM3HjxKDW_5zJvtUXKZNpkT4_CphCnB-x92LShnjg@mail.gmail.com> (raw)
In-Reply-To: <20210829175120.19413-3-space.monkey.delivers@gmail.com>
On Mon, Aug 30, 2021 at 3:51 AM Alexey Baturo <baturo.alexey@gmail.com> wrote:
>
> Signed-off-by: Alexey Baturo <space.monkey.delivers@gmail.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> target/riscv/cpu_bits.h | 96 +++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 96 insertions(+)
>
> diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h
> index 7330ff5a19..140178d23c 100644
> --- a/target/riscv/cpu_bits.h
> +++ b/target/riscv/cpu_bits.h
> @@ -334,6 +334,38 @@
> #define CSR_MHPMCOUNTER30H 0xb9e
> #define CSR_MHPMCOUNTER31H 0xb9f
>
> +/*
> + * User PointerMasking registers
> + * NB: actual CSR numbers might be changed in future
> + */
> +#define CSR_UMTE 0x4c0
> +#define CSR_UPMMASK 0x4c1
> +#define CSR_UPMBASE 0x4c2
> +
> +/*
> + * Machine PointerMasking registers
> + * NB: actual CSR numbers might be changed in future
> + */
> +#define CSR_MMTE 0x3c0
> +#define CSR_MPMMASK 0x3c1
> +#define CSR_MPMBASE 0x3c2
> +
> +/*
> + * Supervisor PointerMaster registers
> + * NB: actual CSR numbers might be changed in future
> + */
> +#define CSR_SMTE 0x1c0
> +#define CSR_SPMMASK 0x1c1
> +#define CSR_SPMBASE 0x1c2
> +
> +/*
> + * Hypervisor PointerMaster registers
> + * NB: actual CSR numbers might be changed in future
> + */
> +#define CSR_VSMTE 0x2c0
> +#define CSR_VSPMMASK 0x2c1
> +#define CSR_VSPMBASE 0x2c2
> +
> /* mstatus CSR bits */
> #define MSTATUS_UIE 0x00000001
> #define MSTATUS_SIE 0x00000002
> @@ -531,4 +563,68 @@ typedef enum RISCVException {
> #define MIE_UTIE (1 << IRQ_U_TIMER)
> #define MIE_SSIE (1 << IRQ_S_SOFT)
> #define MIE_USIE (1 << IRQ_U_SOFT)
> +
> +/* General PointerMasking CSR bits*/
> +#define PM_ENABLE 0x00000001ULL
> +#define PM_CURRENT 0x00000002ULL
> +#define PM_INSN 0x00000004ULL
> +#define PM_XS_MASK 0x00000003ULL
> +
> +/* PointerMasking XS bits values */
> +#define PM_EXT_DISABLE 0x00000000ULL
> +#define PM_EXT_INITIAL 0x00000001ULL
> +#define PM_EXT_CLEAN 0x00000002ULL
> +#define PM_EXT_DIRTY 0x00000003ULL
> +
> +/* Offsets for every pair of control bits per each priv level */
> +#define XS_OFFSET 0ULL
> +#define U_OFFSET 2ULL
> +#define S_OFFSET 5ULL
> +#define M_OFFSET 8ULL
> +
> +#define PM_XS_BITS (PM_XS_MASK << XS_OFFSET)
> +#define U_PM_ENABLE (PM_ENABLE << U_OFFSET)
> +#define U_PM_CURRENT (PM_CURRENT << U_OFFSET)
> +#define U_PM_INSN (PM_INSN << U_OFFSET)
> +#define S_PM_ENABLE (PM_ENABLE << S_OFFSET)
> +#define S_PM_CURRENT (PM_CURRENT << S_OFFSET)
> +#define S_PM_INSN (PM_INSN << S_OFFSET)
> +#define M_PM_ENABLE (PM_ENABLE << M_OFFSET)
> +#define M_PM_CURRENT (PM_CURRENT << M_OFFSET)
> +#define M_PM_INSN (PM_INSN << M_OFFSET)
> +
> +/* mmte CSR bits */
> +#define MMTE_PM_XS_BITS PM_XS_BITS
> +#define MMTE_U_PM_ENABLE U_PM_ENABLE
> +#define MMTE_U_PM_CURRENT U_PM_CURRENT
> +#define MMTE_U_PM_INSN U_PM_INSN
> +#define MMTE_S_PM_ENABLE S_PM_ENABLE
> +#define MMTE_S_PM_CURRENT S_PM_CURRENT
> +#define MMTE_S_PM_INSN S_PM_INSN
> +#define MMTE_M_PM_ENABLE M_PM_ENABLE
> +#define MMTE_M_PM_CURRENT M_PM_CURRENT
> +#define MMTE_M_PM_INSN M_PM_INSN
> +#define MMTE_MASK (MMTE_U_PM_ENABLE | MMTE_U_PM_CURRENT | MMTE_U_PM_INSN | \
> + MMTE_S_PM_ENABLE | MMTE_S_PM_CURRENT | MMTE_S_PM_INSN | \
> + MMTE_M_PM_ENABLE | MMTE_M_PM_CURRENT | MMTE_M_PM_INSN | \
> + MMTE_PM_XS_BITS)
> +
> +/* (v)smte CSR bits */
> +#define SMTE_PM_XS_BITS PM_XS_BITS
> +#define SMTE_U_PM_ENABLE U_PM_ENABLE
> +#define SMTE_U_PM_CURRENT U_PM_CURRENT
> +#define SMTE_U_PM_INSN U_PM_INSN
> +#define SMTE_S_PM_ENABLE S_PM_ENABLE
> +#define SMTE_S_PM_CURRENT S_PM_CURRENT
> +#define SMTE_S_PM_INSN S_PM_INSN
> +#define SMTE_MASK (SMTE_U_PM_ENABLE | SMTE_U_PM_CURRENT | SMTE_U_PM_INSN | \
> + SMTE_S_PM_ENABLE | SMTE_S_PM_CURRENT | SMTE_S_PM_INSN | \
> + SMTE_PM_XS_BITS)
> +
> +/* umte CSR bits */
> +#define UMTE_U_PM_ENABLE U_PM_ENABLE
> +#define UMTE_U_PM_CURRENT U_PM_CURRENT
> +#define UMTE_U_PM_INSN U_PM_INSN
> +#define UMTE_MASK (UMTE_U_PM_ENABLE | MMTE_U_PM_CURRENT | UMTE_U_PM_INSN)
> +
> #endif
> --
> 2.20.1
>
>
next prev parent reply other threads:[~2021-09-09 4:36 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-29 17:51 [PATCH v10 0/7] RISC-V Pointer Masking implementation Alexey Baturo
2021-08-29 17:51 ` Alexey Baturo
2021-08-29 17:51 ` [PATCH v10 1/7] [RISCV_PM] Add J-extension into RISC-V Alexey Baturo
2021-08-29 17:51 ` Alexey Baturo
2021-08-29 17:51 ` [PATCH v10 2/7] [RISCV_PM] Add CSR defines for RISC-V PM extension Alexey Baturo
2021-08-29 17:51 ` Alexey Baturo
2021-09-09 4:34 ` Alistair Francis [this message]
2021-08-29 17:51 ` [PATCH v10 3/7] [RISCV_PM] Support CSRs required for RISC-V PM extension except for the h-mode Alexey Baturo
2021-08-29 17:51 ` Alexey Baturo
2021-09-09 5:57 ` Alistair Francis
2021-08-29 17:51 ` [PATCH v10 4/7] [RISCV_PM] Print new PM CSRs in QEMU logs Alexey Baturo
2021-08-29 17:51 ` Alexey Baturo
2021-08-29 17:51 ` [PATCH v10 5/7] [RISCV_PM] Support pointer masking for RISC-V for i/c/f/d/a types of instructions Alexey Baturo
2021-08-29 17:51 ` Alexey Baturo
2021-08-29 17:51 ` [PATCH v10 6/7] [RISCV_PM] Implement address masking functions required for RISC-V Pointer Masking extension Alexey Baturo
2021-08-29 17:51 ` Alexey Baturo
2021-08-29 17:51 ` [PATCH v10 7/7] [RISCV_PM] Allow experimental J-ext to be turned on Alexey Baturo
2021-08-29 17:51 ` Alexey Baturo
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=CAKmqyKNNdmM3HjxKDW_5zJvtUXKZNpkT4_CphCnB-x92LShnjg@mail.gmail.com \
--to=alistair23@gmail.com \
--cc=alistair.francis@wdc.com \
--cc=baturo.alexey@gmail.com \
--cc=bin.meng@windriver.com \
--cc=kbastian@mail.uni-paderborn.de \
--cc=kupokupokupopo@gmail.com \
--cc=palmer@dabbelt.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=sagark@eecs.berkeley.edu \
--cc=space.monkey.delivers@gmail.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 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.