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