selftests/powerpc: Move TM helpers into tm.h
authorMichael Ellerman <mpe@ellerman.id.au>
Tue, 24 Nov 2015 02:05:40 +0000 (13:05 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 14 Dec 2015 09:41:48 +0000 (20:41 +1100)
Move have_htm_nosc() into a new tm.h, and add a new helper, have_htm()
which we'll use in the next patch.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
tools/testing/selftests/powerpc/tm/tm-syscall.c
tools/testing/selftests/powerpc/tm/tm.h [new file with mode: 0644]

index d7256b79ec4c9a0928339ac49c70a2d4a81b3cc4..60560cb20e380701fcd58aa5d19f749e479c9eb6 100644 (file)
 #include <unistd.h>
 #include <sys/syscall.h>
 #include <asm/tm.h>
-#include <asm/cputable.h>
 #include <sys/time.h>
 #include <stdlib.h>
 
 #include "utils.h"
+#include "tm.h"
 
 extern int getppid_tm_active(void);
 extern int getppid_tm_suspended(void);
@@ -76,16 +76,6 @@ pid_t getppid_tm(bool suspend)
        exit(-1);
 }
 
-static inline bool have_htm_nosc(void)
-{
-#ifdef PPC_FEATURE2_HTM_NOSC
-       return have_hwcap2(PPC_FEATURE2_HTM_NOSC);
-#else
-       printf("PPC_FEATURE2_HTM_NOSC not defined, can't check AT_HWCAP2\n");
-       return false;
-#endif
-}
-
 int tm_syscall(void)
 {
        unsigned count = 0;
diff --git a/tools/testing/selftests/powerpc/tm/tm.h b/tools/testing/selftests/powerpc/tm/tm.h
new file mode 100644 (file)
index 0000000..24144b2
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2015, Michael Ellerman, IBM Corp.
+ * Licensed under GPLv2.
+ */
+
+#ifndef _SELFTESTS_POWERPC_TM_TM_H
+#define _SELFTESTS_POWERPC_TM_TM_H
+
+#include <stdbool.h>
+#include <asm/cputable.h>
+
+#include "../utils.h"
+
+static inline bool have_htm(void)
+{
+#ifdef PPC_FEATURE2_HTM
+       return have_hwcap2(PPC_FEATURE2_HTM);
+#else
+       printf("PPC_FEATURE2_HTM not defined, can't check AT_HWCAP2\n");
+       return false;
+#endif
+}
+
+static inline bool have_htm_nosc(void)
+{
+#ifdef PPC_FEATURE2_HTM_NOSC
+       return have_hwcap2(PPC_FEATURE2_HTM_NOSC);
+#else
+       printf("PPC_FEATURE2_HTM_NOSC not defined, can't check AT_HWCAP2\n");
+       return false;
+#endif
+}
+
+#endif /* _SELFTESTS_POWERPC_TM_TM_H */