Skip to content

Commit 2e6f6ea

Browse files
SiFiveHollandpalmer-dabbelt
authored andcommitted
riscv: Add ISA extension parsing for pointer masking
The RISC-V Pointer Masking specification defines three extensions: Smmpm, Smnpm, and Ssnpm. Add support for parsing each of them. The specific extension which provides pointer masking support to userspace (Supm) depends on the kernel's privilege mode, so provide a macro to abstract this selection. Smmpm implies the existence of the mseccfg CSR. As it is the only user of this CSR so far, there is no need for an Xlinuxmseccfg extension. Reviewed-by: Charlie Jenkins <charlie@rivosinc.com> Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Link: https://lore.kernel.org/r/20241016202814.4061541-3-samuel.holland@sifive.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent 8727163 commit 2e6f6ea

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

arch/riscv/include/asm/hwcap.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@
9393
#define RISCV_ISA_EXT_ZCMOP 84
9494
#define RISCV_ISA_EXT_ZAWRS 85
9595
#define RISCV_ISA_EXT_SVVPTC 86
96+
#define RISCV_ISA_EXT_SMMPM 87
97+
#define RISCV_ISA_EXT_SMNPM 88
98+
#define RISCV_ISA_EXT_SSNPM 89
9699

97100
#define RISCV_ISA_EXT_XLINUXENVCFG 127
98101

@@ -101,8 +104,10 @@
101104

102105
#ifdef CONFIG_RISCV_M_MODE
103106
#define RISCV_ISA_EXT_SxAIA RISCV_ISA_EXT_SMAIA
107+
#define RISCV_ISA_EXT_SUPM RISCV_ISA_EXT_SMNPM
104108
#else
105109
#define RISCV_ISA_EXT_SxAIA RISCV_ISA_EXT_SSAIA
110+
#define RISCV_ISA_EXT_SUPM RISCV_ISA_EXT_SSNPM
106111
#endif
107112

108113
#endif /* _ASM_RISCV_HWCAP_H */

arch/riscv/kernel/cpufeature.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,12 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = {
377377
__RISCV_ISA_EXT_BUNDLE(zvksg, riscv_zvksg_bundled_exts),
378378
__RISCV_ISA_EXT_DATA(zvkt, RISCV_ISA_EXT_ZVKT),
379379
__RISCV_ISA_EXT_DATA(smaia, RISCV_ISA_EXT_SMAIA),
380+
__RISCV_ISA_EXT_DATA(smmpm, RISCV_ISA_EXT_SMMPM),
381+
__RISCV_ISA_EXT_SUPERSET(smnpm, RISCV_ISA_EXT_SMNPM, riscv_xlinuxenvcfg_exts),
380382
__RISCV_ISA_EXT_DATA(smstateen, RISCV_ISA_EXT_SMSTATEEN),
381383
__RISCV_ISA_EXT_DATA(ssaia, RISCV_ISA_EXT_SSAIA),
382384
__RISCV_ISA_EXT_DATA(sscofpmf, RISCV_ISA_EXT_SSCOFPMF),
385+
__RISCV_ISA_EXT_SUPERSET(ssnpm, RISCV_ISA_EXT_SSNPM, riscv_xlinuxenvcfg_exts),
383386
__RISCV_ISA_EXT_DATA(sstc, RISCV_ISA_EXT_SSTC),
384387
__RISCV_ISA_EXT_DATA(svinval, RISCV_ISA_EXT_SVINVAL),
385388
__RISCV_ISA_EXT_DATA(svnapot, RISCV_ISA_EXT_SVNAPOT),

0 commit comments

Comments
 (0)