|
19 | 19 | #include "utils.h"
|
20 | 20 | #include "tm.h"
|
21 | 21 |
|
| 22 | +#ifndef PPC_FEATURE2_SCV |
| 23 | +#define PPC_FEATURE2_SCV 0x00100000 /* scv syscall */ |
| 24 | +#endif |
| 25 | + |
22 | 26 | extern int getppid_tm_active(void);
|
23 | 27 | extern int getppid_tm_suspended(void);
|
| 28 | +extern int getppid_scv_tm_active(void); |
| 29 | +extern int getppid_scv_tm_suspended(void); |
24 | 30 |
|
25 | 31 | unsigned retries = 0;
|
26 | 32 |
|
27 | 33 | #define TEST_DURATION 10 /* seconds */
|
28 | 34 |
|
29 |
| -pid_t getppid_tm(bool suspend) |
| 35 | +pid_t getppid_tm(bool scv, bool suspend) |
30 | 36 | {
|
31 | 37 | int i;
|
32 | 38 | pid_t pid;
|
33 | 39 |
|
34 | 40 | for (i = 0; i < TM_RETRIES; i++) {
|
35 |
| - if (suspend) |
36 |
| - pid = getppid_tm_suspended(); |
37 |
| - else |
38 |
| - pid = getppid_tm_active(); |
| 41 | + if (suspend) { |
| 42 | + if (scv) |
| 43 | + pid = getppid_scv_tm_suspended(); |
| 44 | + else |
| 45 | + pid = getppid_tm_suspended(); |
| 46 | + } else { |
| 47 | + if (scv) |
| 48 | + pid = getppid_scv_tm_active(); |
| 49 | + else |
| 50 | + pid = getppid_tm_active(); |
| 51 | + } |
39 | 52 |
|
40 | 53 | if (pid >= 0)
|
41 | 54 | return pid;
|
@@ -82,15 +95,24 @@ int tm_syscall(void)
|
82 | 95 | * Test a syscall within a suspended transaction and verify
|
83 | 96 | * that it succeeds.
|
84 | 97 | */
|
85 |
| - FAIL_IF(getppid_tm(true) == -1); /* Should succeed. */ |
| 98 | + FAIL_IF(getppid_tm(false, true) == -1); /* Should succeed. */ |
86 | 99 |
|
87 | 100 | /*
|
88 | 101 | * Test a syscall within an active transaction and verify that
|
89 | 102 | * it fails with the correct failure code.
|
90 | 103 | */
|
91 |
| - FAIL_IF(getppid_tm(false) != -1); /* Should fail... */ |
| 104 | + FAIL_IF(getppid_tm(false, false) != -1); /* Should fail... */ |
92 | 105 | FAIL_IF(!failure_is_persistent()); /* ...persistently... */
|
93 | 106 | FAIL_IF(!failure_is_syscall()); /* ...with code syscall. */
|
| 107 | + |
| 108 | + /* Now do it all again with scv if it is available. */ |
| 109 | + if (have_hwcap2(PPC_FEATURE2_SCV)) { |
| 110 | + FAIL_IF(getppid_tm(true, true) == -1); /* Should succeed. */ |
| 111 | + FAIL_IF(getppid_tm(true, false) != -1); /* Should fail... */ |
| 112 | + FAIL_IF(!failure_is_persistent()); /* ...persistently... */ |
| 113 | + FAIL_IF(!failure_is_syscall()); /* ...with code syscall. */ |
| 114 | + } |
| 115 | + |
94 | 116 | gettimeofday(&now, 0);
|
95 | 117 | }
|
96 | 118 |
|
|
0 commit comments