Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/cpumf: get rid of variable length array

The stcctm5 inline assembly uses a variable length array to specify
the memory that is written to. According to the gcc manual this trick
only works if the length is known at compile time. This is not the the
case for the stccm5 inline assembly.

Therefore simply use a full memory clobber. As requested by Martin
also move the output Q constraint operand to the input operands list,
since all we want is that the compiler generates an instruction that
may use the displacement field: in other words we only need the
address of *val. That the inline assembly actually writes to an array
starting at val is taken care of with the memory clobber.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Heiko Carstens and committed by
Martin Schwidefsky
e3850ecf 1d999577

+3 -2
+3 -2
arch/s390/include/asm/cpu_mf.h
··· 199 199 /* Store CPU counter multiple for the MT utilization counter set */ 200 200 static inline int stcctm5(u64 num, u64 *val) 201 201 { 202 - typedef struct { u64 _[num]; } addrtype; 203 202 int cc; 204 203 205 204 asm volatile ( 206 205 " .insn rsy,0xeb0000000017,%2,5,%1\n" 207 206 " ipm %0\n" 208 207 " srl %0,28\n" 209 - : "=d" (cc), "=Q" (*(addrtype *) val) : "d" (num) : "cc"); 208 + : "=d" (cc) 209 + : "Q" (*val), "d" (num) 210 + : "cc", "memory"); 210 211 return cc; 211 212 } 212 213