]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
kselftest/arm64: Move/add POE helpers to test_signals_utils.h
authorKevin Brodsky <kevin.brodsky@arm.com>
Mon, 27 Apr 2026 12:03:36 +0000 (13:03 +0100)
committerWill Deacon <will@kernel.org>
Tue, 19 May 2026 10:54:03 +0000 (11:54 +0100)
In preparation to adding further POE signal tests, move
get_por_el0() to test_signals_utils.h and add set_por_el0().

Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
tools/testing/selftests/arm64/signal/test_signals_utils.h
tools/testing/selftests/arm64/signal/testcases/poe_siginfo.c

index 36fc12b3cd6043ea2da0fcceb0696c6370d1a3f6..2c7b8c64a35ab30c9a99723201a54e7de86c0035 100644 (file)
@@ -57,6 +57,22 @@ static inline __attribute__((always_inline)) uint64_t get_gcspr_el0(void)
        return val;
 }
 
+#define SYS_POR_EL0 "S3_3_C10_C2_4"
+
+static inline uint64_t get_por_el0(void)
+{
+       uint64_t val;
+
+       asm volatile("mrs %0, " SYS_POR_EL0 "\n" : "=r"(val));
+
+       return val;
+}
+
+static inline void set_por_el0(uint64_t val)
+{
+       asm volatile("msr " SYS_POR_EL0 ", %0\n" :: "r"(val));
+}
+
 static inline bool feats_ok(struct tdescr *td)
 {
        if (td->feats_incompatible & td->feats_supported)
index 36bd9940ee056135fb2f924ef25efa5623ab2c89..e15fedf4da6e1f1ec41cce61a8c093157e2ef534 100644 (file)
@@ -21,21 +21,6 @@ static union {
        char buf[1024 * 128];
 } context;
 
-#define SYS_POR_EL0 "S3_3_C10_C2_4"
-
-static uint64_t get_por_el0(void)
-{
-       uint64_t val;
-
-       asm volatile(
-               "mrs    %0, " SYS_POR_EL0 "\n"
-               : "=r"(val)
-               :
-               : );
-
-       return val;
-}
-
 int poe_present(struct tdescr *td, siginfo_t *si, ucontext_t *uc)
 {
        struct _aarch64_ctx *head = GET_BUF_RESV_HEAD(context);