Loading...
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef LINUX_POWERPC_PERF_HV_24X7_H_
3#define LINUX_POWERPC_PERF_HV_24X7_H_
4
5#include <linux/types.h>
6
7enum hv_perf_domains {
8#define DOMAIN(n, v, x, c) HV_PERF_DOMAIN_##n = v,
9#include "hv-24x7-domains.h"
10#undef DOMAIN
11 HV_PERF_DOMAIN_MAX,
12};
13
14#define H24x7_REQUEST_SIZE(iface_version) (iface_version == 1 ? 16 : 32)
15
16struct hv_24x7_request {
17 /* PHYSICAL domains require enabling via phyp/hmc. */
18 __u8 performance_domain;
19 __u8 reserved[0x1];
20
21 /* bytes to read starting at @data_offset. must be a multiple of 8 */
22 __be16 data_size;
23
24 /*
25 * byte offset within the perf domain to read from. must be 8 byte
26 * aligned
27 */
28 __be32 data_offset;
29
30 /*
31 * only valid for VIRTUAL_PROCESSOR domains, ignored for others.
32 * -1 means "current partition only"
33 * Enabling via phyp/hmc required for non-"-1" values. 0 forbidden
34 * unless requestor is 0.
35 */
36 __be16 starting_lpar_ix;
37
38 /*
39 * Ignored when @starting_lpar_ix == -1
40 * Ignored when @performance_domain is not VIRTUAL_PROCESSOR_*
41 * -1 means "infinite" or all
42 */
43 __be16 max_num_lpars;
44
45 /* chip, core, or virtual processor based on @performance_domain */
46 __be16 starting_ix;
47 __be16 max_ix;
48
49 /* The following fields were added in v2 of the 24x7 interface. */
50
51 __u8 starting_thread_group_ix;
52
53 /* -1 means all thread groups starting at @starting_thread_group_ix */
54 __u8 max_num_thread_groups;
55
56 __u8 reserved2[0xE];
57} __packed;
58
59struct hv_24x7_request_buffer {
60 /* 0 - ? */
61 /* 1 - ? */
62 __u8 interface_version;
63 __u8 num_requests;
64 __u8 reserved[0xE];
65 struct hv_24x7_request requests[];
66} __packed;
67
68struct hv_24x7_result_element_v1 {
69 __be16 lpar_ix;
70
71 /*
72 * represents the core, chip, or virtual processor based on the
73 * request's @performance_domain
74 */
75 __be16 domain_ix;
76
77 /* -1 if @performance_domain does not refer to a virtual processor */
78 __be32 lpar_cfg_instance_id;
79
80 /* size = @result_element_data_size of containing result. */
81 __u64 element_data[];
82} __packed;
83
84/*
85 * We need a separate struct for v2 because the offset of @element_data changed
86 * between versions.
87 */
88struct hv_24x7_result_element_v2 {
89 __be16 lpar_ix;
90
91 /*
92 * represents the core, chip, or virtual processor based on the
93 * request's @performance_domain
94 */
95 __be16 domain_ix;
96
97 /* -1 if @performance_domain does not refer to a virtual processor */
98 __be32 lpar_cfg_instance_id;
99
100 __u8 thread_group_ix;
101
102 __u8 reserved[7];
103
104 /* size = @result_element_data_size of containing result. */
105 __u64 element_data[];
106} __packed;
107
108struct hv_24x7_result {
109 /*
110 * The index of the 24x7 Request Structure in the 24x7 Request Buffer
111 * used to request this result.
112 */
113 __u8 result_ix;
114
115 /*
116 * 0 = not all result elements fit into the buffer, additional requests
117 * required
118 * 1 = all result elements were returned
119 */
120 __u8 results_complete;
121 __be16 num_elements_returned;
122
123 /*
124 * This is a copy of @data_size from the corresponding hv_24x7_request
125 *
126 * Warning: to obtain the size of each element in @elements you have
127 * to add the size of the other members of the result_element struct.
128 */
129 __be16 result_element_data_size;
130 __u8 reserved[0x2];
131
132 /*
133 * Either
134 * struct hv_24x7_result_element_v1[@num_elements_returned]
135 * or
136 * struct hv_24x7_result_element_v2[@num_elements_returned]
137 *
138 * depending on the interface_version field of the
139 * struct hv_24x7_data_result_buffer containing this result.
140 */
141 char elements[];
142} __packed;
143
144struct hv_24x7_data_result_buffer {
145 /* See versioning for request buffer */
146 __u8 interface_version;
147
148 __u8 num_results;
149 __u8 reserved[0x1];
150 __u8 failing_request_ix;
151 __be32 detailed_rc;
152 __be64 cec_cfg_instance_id;
153 __be64 catalog_version_num;
154 __u8 reserved2[0x8];
155 /* WARNING: only valid for the first result due to variable sizes of
156 * results */
157 struct hv_24x7_result results[]; /* [@num_results] */
158} __packed;
159
160#endif
1#ifndef LINUX_POWERPC_PERF_HV_24X7_H_
2#define LINUX_POWERPC_PERF_HV_24X7_H_
3
4#include <linux/types.h>
5
6enum hv_perf_domains {
7#define DOMAIN(n, v, x, c) HV_PERF_DOMAIN_##n = v,
8#include "hv-24x7-domains.h"
9#undef DOMAIN
10 HV_PERF_DOMAIN_MAX,
11};
12
13struct hv_24x7_request {
14 /* PHYSICAL domains require enabling via phyp/hmc. */
15 __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];
54 struct hv_24x7_request requests[1];
55} __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. */
70 __u64 element_data[1];
71} __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
84 /* This is a copy of @data_size from the corresponding hv_24x7_request */
85 __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] */
91 struct hv_24x7_result_element elements[1];
92} __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 */
107 struct hv_24x7_result results[1]; /* [@num_results] */
108} __packed;
109
110#endif