mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
target/riscv: Add smstateen support
Smstateen extension specifies a mechanism to close the potential covert channels that could cause security issues. This patch adds the CSRs defined in the specification and the corresponding predicates and read/write functions. Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com> Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20221016124726.102129-2-mchitale@ventanamicro.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
aefd1108ee
commit
3bee0e4010
4 changed files with 378 additions and 0 deletions
|
@ -197,6 +197,12 @@
|
|||
/* Supervisor Configuration CSRs */
|
||||
#define CSR_SENVCFG 0x10A
|
||||
|
||||
/* Supervisor state CSRs */
|
||||
#define CSR_SSTATEEN0 0x10C
|
||||
#define CSR_SSTATEEN1 0x10D
|
||||
#define CSR_SSTATEEN2 0x10E
|
||||
#define CSR_SSTATEEN3 0x10F
|
||||
|
||||
/* Supervisor Trap Handling */
|
||||
#define CSR_SSCRATCH 0x140
|
||||
#define CSR_SEPC 0x141
|
||||
|
@ -244,6 +250,16 @@
|
|||
#define CSR_HENVCFG 0x60A
|
||||
#define CSR_HENVCFGH 0x61A
|
||||
|
||||
/* Hypervisor state CSRs */
|
||||
#define CSR_HSTATEEN0 0x60C
|
||||
#define CSR_HSTATEEN0H 0x61C
|
||||
#define CSR_HSTATEEN1 0x60D
|
||||
#define CSR_HSTATEEN1H 0x61D
|
||||
#define CSR_HSTATEEN2 0x60E
|
||||
#define CSR_HSTATEEN2H 0x61E
|
||||
#define CSR_HSTATEEN3 0x60F
|
||||
#define CSR_HSTATEEN3H 0x61F
|
||||
|
||||
/* Virtual CSRs */
|
||||
#define CSR_VSSTATUS 0x200
|
||||
#define CSR_VSIE 0x204
|
||||
|
@ -289,6 +305,27 @@
|
|||
#define CSR_MENVCFG 0x30A
|
||||
#define CSR_MENVCFGH 0x31A
|
||||
|
||||
/* Machine state CSRs */
|
||||
#define CSR_MSTATEEN0 0x30C
|
||||
#define CSR_MSTATEEN0H 0x31C
|
||||
#define CSR_MSTATEEN1 0x30D
|
||||
#define CSR_MSTATEEN1H 0x31D
|
||||
#define CSR_MSTATEEN2 0x30E
|
||||
#define CSR_MSTATEEN2H 0x31E
|
||||
#define CSR_MSTATEEN3 0x30F
|
||||
#define CSR_MSTATEEN3H 0x31F
|
||||
|
||||
/* Common defines for all smstateen */
|
||||
#define SMSTATEEN_MAX_COUNT 4
|
||||
#define SMSTATEEN0_CS (1ULL << 0)
|
||||
#define SMSTATEEN0_FCSR (1ULL << 1)
|
||||
#define SMSTATEEN0_HSCONTXT (1ULL << 57)
|
||||
#define SMSTATEEN0_IMSIC (1ULL << 58)
|
||||
#define SMSTATEEN0_AIA (1ULL << 59)
|
||||
#define SMSTATEEN0_SVSLCT (1ULL << 60)
|
||||
#define SMSTATEEN0_HSENVCFG (1ULL << 62)
|
||||
#define SMSTATEEN_STATEEN (1ULL << 63)
|
||||
|
||||
/* Enhanced Physical Memory Protection (ePMP) */
|
||||
#define CSR_MSECCFG 0x747
|
||||
#define CSR_MSECCFGH 0x757
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue