aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/powerpc/tm/tm.h
diff options
context:
space:
mode:
authorCyril Bur <cyrilbur@gmail.com>2016-06-29 21:41:51 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2016-07-26 14:28:22 +1000
commita431b946db581d6a121d035a887d370cdc4b8dea (patch)
treeb0b6a6c2049643a5920b8f2b3f63d9a3eecdb64a /tools/testing/selftests/powerpc/tm/tm.h
parentpowerpc: Improve comment explaining why we modify VRSAVE (diff)
downloadlinux-dev-a431b946db581d6a121d035a887d370cdc4b8dea.tar.xz
linux-dev-a431b946db581d6a121d035a887d370cdc4b8dea.zip
selftests/powerpc: exec() with suspended transaction
Perform an exec() class syscall with a suspended transaction. This is a test for the bug we fixed in 8e96a87c5431 ("powerpc/tm: Always reclaim in start_thread() for exec() class syscalls"). Signed-off-by: Cyril Bur <cyrilbur@gmail.com> [mpe: Fix build errors, use a single binary for the test] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to '')
-rw-r--r--tools/testing/selftests/powerpc/tm/tm.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/tools/testing/selftests/powerpc/tm/tm.h b/tools/testing/selftests/powerpc/tm/tm.h
index 24144b25772c..60318bad7d7a 100644
--- a/tools/testing/selftests/powerpc/tm/tm.h
+++ b/tools/testing/selftests/powerpc/tm/tm.h
@@ -6,8 +6,9 @@
#ifndef _SELFTESTS_POWERPC_TM_TM_H
#define _SELFTESTS_POWERPC_TM_TM_H
-#include <stdbool.h>
+#include <asm/tm.h>
#include <asm/cputable.h>
+#include <stdbool.h>
#include "../utils.h"
@@ -31,4 +32,24 @@ static inline bool have_htm_nosc(void)
#endif
}
+static inline long failure_code(void)
+{
+ return __builtin_get_texasru() >> 24;
+}
+
+static inline bool failure_is_persistent(void)
+{
+ return (failure_code() & TM_CAUSE_PERSISTENT) == TM_CAUSE_PERSISTENT;
+}
+
+static inline bool failure_is_syscall(void)
+{
+ return (failure_code() & TM_CAUSE_SYSCALL) == TM_CAUSE_SYSCALL;
+}
+
+static inline bool failure_is_nesting(void)
+{
+ return (__builtin_get_texasru() & 0x400000);
+}
+
#endif /* _SELFTESTS_POWERPC_TM_TM_H */