summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/powerpc/utils.h
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2015-11-24 05:05:39 +0300
committerMichael Ellerman <mpe@ellerman.id.au>2015-12-14 12:41:47 +0300
commitede8ef3f824ea6e853a5e4b27467f583cdaa314e (patch)
tree39237f6a1e7c5ff66bc6e0f216c789ee6f2cb2ac /tools/testing/selftests/powerpc/utils.h
parentfcb45ec074725baeb3aaa1b1854b9f44c3eebacf (diff)
downloadlinux-ede8ef3f824ea6e853a5e4b27467f583cdaa314e.tar.xz
selftests/powerpc: Add have_hwcap2() helper
We already do this twice and want to add another so add a helper. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'tools/testing/selftests/powerpc/utils.h')
-rw-r--r--tools/testing/selftests/powerpc/utils.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/testing/selftests/powerpc/utils.h b/tools/testing/selftests/powerpc/utils.h
index b7d41086bb0a..fbf2bf530e50 100644
--- a/tools/testing/selftests/powerpc/utils.h
+++ b/tools/testing/selftests/powerpc/utils.h
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <stdbool.h>
+#include <linux/auxvec.h>
/* Avoid headaches with PRI?64 - just use %ll? always */
typedef unsigned long long u64;
@@ -22,6 +23,11 @@ typedef uint8_t u8;
int test_harness(int (test_function)(void), char *name);
extern void *get_auxv_entry(int type);
+static inline bool have_hwcap2(unsigned long ftr2)
+{
+ return ((unsigned long)get_auxv_entry(AT_HWCAP2) & ftr2) == ftr2;
+}
+
/* Yes, this is evil */
#define FAIL_IF(x) \
do { \