Skip to content

Commit 3c2e0af

Browse files
SiFiveHollandpalmer-dabbelt
authored andcommitted
riscv: hwprobe: Export the Supm ISA extension
Supm is a virtual ISA extension defined in the RISC-V Pointer Masking specification, which indicates that pointer masking is available in U-mode. It can be provided by either Smnpm or Ssnpm, depending on which mode the kernel runs in. Userspace should not care about this distinction, so export Supm instead of either underlying extension. Hide the extension if the kernel was compiled without support for the pointer masking prctl() interface. Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Link: https://lore.kernel.org/r/20241016202814.4061541-9-samuel.holland@sifive.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent 7470b5a commit 3c2e0af

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

Documentation/arch/riscv/hwprobe.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ The following keys are defined:
239239
ratified in commit 98918c844281 ("Merge pull request #1217 from
240240
riscv/zawrs") of riscv-isa-manual.
241241

242+
* :c:macro:`RISCV_HWPROBE_EXT_SUPM`: The Supm extension is supported as
243+
defined in version 1.0 of the RISC-V Pointer Masking extensions.
244+
242245
* :c:macro:`RISCV_HWPROBE_KEY_CPUPERF_0`: Deprecated. Returns similar values to
243246
:c:macro:`RISCV_HWPROBE_KEY_MISALIGNED_SCALAR_PERF`, but the key was
244247
mistakenly classified as a bitmask rather than a value.

arch/riscv/include/uapi/asm/hwprobe.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ struct riscv_hwprobe {
7272
#define RISCV_HWPROBE_EXT_ZCF (1ULL << 46)
7373
#define RISCV_HWPROBE_EXT_ZCMOP (1ULL << 47)
7474
#define RISCV_HWPROBE_EXT_ZAWRS (1ULL << 48)
75+
#define RISCV_HWPROBE_EXT_SUPM (1ULL << 49)
7576
#define RISCV_HWPROBE_KEY_CPUPERF_0 5
7677
#define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0)
7778
#define RISCV_HWPROBE_MISALIGNED_EMULATED (1 << 0)

arch/riscv/kernel/sys_hwprobe.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair,
150150
EXT_KEY(ZFH);
151151
EXT_KEY(ZFHMIN);
152152
}
153+
154+
if (IS_ENABLED(CONFIG_RISCV_ISA_SUPM))
155+
EXT_KEY(SUPM);
153156
#undef EXT_KEY
154157
}
155158

0 commit comments

Comments
 (0)