Commit 778fb10c authored by Hendrik Brueckner's avatar Hendrik Brueckner Committed by Martin Schwidefsky

s390/cpu_mf: add store cpu counter multiple instruction support

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: default avatarHendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 17bebcc6
/* 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
......@@ -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)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment