]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
s390/cpu_mf: add store cpu counter multiple instruction support
authorHendrik Brueckner <brueckner@linux.ibm.com>
Wed, 29 Aug 2018 15:46:06 +0000 (17:46 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Fri, 22 Feb 2019 08:19:52 +0000 (09:19 +0100)
Add support for the STORE CPU COUNTER MULTIPLE instruction to extract
a range of counters from a counter set.

An assembler macro is used to create the instruction opcode because
the counter set identifier is part of the instruction and, thus,
cannot be easily specified as parameter.

Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/include/asm/cpu_mf-insn.h [new file with mode: 0644]
arch/s390/include/asm/cpu_mf.h

diff --git a/arch/s390/include/asm/cpu_mf-insn.h b/arch/s390/include/asm/cpu_mf-insn.h
new file mode 100644 (file)
index 0000000..a68b362
--- /dev/null
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Support for CPU-MF instructions
+ *
+ * Copyright IBM Corp. 2019
+ * Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
+ */
+#ifndef _ASM_S390_CPU_MF_INSN_H
+#define _ASM_S390_CPU_MF_INSN_H
+
+#ifdef __ASSEMBLY__
+
+/* Macro to generate the STCCTM instruction with a customized
+ * M3 field designating the counter set.
+ */
+.macro STCCTM  r1 m3 db2
+       .insn   rsy,0xeb0000000017,\r1,\m3 & 0xf,\db2
+.endm
+
+#endif /* __ASSEMBLY__ */
+
+#endif
index bf2cbff926ef8ca60ebccb3c6362ae0323b04503..53ba4f2ca296193e2d7623b47e9e602faee3532c 100644 (file)
@@ -12,6 +12,8 @@
 #include <linux/errno.h>
 #include <asm/facility.h>
 
+asm(".include \"asm/cpu_mf-insn.h\"\n");
+
 #define CPU_MF_INT_SF_IAE      (1 << 31)       /* invalid entry address */
 #define CPU_MF_INT_SF_ISE      (1 << 30)       /* incorrect SDBT entry */
 #define CPU_MF_INT_SF_PRA      (1 << 29)       /* program request alert */
@@ -209,6 +211,21 @@ static inline int ecctr(u64 ctr, u64 *val)
        return cc;
 }
 
+/* Store CPU counter multiple for a particular counter set */
+static inline int stcctm(u8 set, u64 range, u64 *dest)
+{
+       int cc;
+
+       asm volatile (
+               "       STCCTM  %2,%3,%1\n"
+               "       ipm     %0\n"
+               "       srl     %0,28\n"
+               : "=d" (cc)
+               : "Q" (*dest), "d" (range), "i" (set)
+               : "cc", "memory");
+       return cc;
+}
+
 /* Store CPU counter multiple for the MT utilization counter set */
 static inline int stcctm5(u64 num, u64 *val)
 {