aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/powerpc/tm/tm.h
diff options
context:
space:
mode:
authorCyril Bur <cyrilbur@gmail.com>2016-09-23 16:18:18 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2016-10-04 20:10:14 +1100
commit8e03bd4e70b6a4c70ac3ea6766b2bc06a8ad91a3 (patch)
tree9bff224a04565625b7847cf1a2a1b026e909303e /tools/testing/selftests/powerpc/tm/tm.h
parentselftests/powerpc: Allow tests to extend their kill timeout (diff)
downloadlinux-dev-8e03bd4e70b6a4c70ac3ea6766b2bc06a8ad91a3.tar.xz
linux-dev-8e03bd4e70b6a4c70ac3ea6766b2bc06a8ad91a3.zip
selftests/powerpc: Add TM tcheck helpers in C
Signed-off-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to '')
-rw-r--r--tools/testing/selftests/powerpc/tm/tm.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/testing/selftests/powerpc/tm/tm.h b/tools/testing/selftests/powerpc/tm/tm.h
index 60318bad7d7a..2c8da74304e7 100644
--- a/tools/testing/selftests/powerpc/tm/tm.h
+++ b/tools/testing/selftests/powerpc/tm/tm.h
@@ -52,4 +52,31 @@ static inline bool failure_is_nesting(void)
return (__builtin_get_texasru() & 0x400000);
}
+static inline int tcheck(void)
+{
+ long cr;
+ asm volatile ("tcheck 0" : "=r"(cr) : : "cr0");
+ return (cr >> 28) & 4;
+}
+
+static inline bool tcheck_doomed(void)
+{
+ return tcheck() & 8;
+}
+
+static inline bool tcheck_active(void)
+{
+ return tcheck() & 4;
+}
+
+static inline bool tcheck_suspended(void)
+{
+ return tcheck() & 2;
+}
+
+static inline bool tcheck_transactional(void)
+{
+ return tcheck() & 6;
+}
+
#endif /* _SELFTESTS_POWERPC_TM_TM_H */