diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-27 21:36:38 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-27 21:36:38 -0400 |
commit | 6658a6991cef75719a21441aa0b7f8d6821534ee (patch) | |
tree | 656bd5785f225929c73b43b31d6eda35fab93026 /arch/s390/include/asm/cpu_mf.h | |
parent | fa453a625de5b8ee9ada0a5b329df3f88751c615 (diff) | |
parent | 5d3b56f93244dd5f64f60601bf63caf70d693f75 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 patches part 2 from Martin Schwidefsky:
"Some minor improvements and one additional feature for the 3.4 merge
window: Hendrik added perf support for the s390 CPU counters."
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
[S390] register cpu devices for SMP=n
[S390] perf: add support for s390x CPU counters
[S390] oprofile: Allow multiple users of the measurement alert interrupt
[S390] qdio: log all adapter characteristics
[S390] Remove unncessary export of arch_pick_mmap_layout
Diffstat (limited to 'arch/s390/include/asm/cpu_mf.h')
-rw-r--r-- | arch/s390/include/asm/cpu_mf.h | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/arch/s390/include/asm/cpu_mf.h b/arch/s390/include/asm/cpu_mf.h new file mode 100644 index 000000000000..e49db5d5d06f --- /dev/null +++ b/arch/s390/include/asm/cpu_mf.h | |||
@@ -0,0 +1,95 @@ | |||
1 | /* | ||
2 | * CPU-measurement facilities | ||
3 | * | ||
4 | * Copyright IBM Corp. 2012 | ||
5 | * Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com> | ||
6 | * Jan Glauber <jang@linux.vnet.ibm.com> | ||
7 | * | ||
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. | ||
11 | */ | ||
12 | #ifndef _ASM_S390_CPU_MF_H | ||
13 | #define _ASM_S390_CPU_MF_H | ||
14 | |||
15 | #define CPU_MF_INT_SF_IAE (1 << 31) /* invalid entry address */ | ||
16 | #define CPU_MF_INT_SF_ISE (1 << 30) /* incorrect SDBT entry */ | ||
17 | #define CPU_MF_INT_SF_PRA (1 << 29) /* program request alert */ | ||
18 | #define CPU_MF_INT_SF_SACA (1 << 23) /* sampler auth. change alert */ | ||
19 | #define CPU_MF_INT_SF_LSDA (1 << 22) /* loss of sample data alert */ | ||
20 | #define CPU_MF_INT_CF_CACA (1 << 7) /* counter auth. change alert */ | ||
21 | #define CPU_MF_INT_CF_LCDA (1 << 6) /* loss of counter data alert */ | ||
22 | |||
23 | #define CPU_MF_INT_CF_MASK (CPU_MF_INT_CF_CACA|CPU_MF_INT_CF_LCDA) | ||
24 | #define CPU_MF_INT_SF_MASK (CPU_MF_INT_SF_IAE|CPU_MF_INT_SF_ISE| \ | ||
25 | CPU_MF_INT_SF_PRA|CPU_MF_INT_SF_SACA| \ | ||
26 | CPU_MF_INT_SF_LSDA) | ||
27 | |||
28 | /* CPU measurement facility support */ | ||
29 | static inline int cpum_cf_avail(void) | ||
30 | { | ||
31 | return MACHINE_HAS_SPP && test_facility(67); | ||
32 | } | ||
33 | |||
34 | static inline int cpum_sf_avail(void) | ||
35 | { | ||
36 | return MACHINE_HAS_SPP && test_facility(68); | ||
37 | } | ||
38 | |||
39 | |||
40 | struct cpumf_ctr_info { | ||
41 | u16 cfvn; | ||
42 | u16 auth_ctl; | ||
43 | u16 enable_ctl; | ||
44 | u16 act_ctl; | ||
45 | u16 max_cpu; | ||
46 | u16 csvn; | ||
47 | u16 max_cg; | ||
48 | u16 reserved1; | ||
49 | u32 reserved2[12]; | ||
50 | } __packed; | ||
51 | |||
52 | /* Query counter information */ | ||
53 | static inline int qctri(struct cpumf_ctr_info *info) | ||
54 | { | ||
55 | int rc = -EINVAL; | ||
56 | |||
57 | asm volatile ( | ||
58 | "0: .insn s,0xb28e0000,%1\n" | ||
59 | "1: lhi %0,0\n" | ||
60 | "2:\n" | ||
61 | EX_TABLE(1b, 2b) | ||
62 | : "+d" (rc), "=Q" (*info)); | ||
63 | return rc; | ||
64 | } | ||
65 | |||
66 | /* Load CPU-counter-set controls */ | ||
67 | static inline int lcctl(u64 ctl) | ||
68 | { | ||
69 | int cc; | ||
70 | |||
71 | asm volatile ( | ||
72 | " .insn s,0xb2840000,%1\n" | ||
73 | " ipm %0\n" | ||
74 | " srl %0,28\n" | ||
75 | : "=d" (cc) : "m" (ctl) : "cc"); | ||
76 | return cc; | ||
77 | } | ||
78 | |||
79 | /* Extract CPU counter */ | ||
80 | static inline int ecctr(u64 ctr, u64 *val) | ||
81 | { | ||
82 | register u64 content asm("4") = 0; | ||
83 | int cc; | ||
84 | |||
85 | asm volatile ( | ||
86 | " .insn rre,0xb2e40000,%0,%2\n" | ||
87 | " ipm %1\n" | ||
88 | " srl %1,28\n" | ||
89 | : "=d" (content), "=d" (cc) : "d" (ctr) : "cc"); | ||
90 | if (!cc) | ||
91 | *val = content; | ||
92 | return cc; | ||
93 | } | ||
94 | |||
95 | #endif /* _ASM_S390_CPU_MF_H */ | ||