blob: a483d06f2fa78e0740213f51d4a7782ccff27fea [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>
Hendrik Bruecknercf48ad82013-12-11 12:15:52 +010012#include <asm/cpu_mf.h>
Heinz Graalfsec6a3df2011-01-21 10:06:52 +000013
14struct hws_ssctl_request_block /* SET SAMPLING CONTROLS req block */
15{ /* bytes 0 - 7 Bit(s) */
16 unsigned int s:1; /* 0: maximum buffer indicator */
17 unsigned int h:1; /* 1: part. level reserved for VM use*/
18 unsigned long b2_53:52; /* 2-53: zeros */
19 unsigned int es:1; /* 54: sampling enable control */
20 unsigned int b55_61:7; /* 55-61: - zeros */
21 unsigned int cs:1; /* 62: sampling activation control */
22 unsigned int b63:1; /* 63: zero */
23 unsigned long interval; /* 8-15: sampling interval */
24 unsigned long tear; /* 16-23: TEAR contents */
25 unsigned long dear; /* 24-31: DEAR contents */
26 /* 32-63: */
27 unsigned long rsvrd1; /* reserved */
28 unsigned long rsvrd2; /* reserved */
29 unsigned long rsvrd3; /* reserved */
30 unsigned long rsvrd4; /* reserved */
31};
32
33struct hws_cpu_buffer {
34 unsigned long first_sdbt; /* @ of 1st SDB-Table for this CP*/
35 unsigned long worker_entry;
36 unsigned long sample_overflow; /* taken from SDB ... */
37 struct hws_qsi_info_block qsi;
38 struct hws_ssctl_request_block ssctl;
39 struct work_struct worker;
40 atomic_t ext_params;
41 unsigned long req_alert;
42 unsigned long loss_of_sample_data;
43 unsigned long invalid_entry_address;
44 unsigned long incorrect_sdbt_entry;
45 unsigned long sample_auth_change_alert;
46 unsigned int finish:1;
47 unsigned int oom:1;
48 unsigned int stop_mode:1;
49};
50
Heinz Graalfsec6a3df2011-01-21 10:06:52 +000051int hwsampler_setup(void);
52int hwsampler_shutdown(void);
53int hwsampler_allocate(unsigned long sdbt, unsigned long sdb);
54int hwsampler_deallocate(void);
Martin Schwidefsky3d8dcb32011-05-10 17:13:42 +020055unsigned long hwsampler_query_min_interval(void);
56unsigned long hwsampler_query_max_interval(void);
Heinz Graalfsec6a3df2011-01-21 10:06:52 +000057int hwsampler_start_all(unsigned long interval);
58int hwsampler_stop_all(void);
59int hwsampler_deactivate(unsigned int cpu);
60int hwsampler_activate(unsigned int cpu);
61unsigned long hwsampler_get_sample_overflow_count(unsigned int cpu);
62
63#endif /*HWSAMPLER_H_*/