]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
riscv: hwprobe: Export the Supm ISA extension
authorSamuel Holland <samuel.holland@sifive.com>
Wed, 16 Oct 2024 20:27:49 +0000 (13:27 -0700)
committerPalmer Dabbelt <palmer@rivosinc.com>
Thu, 24 Oct 2024 21:12:59 +0000 (14:12 -0700)
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>
Documentation/arch/riscv/hwprobe.rst
arch/riscv/include/uapi/asm/hwprobe.h
arch/riscv/kernel/sys_hwprobe.c

index 85b709257918ade7590ebbf2f0f53dcdf8ed36be..b9aec2e5bbd4472490864318cee7e17d2b34fecf 100644 (file)
@@ -239,6 +239,9 @@ The following keys are defined:
        ratified in commit 98918c844281 ("Merge pull request #1217 from
        riscv/zawrs") of riscv-isa-manual.
 
+  * :c:macro:`RISCV_HWPROBE_EXT_SUPM`: The Supm extension is supported as
+       defined in version 1.0 of the RISC-V Pointer Masking extensions.
+
 * :c:macro:`RISCV_HWPROBE_KEY_CPUPERF_0`: Deprecated.  Returns similar values to
      :c:macro:`RISCV_HWPROBE_KEY_MISALIGNED_SCALAR_PERF`, but the key was
      mistakenly classified as a bitmask rather than a value.
index 1e153cda57db85b99d40f4fcc67aa69651a0f856..868ff41b93d62ff9d2a841c54177fd1d482b2fc9 100644 (file)
@@ -72,6 +72,7 @@ struct riscv_hwprobe {
 #define                RISCV_HWPROBE_EXT_ZCF           (1ULL << 46)
 #define                RISCV_HWPROBE_EXT_ZCMOP         (1ULL << 47)
 #define                RISCV_HWPROBE_EXT_ZAWRS         (1ULL << 48)
+#define                RISCV_HWPROBE_EXT_SUPM          (1ULL << 49)
 #define RISCV_HWPROBE_KEY_CPUPERF_0    5
 #define                RISCV_HWPROBE_MISALIGNED_UNKNOWN        (0 << 0)
 #define                RISCV_HWPROBE_MISALIGNED_EMULATED       (1 << 0)
index cea0ca2bf2a25ecc671e31b141e84c6d1977da25..0ac78e9f7c941beab4b7c1ffcc93c2ce833be60a 100644 (file)
@@ -150,6 +150,9 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair,
                        EXT_KEY(ZFH);
                        EXT_KEY(ZFHMIN);
                }
+
+               if (IS_ENABLED(CONFIG_RISCV_ISA_SUPM))
+                       EXT_KEY(SUPM);
 #undef EXT_KEY
        }