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: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
Hendrik Brueckner 2018-08-29 17:46:06 +02:00 committed by Martin Schwidefsky
parent 17bebcc68e
commit 778fb10ccc
2 changed files with 39 additions and 0 deletions

View File

@ -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

View 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)
{