xref: /linux/tools/testing/selftests/powerpc/tm/tm.h (revision 9938b04472d5c59f8bd8152a548533a8599596a2)
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 
14 static 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 
24 static 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 */
35