13
13
#include <linux/kmsan-checks.h>
14
14
#include <asm/asm-extable.h>
15
15
#include <asm/facility.h>
16
+ #include <asm/asm.h>
16
17
17
18
asm(".include \"asm/cpu_mf-insn.h\"\n" );
18
19
@@ -185,11 +186,12 @@ static inline int lcctl(u64 ctl)
185
186
int cc ;
186
187
187
188
asm volatile (
188
- " lcctl %1\n"
189
- " ipm %0\n"
190
- " srl %0,28\n"
191
- : "=d" (cc ) : "Q" (ctl ) : "cc" );
192
- return cc ;
189
+ " lcctl %[ctl]\n"
190
+ CC_IPM (cc )
191
+ : CC_OUT (cc , cc )
192
+ : [ctl ] "Q " (ctl)
193
+ : CC_CLOBBER );
194
+ return CC_TRANSFORM (cc );
193
195
}
194
196
195
197
/* Extract CPU counter */
@@ -199,12 +201,13 @@ static inline int __ecctr(u64 ctr, u64 *content)
199
201
int cc ;
200
202
201
203
asm volatile (
202
- " ecctr %0,%2\n"
203
- " ipm %1\n"
204
- " srl %1,28\n"
205
- : "=d" (_content ), "=d" (cc ) : "d" (ctr ) : "cc" );
204
+ " ecctr %[_content],%[ctr]\n"
205
+ CC_IPM (cc )
206
+ : CC_OUT (cc , cc ), [_content ] "= d " (_content)
207
+ : [ctr ] "d" (ctr )
208
+ : CC_CLOBBER );
206
209
* content = _content ;
207
- return cc ;
210
+ return CC_TRANSFORM ( cc ) ;
208
211
}
209
212
210
213
/* Extract CPU counter */
@@ -234,18 +237,17 @@ static __always_inline int stcctm(enum stcctm_ctr_set set, u64 range, u64 *dest)
234
237
int cc ;
235
238
236
239
asm volatile (
237
- " STCCTM %2,%3,%1\n"
238
- " ipm %0\n"
239
- " srl %0,28\n"
240
- : "=d" (cc )
241
- : "Q" (* dest ), "d" (range ), "i" (set )
242
- : "cc" , "memory" );
240
+ " STCCTM %[range],%[set],%[dest]\n"
241
+ CC_IPM (cc )
242
+ : CC_OUT (cc , cc )
243
+ : [dest ] "Q " (*dest), [range] " d " (range), [set] " i " (set)
244
+ : CC_CLOBBER_LIST (" memory "));
243
245
/*
244
246
* If cc == 2, less than RANGE counters are stored, but it's not easy
245
247
* to tell how many. Always unpoison the whole range for simplicity.
246
248
*/
247
249
kmsan_unpoison_memory (dest , range * sizeof (u64 ));
248
- return cc ;
250
+ return CC_TRANSFORM ( cc ) ;
249
251
}
250
252
251
253
/* Query sampling information */
@@ -265,19 +267,20 @@ static inline int qsi(struct hws_qsi_info_block *info)
265
267
/* Load sampling controls */
266
268
static inline int lsctl (struct hws_lsctl_request_block * req )
267
269
{
268
- int cc ;
270
+ int cc , exception ;
269
271
270
- cc = 1 ;
272
+ exception = 1 ;
271
273
asm volatile (
272
- "0: lsctl 0(%1)\n"
273
- "1: ipm %0\n"
274
- " srl %0,28\n"
274
+ "0: lsctl %[req]\n"
275
+ "1: lhi %[exc],0\n"
275
276
"2:\n"
277
+ CC_IPM (cc )
276
278
EX_TABLE (0b , 2b ) EX_TABLE (1b , 2b )
277
- : "+ d " (cc), " + a " (req)
278
- : " m " (*req)
279
- : " cc ", " memory ");
280
-
281
- return cc ? - EINVAL : 0 ;
279
+ : CC_OUT (cc , cc ), [exc ] "+ d " (exception)
280
+ : [req ] "Q" (* req )
281
+ : CC_CLOBBER );
282
+ if (exception || CC_TRANSFORM (cc ))
283
+ return - EINVAL ;
284
+ return 0 ;
282
285
}
283
286
#endif /* _ASM_S390_CPU_MF_H */
0 commit comments