aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2015-11-23 21:05:40 -0500
committerMichael Ellerman <mpe@ellerman.id.au>2015-12-14 04:41:48 -0500
commit34dc8b279dc5dd3ce863298056989bdd7f4979c8 (patch)
tree28a1f92da950ab408f7cc9eb30d55447fcb23789 /tools
parentede8ef3f824ea6e853a5e4b27467f583cdaa314e (diff)
selftests/powerpc: Move TM helpers into tm.h
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/powerpc/tm/tm-syscall.c12
-rw-r--r--tools/testing/selftests/powerpc/tm/tm.h34
2 files changed, 35 insertions, 11 deletions
diff --git a/tools/testing/selftests/powerpc/tm/tm-syscall.c b/tools/testing/selftests/powerpc/tm/tm-syscall.c
index d7256b79ec4c..60560cb20e38 100644
--- a/tools/testing/selftests/powerpc/tm/tm-syscall.c
+++ b/tools/testing/selftests/powerpc/tm/tm-syscall.c
@@ -13,11 +13,11 @@
13#include <unistd.h> 13#include <unistd.h>
14#include <sys/syscall.h> 14#include <sys/syscall.h>
15#include <asm/tm.h> 15#include <asm/tm.h>
16#include <asm/cputable.h>
17#include <sys/time.h> 16#include <sys/time.h>
18#include <stdlib.h> 17#include <stdlib.h>
19 18
20#include "utils.h" 19#include "utils.h"
20#include "tm.h"
21 21
22extern int getppid_tm_active(void); 22extern int getppid_tm_active(void);
23extern int getppid_tm_suspended(void); 23extern int getppid_tm_suspended(void);
@@ -76,16 +76,6 @@ pid_t getppid_tm(bool suspend)
76 exit(-1); 76 exit(-1);
77} 77}
78 78
79static inline bool have_htm_nosc(void)
80{
81#ifdef PPC_FEATURE2_HTM_NOSC
82 return have_hwcap2(PPC_FEATURE2_HTM_NOSC);
83#else
84 printf("PPC_FEATURE2_HTM_NOSC not defined, can't check AT_HWCAP2\n");
85 return false;
86#endif
87}
88
89int tm_syscall(void) 79int tm_syscall(void)
90{ 80{
91 unsigned count = 0; 81 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
index 000000000000..24144b25772c
--- /dev/null
+++ b/tools/testing/selftests/powerpc/tm/tm.h
@@ -0,0 +1,34 @@
1/*
2 * Copyright 2015, Michael Ellerman, IBM Corp.
3 * Licensed under GPLv2.
4 */
5
6#ifndef _SELFTESTS_POWERPC_TM_TM_H
7#define _SELFTESTS_POWERPC_TM_TM_H
8
9#include <stdbool.h>
10#include <asm/cputable.h>
11
12#include "../utils.h"
13
14static inline bool have_htm(void)
15{
16#ifdef PPC_FEATURE2_HTM
17 return have_hwcap2(PPC_FEATURE2_HTM);
18#else
19 printf("PPC_FEATURE2_HTM not defined, can't check AT_HWCAP2\n");
20 return false;
21#endif
22}
23
24static inline bool have_htm_nosc(void)
25{
26#ifdef PPC_FEATURE2_HTM_NOSC
27 return have_hwcap2(PPC_FEATURE2_HTM_NOSC);
28#else
29 printf("PPC_FEATURE2_HTM_NOSC not defined, can't check AT_HWCAP2\n");
30 return false;
31#endif
32}
33
34#endif /* _SELFTESTS_POWERPC_TM_TM_H */