]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - tools/testing/selftests/powerpc/tm/tm.h
selftests/powerpc: exec() with suspended transaction
[mirror_ubuntu-zesty-kernel.git] / tools / testing / selftests / powerpc / tm / tm.h
index 24144b25772cf92d74fc74415bfcc6dffa08e14a..60318bad7d7af0335e8bbf691747c9ebad899f45 100644 (file)
@@ -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 */