xref: /linux/arch/powerpc/perf/hv-gpci-requests.h (revision f9bff0e31881d03badf191d3b0005839391f5f2b)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 
3 #include "req-gen/_begin.h"
4 
5 /*
6  * Based on the document "getPerfCountInfo v1.07"
7  */
8 
9 /*
10  * #define REQUEST_NAME counter_request_name
11  * #define REQUEST_NUM r_num
12  * #define REQUEST_IDX_KIND starting_index_kind
13  * #include I(REQUEST_BEGIN)
14  * REQUEST(
15  *	__field(...)
16  *	__field(...)
17  *	__array(...)
18  *	__count(...)
19  * )
20  * #include I(REQUEST_END)
21  *
22  * - starting_index_kind is one of the following, depending on the event:
23  *
24  *   hw_chip_id: hardware chip id or -1 for current hw chip
25  *   partition_id
26  *   sibling_part_id,
27  *   phys_processor_idx:
28  *   0xffffffffffffffff: or -1, which means it is irrelavant for the event
29  *
30  * __count(offset, bytes, name):
31  *	a counter that should be exposed via perf
32  * __field(offset, bytes, name)
33  *	a normal field
34  * __array(offset, bytes, name)
35  *	an array of bytes
36  *
37  *
38  *	@bytes for __count, and __field _must_ be a numeral token
39  *	in decimal, not an expression and not in hex.
40  *
41  *
42  * TODO:
43  *	- expose secondary index (if any counter ever uses it, only 0xA0
44  *	  appears to use it right now, and it doesn't have any counters)
45  *	- embed versioning info
46  *	- include counter descriptions
47  */
48 #define REQUEST_NAME dispatch_timebase_by_processor
49 #define REQUEST_NUM 0x10
50 #define REQUEST_IDX_KIND "phys_processor_idx=?"
51 #include I(REQUEST_BEGIN)
52 REQUEST(__count(0,	8,	processor_time_in_timebase_cycles)
53 	__field(0x8,	4,	hw_processor_id)
54 	__field(0xC,	2,	owning_part_id)
55 	__field(0xE,	1,	processor_state)
56 	__field(0xF,	1,	version)
57 	__field(0x10,	4,	hw_chip_id)
58 	__field(0x14,	4,	phys_module_id)
59 	__field(0x18,	4,	primary_affinity_domain_idx)
60 	__field(0x1C,	4,	secondary_affinity_domain_idx)
61 	__field(0x20,	4,	processor_version)
62 	__field(0x24,	2,	logical_processor_idx)
63 	__field(0x26,	2,	reserved)
64 	__field(0x28,	4,	processor_id_register)
65 	__field(0x2C,	4,	phys_processor_idx)
66 )
67 #include I(REQUEST_END)
68 
69 #define REQUEST_NAME entitled_capped_uncapped_donated_idle_timebase_by_partition
70 #define REQUEST_NUM 0x20
71 #define REQUEST_IDX_KIND "sibling_part_id=?"
72 #include I(REQUEST_BEGIN)
73 REQUEST(__field(0,	8,	partition_id)
74 	__count(0x8,	8,	entitled_cycles)
75 	__count(0x10,	8,	consumed_capped_cycles)
76 	__count(0x18,	8,	consumed_uncapped_cycles)
77 	__count(0x20,	8,	cycles_donated)
78 	__count(0x28,	8,	purr_idle_cycles)
79 )
80 #include I(REQUEST_END)
81 
82 #ifdef ENABLE_EVENTS_COUNTERINFO_V6
83 /*
84  * Not available for counter_info_version >= 0x8, use
85  * run_instruction_cycles_by_partition(0x100) instead.
86  */
87 #define REQUEST_NAME run_instructions_run_cycles_by_partition
88 #define REQUEST_NUM 0x30
89 #define REQUEST_IDX_KIND "sibling_part_id=?"
90 #include I(REQUEST_BEGIN)
91 REQUEST(__field(0,	8,	partition_id)
92 	__count(0x8,	8,	instructions_completed)
93 	__count(0x10,	8,	cycles)
94 )
95 #include I(REQUEST_END)
96 #endif
97 
98 #define REQUEST_NAME system_performance_capabilities
99 #define REQUEST_NUM 0x40
100 #define REQUEST_IDX_KIND "starting_index=0xffffffff"
101 #include I(REQUEST_BEGIN)
102 REQUEST(__field(0,	1,	perf_collect_privileged)
103 	__field(0x1,	1,	capability_mask)
104 	__array(0x2,	0xE,	reserved)
105 )
106 #include I(REQUEST_END)
107 
108 #ifdef ENABLE_EVENTS_COUNTERINFO_V6
109 #define REQUEST_NAME processor_bus_utilization_abc_links
110 #define REQUEST_NUM 0x50
111 #define REQUEST_IDX_KIND "hw_chip_id=?"
112 #include I(REQUEST_BEGIN)
113 REQUEST(__field(0,	4,	hw_chip_id)
114 	__array(0x4,	0xC,	reserved1)
115 	__count(0x10,	8,	total_link_cycles)
116 	__count(0x18,	8,	idle_cycles_for_a_link)
117 	__count(0x20,	8,	idle_cycles_for_b_link)
118 	__count(0x28,	8,	idle_cycles_for_c_link)
119 	__array(0x30,	0x20,	reserved2)
120 )
121 #include I(REQUEST_END)
122 
123 #define REQUEST_NAME processor_bus_utilization_wxyz_links
124 #define REQUEST_NUM 0x60
125 #define REQUEST_IDX_KIND "hw_chip_id=?"
126 #include I(REQUEST_BEGIN)
127 REQUEST(__field(0,	4,	hw_chip_id)
128 	__array(0x4,	0xC,	reserved1)
129 	__count(0x10,	8,	total_link_cycles)
130 	__count(0x18,	8,	idle_cycles_for_w_link)
131 	__count(0x20,	8,	idle_cycles_for_x_link)
132 	__count(0x28,	8,	idle_cycles_for_y_link)
133 	__count(0x30,	8,	idle_cycles_for_z_link)
134 	__array(0x38,	0x28,	reserved2)
135 )
136 #include I(REQUEST_END)
137 
138 #define REQUEST_NAME processor_bus_utilization_gx_links
139 #define REQUEST_NUM 0x70
140 #define REQUEST_IDX_KIND "hw_chip_id=?"
141 #include I(REQUEST_BEGIN)
142 REQUEST(__field(0,	4,	hw_chip_id)
143 	__array(0x4,	0xC,	reserved1)
144 	__count(0x10,	8,	gx0_in_address_cycles)
145 	__count(0x18,	8,	gx0_in_data_cycles)
146 	__count(0x20,	8,	gx0_in_retries)
147 	__count(0x28,	8,	gx0_in_bus_cycles)
148 	__count(0x30,	8,	gx0_in_cycles_total)
149 	__count(0x38,	8,	gx0_out_address_cycles)
150 	__count(0x40,	8,	gx0_out_data_cycles)
151 	__count(0x48,	8,	gx0_out_retries)
152 	__count(0x50,	8,	gx0_out_bus_cycles)
153 	__count(0x58,	8,	gx0_out_cycles_total)
154 	__count(0x60,	8,	gx1_in_address_cycles)
155 	__count(0x68,	8,	gx1_in_data_cycles)
156 	__count(0x70,	8,	gx1_in_retries)
157 	__count(0x78,	8,	gx1_in_bus_cycles)
158 	__count(0x80,	8,	gx1_in_cycles_total)
159 	__count(0x88,	8,	gx1_out_address_cycles)
160 	__count(0x90,	8,	gx1_out_data_cycles)
161 	__count(0x98,	8,	gx1_out_retries)
162 	__count(0xA0,	8,	gx1_out_bus_cycles)
163 	__count(0xA8,	8,	gx1_out_cycles_total)
164 )
165 #include I(REQUEST_END)
166 
167 #define REQUEST_NAME processor_bus_utilization_mc_links
168 #define REQUEST_NUM 0x80
169 #define REQUEST_IDX_KIND "hw_chip_id=?"
170 #include I(REQUEST_BEGIN)
171 REQUEST(__field(0,	4,	hw_chip_id)
172 	__array(0x4,	0xC,	reserved1)
173 	__count(0x10,	8,	mc0_frames)
174 	__count(0x18,	8,	mc0_reads)
175 	__count(0x20,	8,	mc0_write)
176 	__count(0x28,	8,	mc0_total_cycles)
177 	__count(0x30,	8,	mc1_frames)
178 	__count(0x38,	8,	mc1_reads)
179 	__count(0x40,	8,	mc1_writes)
180 	__count(0x48,	8,	mc1_total_cycles)
181 )
182 #include I(REQUEST_END)
183 
184 /* Processor_config (0x90) skipped, no counters */
185 /* Current_processor_frequency (0x91) skipped, no counters */
186 
187 #define REQUEST_NAME processor_core_utilization
188 #define REQUEST_NUM 0x94
189 #define REQUEST_IDX_KIND "phys_processor_idx=?"
190 #include I(REQUEST_BEGIN)
191 REQUEST(__field(0,	4,	phys_processor_idx)
192 	__field(0x4,	4,	hw_processor_id)
193 	__count(0x8,	8,	cycles_across_any_thread)
194 	__count(0x10,	8,	timebase_at_collection)
195 	__count(0x18,	8,	purr_cycles)
196 	__count(0x20,	8,	sum_of_cycles_across_all_threads)
197 	__count(0x28,	8,	instructions_completed)
198 )
199 #include I(REQUEST_END)
200 #endif
201 
202 /* Processor_core_power_mode (0x95) skipped, no counters */
203 /* Affinity_domain_information_by_virtual_processor (0xA0) skipped,
204  *	no counters */
205 /* Affinity_domain_information_by_domain (0xB0) skipped, no counters */
206 /* Affinity_domain_information_by_partition (0xB1) skipped, no counters */
207 /* Physical_memory_info (0xC0) skipped, no counters */
208 /* Processor_bus_topology (0xD0) skipped, no counters */
209 
210 #define REQUEST_NAME partition_hypervisor_queuing_times
211 #define REQUEST_NUM 0xE0
212 #define REQUEST_IDX_KIND "partition_id=?"
213 #include I(REQUEST_BEGIN)
214 REQUEST(__field(0,	2, partition_id)
215 	__array(0x2,	6, reserved1)
216 	__count(0x8,	8, time_waiting_for_entitlement)
217 	__count(0x10,	8, times_waited_for_entitlement)
218 	__count(0x18,	8, time_waiting_for_phys_processor)
219 	__count(0x20,	8, times_waited_for_phys_processor)
220 	__count(0x28,	8, dispatches_on_home_core)
221 	__count(0x30,	8, dispatches_on_home_primary_affinity_domain)
222 	__count(0x38,	8, dispatches_on_home_secondary_affinity_domain)
223 	__count(0x40,	8, dispatches_off_home_secondary_affinity_domain)
224 	__count(0x48,	8, dispatches_on_dedicated_processor_donating_cycles)
225 )
226 #include I(REQUEST_END)
227 
228 #define REQUEST_NAME system_hypervisor_times
229 #define REQUEST_NUM 0xF0
230 #define REQUEST_IDX_KIND "starting_index=0xffffffff"
231 #include I(REQUEST_BEGIN)
232 REQUEST(__count(0,	8,	time_spent_to_dispatch_virtual_processors)
233 	__count(0x8,	8,	time_spent_processing_virtual_processor_timers)
234 	__count(0x10,	8,	time_spent_managing_partitions_over_entitlement)
235 	__count(0x18,	8,	time_spent_on_system_management)
236 )
237 #include I(REQUEST_END)
238 
239 #define REQUEST_NAME system_tlbie_count_and_time
240 #define REQUEST_NUM 0xF4
241 #define REQUEST_IDX_KIND "starting_index=0xffffffff"
242 #include I(REQUEST_BEGIN)
243 REQUEST(__count(0,	8,	tlbie_instructions_issued)
244 	/*
245 	 * FIXME: The spec says the offset here is 0x10, which I suspect
246 	 *	  is wrong.
247 	 */
248 	__count(0x8,	8,	time_spent_issuing_tlbies)
249 )
250 #include I(REQUEST_END)
251 
252 #define REQUEST_NAME partition_instruction_count_and_time
253 #define REQUEST_NUM 0x100
254 #define REQUEST_IDX_KIND "partition_id=?"
255 #include I(REQUEST_BEGIN)
256 REQUEST(__field(0,	2,	partition_id)
257 	__array(0x2,	0x6,	reserved1)
258 	__count(0x8,	8,	instructions_performed)
259 	__count(0x10,	8,	time_collected)
260 )
261 #include I(REQUEST_END)
262 
263 /* set_mmcrh (0x80001000) skipped, no counters */
264 /* retrieve_hpmcx (0x80002000) skipped, no counters */
265 
266 #include "req-gen/_end.h"
267