2 * CPU-measurement facilities
4 * Copyright IBM Corp. 2012
5 * Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
6 * Jan Glauber <jang@linux.vnet.ibm.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License (version 2 only)
10 * as published by the Free Software Foundation.
12 #ifndef _ASM_S390_CPU_MF_H
13 #define _ASM_S390_CPU_MF_H
15 #include <asm/facility.h>
17 #define CPU_MF_INT_SF_IAE (1 << 31) /* invalid entry address */
18 #define CPU_MF_INT_SF_ISE (1 << 30) /* incorrect SDBT entry */
19 #define CPU_MF_INT_SF_PRA (1 << 29) /* program request alert */
20 #define CPU_MF_INT_SF_SACA (1 << 23) /* sampler auth. change alert */
21 #define CPU_MF_INT_SF_LSDA (1 << 22) /* loss of sample data alert */
22 #define CPU_MF_INT_CF_CACA (1 << 7) /* counter auth. change alert */
23 #define CPU_MF_INT_CF_LCDA (1 << 6) /* loss of counter data alert */
25 #define CPU_MF_INT_CF_MASK (CPU_MF_INT_CF_CACA|CPU_MF_INT_CF_LCDA)
26 #define CPU_MF_INT_SF_MASK (CPU_MF_INT_SF_IAE|CPU_MF_INT_SF_ISE| \
27 CPU_MF_INT_SF_PRA|CPU_MF_INT_SF_SACA| \
30 /* CPU measurement facility support */
31 static inline int cpum_cf_avail(void)
33 return MACHINE_HAS_SPP
&& test_facility(67);
36 static inline int cpum_sf_avail(void)
38 return MACHINE_HAS_SPP
&& test_facility(68);
42 struct cpumf_ctr_info
{
54 /* Query counter information */
55 static inline int qctri(struct cpumf_ctr_info
*info
)
60 "0: .insn s,0xb28e0000,%1\n"
64 : "+d" (rc
), "=Q" (*info
));
68 /* Load CPU-counter-set controls */
69 static inline int lcctl(u64 ctl
)
74 " .insn s,0xb2840000,%1\n"
77 : "=d" (cc
) : "m" (ctl
) : "cc");
81 /* Extract CPU counter */
82 static inline int ecctr(u64 ctr
, u64
*val
)
84 register u64 content
asm("4") = 0;
88 " .insn rre,0xb2e40000,%0,%2\n"
91 : "=d" (content
), "=d" (cc
) : "d" (ctr
) : "cc");
97 #endif /* _ASM_S390_CPU_MF_H */