tm.h (9938b04472d5c59f8bd8152a548533a8599596a2) tm.h (a431b946db581d6a121d035a887d370cdc4b8dea)
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
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>
9#include <asm/tm.h>
10#include <asm/cputable.h>
10#include <asm/cputable.h>
11#include <stdbool.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

--- 7 unchanged lines hidden (view full) ---

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
12
13#include "../utils.h"
14
15static inline bool have_htm(void)
16{
17#ifdef PPC_FEATURE2_HTM
18 return have_hwcap2(PPC_FEATURE2_HTM);
19#else

--- 7 unchanged lines hidden (view full) ---

27#ifdef PPC_FEATURE2_HTM_NOSC
28 return have_hwcap2(PPC_FEATURE2_HTM_NOSC);
29#else
30 printf("PPC_FEATURE2_HTM_NOSC not defined, can't check AT_HWCAP2\n");
31 return false;
32#endif
33}
34
35static inline long failure_code(void)
36{
37 return __builtin_get_texasru() >> 24;
38}
39
40static inline bool failure_is_persistent(void)
41{
42 return (failure_code() & TM_CAUSE_PERSISTENT) == TM_CAUSE_PERSISTENT;
43}
44
45static inline bool failure_is_syscall(void)
46{
47 return (failure_code() & TM_CAUSE_SYSCALL) == TM_CAUSE_SYSCALL;
48}
49
50static inline bool failure_is_nesting(void)
51{
52 return (__builtin_get_texasru() & 0x400000);
53}
54
34#endif /* _SELFTESTS_POWERPC_TM_TM_H */
55#endif /* _SELFTESTS_POWERPC_TM_TM_H */