blob: 1912f3bb190cfbf9c7cf7218e84b2cd1555baf57 [file] [log] [blame]
Heinz Graalfsec6a3df2011-01-21 10:06:52 +00001/*
2 * CPUMF HW sampler functions and internal structures
3 *
4 * Copyright IBM Corp. 2010
5 * Author(s): Heinz Graalfs <graalfs@de.ibm.com>
6 */
7
8#ifndef HWSAMPLER_H_
9#define HWSAMPLER_H_
10
11#include <linux/workqueue.h>
12
13struct 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
34struct hws_ssctl_request_block /* SET SAMPLING CONTROLS req block */
35{ /* bytes 0 - 7 Bit(s) */
36 unsigned int s:1; /* 0: maximum buffer indicator */
37 unsigned int h:1; /* 1: part. level reserved for VM use*/
38 unsigned long b2_53:52; /* 2-53: zeros */
39 unsigned int es:1; /* 54: sampling enable control */
40 unsigned int b55_61:7; /* 55-61: - zeros */
41 unsigned int cs:1; /* 62: sampling activation control */
42 unsigned int b63:1; /* 63: zero */
43 unsigned long interval; /* 8-15: sampling interval */
44 unsigned long tear; /* 16-23: TEAR contents */
45 unsigned long dear; /* 24-31: DEAR contents */
46 /* 32-63: */
47 unsigned long rsvrd1; /* reserved */
48 unsigned long rsvrd2; /* reserved */
49 unsigned long rsvrd3; /* reserved */
50 unsigned long rsvrd4; /* reserved */
51};
52
53struct hws_cpu_buffer {
54 unsigned long first_sdbt; /* @ of 1st SDB-Table for this CP*/
55 unsigned long worker_entry;
56 unsigned long sample_overflow; /* taken from SDB ... */
57 struct hws_qsi_info_block qsi;
58 struct hws_ssctl_request_block ssctl;
59 struct work_struct worker;
60 atomic_t ext_params;
61 unsigned long req_alert;
62 unsigned long loss_of_sample_data;
63 unsigned long invalid_entry_address;
64 unsigned long incorrect_sdbt_entry;
65 unsigned long sample_auth_change_alert;
66 unsigned int finish:1;
67 unsigned int oom:1;
68 unsigned int stop_mode:1;
69};
70
71struct 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 lpp; /* Logical-Partition Program Param. */
85 unsigned long long vpp; /* Virtual-Machine Program Param. */
86};
87
88struct 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
101int hwsampler_setup(void);
102int hwsampler_shutdown(void);
103int hwsampler_allocate(unsigned long sdbt, unsigned long sdb);
104int hwsampler_deallocate(void);
Martin Schwidefsky3d8dcb32011-05-10 17:13:42 +0200105unsigned long hwsampler_query_min_interval(void);
106unsigned long hwsampler_query_max_interval(void);
Heinz Graalfsec6a3df2011-01-21 10:06:52 +0000107int hwsampler_start_all(unsigned long interval);
108int hwsampler_stop_all(void);
109int hwsampler_deactivate(unsigned int cpu);
110int hwsampler_activate(unsigned int cpu);
111unsigned long hwsampler_get_sample_overflow_count(unsigned int cpu);
112
113#endif /*HWSAMPLER_H_*/