blob: 791455e7f5cf7a93cd38f6ab6afddb3dfba82eab [file] [log] [blame]
Cody P Schafera8b2c432014-03-14 16:00:38 +11001#ifndef LINUX_POWERPC_PERF_HV_24X7_H_
2#define LINUX_POWERPC_PERF_HV_24X7_H_
3
4#include <linux/types.h>
5
Cody P Schafer5c5cd7b2015-01-30 13:46:00 -08006enum hv_perf_domains {
7#define DOMAIN(n, v, x, c) HV_PERF_DOMAIN_##n = v,
8#include "hv-24x7-domains.h"
9#undef DOMAIN
Sukadev Bhattiprolud34171e2016-02-16 20:07:51 -050010 HV_PERF_DOMAIN_MAX,
Cody P Schafer5c5cd7b2015-01-30 13:46:00 -080011};
12
Cody P Schafera8b2c432014-03-14 16:00:38 +110013struct hv_24x7_request {
14 /* PHYSICAL domains require enabling via phyp/hmc. */
Cody P Schafera8b2c432014-03-14 16:00:38 +110015 __u8 performance_domain;
16 __u8 reserved[0x1];
17
18 /* bytes to read starting at @data_offset. must be a multiple of 8 */
19 __be16 data_size;
20
21 /*
22 * byte offset within the perf domain to read from. must be 8 byte
23 * aligned
24 */
25 __be32 data_offset;
26
27 /*
28 * only valid for VIRTUAL_PROCESSOR domains, ignored for others.
29 * -1 means "current partition only"
30 * Enabling via phyp/hmc required for non-"-1" values. 0 forbidden
31 * unless requestor is 0.
32 */
33 __be16 starting_lpar_ix;
34
35 /*
36 * Ignored when @starting_lpar_ix == -1
37 * Ignored when @performance_domain is not VIRTUAL_PROCESSOR_*
38 * -1 means "infinite" or all
39 */
40 __be16 max_num_lpars;
41
42 /* chip, core, or virtual processor based on @performance_domain */
43 __be16 starting_ix;
44 __be16 max_ix;
45} __packed;
46
47struct hv_24x7_request_buffer {
48 /* 0 - ? */
49 /* 1 - ? */
50#define HV_24X7_IF_VERSION_CURRENT 0x01
51 __u8 interface_version;
52 __u8 num_requests;
53 __u8 reserved[0xE];
Sukadev Bhattiprolu145264e2015-03-30 18:53:38 -070054 struct hv_24x7_request requests[1];
Cody P Schafera8b2c432014-03-14 16:00:38 +110055} __packed;
56
57struct hv_24x7_result_element {
58 __be16 lpar_ix;
59
60 /*
61 * represents the core, chip, or virtual processor based on the
62 * request's @performance_domain
63 */
64 __be16 domain_ix;
65
66 /* -1 if @performance_domain does not refer to a virtual processor */
67 __be32 lpar_cfg_instance_id;
68
69 /* size = @result_element_data_size of cointaining result. */
Sukadev Bhattiprolu145264e2015-03-30 18:53:38 -070070 __u64 element_data[1];
Cody P Schafera8b2c432014-03-14 16:00:38 +110071} __packed;
72
73struct hv_24x7_result {
74 __u8 result_ix;
75
76 /*
77 * 0 = not all result elements fit into the buffer, additional requests
78 * required
79 * 1 = all result elements were returned
80 */
81 __u8 results_complete;
82 __be16 num_elements_returned;
83
Adam Buchbinder446957b2016-02-24 10:51:11 -080084 /* This is a copy of @data_size from the corresponding hv_24x7_request */
Cody P Schafera8b2c432014-03-14 16:00:38 +110085 __be16 result_element_data_size;
86 __u8 reserved[0x2];
87
88 /* WARNING: only valid for first result element due to variable sizes
89 * of result elements */
90 /* struct hv_24x7_result_element[@num_elements_returned] */
Sukadev Bhattiprolu145264e2015-03-30 18:53:38 -070091 struct hv_24x7_result_element elements[1];
Cody P Schafera8b2c432014-03-14 16:00:38 +110092} __packed;
93
94struct hv_24x7_data_result_buffer {
95 /* See versioning for request buffer */
96 __u8 interface_version;
97
98 __u8 num_results;
99 __u8 reserved[0x1];
100 __u8 failing_request_ix;
101 __be32 detailed_rc;
102 __be64 cec_cfg_instance_id;
103 __be64 catalog_version_num;
104 __u8 reserved2[0x8];
105 /* WARNING: only valid for the first result due to variable sizes of
106 * results */
Sukadev Bhattiprolu145264e2015-03-30 18:53:38 -0700107 struct hv_24x7_result results[1]; /* [@num_results] */
Cody P Schafera8b2c432014-03-14 16:00:38 +1100108} __packed;
109
110#endif