diff options
author | Hendrik Brueckner <brueckner@linux.vnet.ibm.com> | 2013-12-11 06:15:52 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2013-12-16 08:37:50 -0500 |
commit | cf48ad83278aad39d4a0158cd085b6038b2941e6 (patch) | |
tree | 036ace9ca73805780dc305091c7d3025b171b72d /arch/s390/oprofile | |
parent | 52733e0152dad719ed6374b56fd1c33e784e44b3 (diff) |
s390/oprofile: move hwsampler interfaces to cpu_mf.h
Extract and move the oprofile hwsampler data structures and interfaces to
the cpu_mf.h header file which contains common interface definitions
for the various CPU-measurement facilities. This change is necessary for
a new perf PMU.
Few interface names have been revised to fit to the latest CPU-measurement
facilities documentation. Also declare the data structures as __packed and
correct checkpatch findings.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/oprofile')
-rw-r--r-- | arch/s390/oprofile/hwsampler.c | 67 | ||||
-rw-r--r-- | arch/s390/oprofile/hwsampler.h | 52 |
2 files changed, 4 insertions, 115 deletions
diff --git a/arch/s390/oprofile/hwsampler.c b/arch/s390/oprofile/hwsampler.c index 231cecafc2f1..bbca76ad6e1b 100644 --- a/arch/s390/oprofile/hwsampler.c +++ b/arch/s390/oprofile/hwsampler.c | |||
@@ -26,9 +26,6 @@ | |||
26 | #define MAX_NUM_SDB 511 | 26 | #define MAX_NUM_SDB 511 |
27 | #define MIN_NUM_SDB 1 | 27 | #define MIN_NUM_SDB 1 |
28 | 28 | ||
29 | #define ALERT_REQ_MASK 0x4000000000000000ul | ||
30 | #define BUFFER_FULL_MASK 0x8000000000000000ul | ||
31 | |||
32 | DECLARE_PER_CPU(struct hws_cpu_buffer, sampler_cpu_buffer); | 29 | DECLARE_PER_CPU(struct hws_cpu_buffer, sampler_cpu_buffer); |
33 | 30 | ||
34 | struct hws_execute_parms { | 31 | struct hws_execute_parms { |
@@ -65,43 +62,6 @@ static unsigned long interval; | |||
65 | static unsigned long min_sampler_rate; | 62 | static unsigned long min_sampler_rate; |
66 | static unsigned long max_sampler_rate; | 63 | static unsigned long max_sampler_rate; |
67 | 64 | ||
68 | static int ssctl(void *buffer) | ||
69 | { | ||
70 | int cc; | ||
71 | |||
72 | /* set in order to detect a program check */ | ||
73 | cc = 1; | ||
74 | |||
75 | asm volatile( | ||
76 | "0: .insn s,0xB2870000,0(%1)\n" | ||
77 | "1: ipm %0\n" | ||
78 | " srl %0,28\n" | ||
79 | "2:\n" | ||
80 | EX_TABLE(0b, 2b) EX_TABLE(1b, 2b) | ||
81 | : "+d" (cc), "+a" (buffer) | ||
82 | : "m" (*((struct hws_ssctl_request_block *)buffer)) | ||
83 | : "cc", "memory"); | ||
84 | |||
85 | return cc ? -EINVAL : 0 ; | ||
86 | } | ||
87 | |||
88 | static int qsi(void *buffer) | ||
89 | { | ||
90 | int cc; | ||
91 | cc = 1; | ||
92 | |||
93 | asm volatile( | ||
94 | "0: .insn s,0xB2860000,0(%1)\n" | ||
95 | "1: lhi %0,0\n" | ||
96 | "2:\n" | ||
97 | EX_TABLE(0b, 2b) EX_TABLE(1b, 2b) | ||
98 | : "=d" (cc), "+a" (buffer) | ||
99 | : "m" (*((struct hws_qsi_info_block *)buffer)) | ||
100 | : "cc", "memory"); | ||
101 | |||
102 | return cc ? -EINVAL : 0; | ||
103 | } | ||
104 | |||
105 | static void execute_qsi(void *parms) | 65 | static void execute_qsi(void *parms) |
106 | { | 66 | { |
107 | struct hws_execute_parms *ep = parms; | 67 | struct hws_execute_parms *ep = parms; |
@@ -113,7 +73,7 @@ static void execute_ssctl(void *parms) | |||
113 | { | 73 | { |
114 | struct hws_execute_parms *ep = parms; | 74 | struct hws_execute_parms *ep = parms; |
115 | 75 | ||
116 | ep->rc = ssctl(ep->buffer); | 76 | ep->rc = lsctl(ep->buffer); |
117 | } | 77 | } |
118 | 78 | ||
119 | static int smp_ctl_ssctl_stop(int cpu) | 79 | static int smp_ctl_ssctl_stop(int cpu) |
@@ -214,17 +174,6 @@ static int smp_ctl_qsi(int cpu) | |||
214 | return ep.rc; | 174 | return ep.rc; |
215 | } | 175 | } |
216 | 176 | ||
217 | static inline unsigned long *trailer_entry_ptr(unsigned long v) | ||
218 | { | ||
219 | void *ret; | ||
220 | |||
221 | ret = (void *)v; | ||
222 | ret += PAGE_SIZE; | ||
223 | ret -= sizeof(struct hws_trailer_entry); | ||
224 | |||
225 | return (unsigned long *) ret; | ||
226 | } | ||
227 | |||
228 | static void hws_ext_handler(struct ext_code ext_code, | 177 | static void hws_ext_handler(struct ext_code ext_code, |
229 | unsigned int param32, unsigned long param64) | 178 | unsigned int param32, unsigned long param64) |
230 | { | 179 | { |
@@ -256,16 +205,6 @@ static void init_all_cpu_buffers(void) | |||
256 | } | 205 | } |
257 | } | 206 | } |
258 | 207 | ||
259 | static int is_link_entry(unsigned long *s) | ||
260 | { | ||
261 | return *s & 0x1ul ? 1 : 0; | ||
262 | } | ||
263 | |||
264 | static unsigned long *get_next_sdbt(unsigned long *s) | ||
265 | { | ||
266 | return (unsigned long *) (*s & ~0x1ul); | ||
267 | } | ||
268 | |||
269 | static int prepare_cpu_buffers(void) | 208 | static int prepare_cpu_buffers(void) |
270 | { | 209 | { |
271 | int cpu; | 210 | int cpu; |
@@ -353,7 +292,7 @@ static int allocate_sdbt(int cpu) | |||
353 | } | 292 | } |
354 | *sdbt = sdb; | 293 | *sdbt = sdb; |
355 | trailer = trailer_entry_ptr(*sdbt); | 294 | trailer = trailer_entry_ptr(*sdbt); |
356 | *trailer = ALERT_REQ_MASK; | 295 | *trailer = SDB_TE_ALERT_REQ_MASK; |
357 | sdbt++; | 296 | sdbt++; |
358 | mutex_unlock(&hws_sem_oom); | 297 | mutex_unlock(&hws_sem_oom); |
359 | } | 298 | } |
@@ -829,7 +768,7 @@ static void worker_on_interrupt(unsigned int cpu) | |||
829 | 768 | ||
830 | trailer = trailer_entry_ptr(*sdbt); | 769 | trailer = trailer_entry_ptr(*sdbt); |
831 | /* leave loop if no more work to do */ | 770 | /* leave loop if no more work to do */ |
832 | if (!(*trailer & BUFFER_FULL_MASK)) { | 771 | if (!(*trailer & SDB_TE_BUFFER_FULL_MASK)) { |
833 | done = 1; | 772 | done = 1; |
834 | if (!hws_flush_all) | 773 | if (!hws_flush_all) |
835 | continue; | 774 | continue; |
diff --git a/arch/s390/oprofile/hwsampler.h b/arch/s390/oprofile/hwsampler.h index 0022e1ebfbde..a483d06f2fa7 100644 --- a/arch/s390/oprofile/hwsampler.h +++ b/arch/s390/oprofile/hwsampler.h | |||
@@ -9,27 +9,7 @@ | |||
9 | #define HWSAMPLER_H_ | 9 | #define HWSAMPLER_H_ |
10 | 10 | ||
11 | #include <linux/workqueue.h> | 11 | #include <linux/workqueue.h> |
12 | 12 | #include <asm/cpu_mf.h> | |
13 | struct hws_qsi_info_block /* QUERY SAMPLING information block */ | ||
14 | { /* Bit(s) */ | ||
15 | unsigned int b0_13:14; /* 0-13: zeros */ | ||
16 | unsigned int as:1; /* 14: sampling authorisation control*/ | ||
17 | unsigned int b15_21:7; /* 15-21: zeros */ | ||
18 | unsigned int es:1; /* 22: sampling enable control */ | ||
19 | unsigned int b23_29:7; /* 23-29: zeros */ | ||
20 | unsigned int cs:1; /* 30: sampling activation control */ | ||
21 | unsigned int:1; /* 31: reserved */ | ||
22 | unsigned int bsdes:16; /* 4-5: size of sampling entry */ | ||
23 | unsigned int:16; /* 6-7: reserved */ | ||
24 | unsigned long min_sampl_rate; /* 8-15: minimum sampling interval */ | ||
25 | unsigned long max_sampl_rate; /* 16-23: maximum sampling interval*/ | ||
26 | unsigned long tear; /* 24-31: TEAR contents */ | ||
27 | unsigned long dear; /* 32-39: DEAR contents */ | ||
28 | unsigned int rsvrd0; /* 40-43: reserved */ | ||
29 | unsigned int cpu_speed; /* 44-47: CPU speed */ | ||
30 | unsigned long long rsvrd1; /* 48-55: reserved */ | ||
31 | unsigned long long rsvrd2; /* 56-63: reserved */ | ||
32 | }; | ||
33 | 13 | ||
34 | struct hws_ssctl_request_block /* SET SAMPLING CONTROLS req block */ | 14 | struct hws_ssctl_request_block /* SET SAMPLING CONTROLS req block */ |
35 | { /* bytes 0 - 7 Bit(s) */ | 15 | { /* bytes 0 - 7 Bit(s) */ |
@@ -68,36 +48,6 @@ struct hws_cpu_buffer { | |||
68 | unsigned int stop_mode:1; | 48 | unsigned int stop_mode:1; |
69 | }; | 49 | }; |
70 | 50 | ||
71 | struct hws_data_entry { | ||
72 | unsigned int def:16; /* 0-15 Data Entry Format */ | ||
73 | unsigned int R:4; /* 16-19 reserved */ | ||
74 | unsigned int U:4; /* 20-23 Number of unique instruct. */ | ||
75 | unsigned int z:2; /* zeros */ | ||
76 | unsigned int T:1; /* 26 PSW DAT mode */ | ||
77 | unsigned int W:1; /* 27 PSW wait state */ | ||
78 | unsigned int P:1; /* 28 PSW Problem state */ | ||
79 | unsigned int AS:2; /* 29-30 PSW address-space control */ | ||
80 | unsigned int I:1; /* 31 entry valid or invalid */ | ||
81 | unsigned int:16; | ||
82 | unsigned int prim_asn:16; /* primary ASN */ | ||
83 | unsigned long long ia; /* Instruction Address */ | ||
84 | unsigned long long gpp; /* Guest Program Parameter */ | ||
85 | unsigned long long hpp; /* Host Program Parameter */ | ||
86 | }; | ||
87 | |||
88 | struct hws_trailer_entry { | ||
89 | unsigned int f:1; /* 0 - Block Full Indicator */ | ||
90 | unsigned int a:1; /* 1 - Alert request control */ | ||
91 | unsigned long:62; /* 2 - 63: Reserved */ | ||
92 | unsigned long overflow; /* 64 - sample Overflow count */ | ||
93 | unsigned long timestamp; /* 16 - time-stamp */ | ||
94 | unsigned long timestamp1; /* */ | ||
95 | unsigned long reserved1; /* 32 -Reserved */ | ||
96 | unsigned long reserved2; /* */ | ||
97 | unsigned long progusage1; /* 48 - reserved for programming use */ | ||
98 | unsigned long progusage2; /* */ | ||
99 | }; | ||
100 | |||
101 | int hwsampler_setup(void); | 51 | int hwsampler_setup(void); |
102 | int hwsampler_shutdown(void); | 52 | int hwsampler_shutdown(void); |
103 | int hwsampler_allocate(unsigned long sdbt, unsigned long sdb); | 53 | int hwsampler_allocate(unsigned long sdbt, unsigned long sdb); |