xref: /openbmc/linux/arch/powerpc/perf/hv-gpci-requests.h (revision 0f9866f7e85765bbda86666df56c92f377c3bc10)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
29e9f6010SCody P Schafer 
39e9f6010SCody P Schafer #include "req-gen/_begin.h"
49e9f6010SCody P Schafer 
59e9f6010SCody P Schafer /*
69e9f6010SCody P Schafer  * Based on the document "getPerfCountInfo v1.07"
79e9f6010SCody P Schafer  */
89e9f6010SCody P Schafer 
99e9f6010SCody P Schafer /*
109e9f6010SCody P Schafer  * #define REQUEST_NAME counter_request_name
119e9f6010SCody P Schafer  * #define REQUEST_NUM r_num
129e9f6010SCody P Schafer  * #define REQUEST_IDX_KIND starting_index_kind
139e9f6010SCody P Schafer  * #include I(REQUEST_BEGIN)
149e9f6010SCody P Schafer  * REQUEST(
159e9f6010SCody P Schafer  *	__field(...)
169e9f6010SCody P Schafer  *	__field(...)
179e9f6010SCody P Schafer  *	__array(...)
189e9f6010SCody P Schafer  *	__count(...)
199e9f6010SCody P Schafer  * )
209e9f6010SCody P Schafer  * #include I(REQUEST_END)
219e9f6010SCody P Schafer  *
229e9f6010SCody P Schafer  * - starting_index_kind is one of the following, depending on the event:
239e9f6010SCody P Schafer  *
2497bf2640SCody P Schafer  *   hw_chip_id: hardware chip id or -1 for current hw chip
2597bf2640SCody P Schafer  *   partition_id
2697bf2640SCody P Schafer  *   sibling_part_id,
279e9f6010SCody P Schafer  *   phys_processor_idx:
289e9f6010SCody P Schafer  *   0xffffffffffffffff: or -1, which means it is irrelavant for the event
299e9f6010SCody P Schafer  *
309e9f6010SCody P Schafer  * __count(offset, bytes, name):
319e9f6010SCody P Schafer  *	a counter that should be exposed via perf
329e9f6010SCody P Schafer  * __field(offset, bytes, name)
339e9f6010SCody P Schafer  *	a normal field
349e9f6010SCody P Schafer  * __array(offset, bytes, name)
359e9f6010SCody P Schafer  *	an array of bytes
369e9f6010SCody P Schafer  *
379e9f6010SCody P Schafer  *
389e9f6010SCody P Schafer  *	@bytes for __count, and __field _must_ be a numeral token
399e9f6010SCody P Schafer  *	in decimal, not an expression and not in hex.
409e9f6010SCody P Schafer  *
419e9f6010SCody P Schafer  *
429e9f6010SCody P Schafer  * TODO:
439e9f6010SCody P Schafer  *	- expose secondary index (if any counter ever uses it, only 0xA0
449e9f6010SCody P Schafer  *	  appears to use it right now, and it doesn't have any counters)
459e9f6010SCody P Schafer  *	- embed versioning info
469e9f6010SCody P Schafer  *	- include counter descriptions
479e9f6010SCody P Schafer  */
489e9f6010SCody P Schafer #define REQUEST_NAME dispatch_timebase_by_processor
499e9f6010SCody P Schafer #define REQUEST_NUM 0x10
509e9f6010SCody P Schafer #define REQUEST_IDX_KIND "phys_processor_idx=?"
519e9f6010SCody P Schafer #include I(REQUEST_BEGIN)
529e9f6010SCody P Schafer REQUEST(__count(0,	8,	processor_time_in_timebase_cycles)
539e9f6010SCody P Schafer 	__field(0x8,	4,	hw_processor_id)
549e9f6010SCody P Schafer 	__field(0xC,	2,	owning_part_id)
559e9f6010SCody P Schafer 	__field(0xE,	1,	processor_state)
569e9f6010SCody P Schafer 	__field(0xF,	1,	version)
579e9f6010SCody P Schafer 	__field(0x10,	4,	hw_chip_id)
589e9f6010SCody P Schafer 	__field(0x14,	4,	phys_module_id)
599e9f6010SCody P Schafer 	__field(0x18,	4,	primary_affinity_domain_idx)
609e9f6010SCody P Schafer 	__field(0x1C,	4,	secondary_affinity_domain_idx)
619e9f6010SCody P Schafer 	__field(0x20,	4,	processor_version)
629e9f6010SCody P Schafer 	__field(0x24,	2,	logical_processor_idx)
639e9f6010SCody P Schafer 	__field(0x26,	2,	reserved)
649e9f6010SCody P Schafer 	__field(0x28,	4,	processor_id_register)
659e9f6010SCody P Schafer 	__field(0x2C,	4,	phys_processor_idx)
669e9f6010SCody P Schafer )
679e9f6010SCody P Schafer #include I(REQUEST_END)
689e9f6010SCody P Schafer 
6997bf2640SCody P Schafer #define REQUEST_NAME entitled_capped_uncapped_donated_idle_timebase_by_partition
7097bf2640SCody P Schafer #define REQUEST_NUM 0x20
7197bf2640SCody P Schafer #define REQUEST_IDX_KIND "sibling_part_id=?"
7297bf2640SCody P Schafer #include I(REQUEST_BEGIN)
7397bf2640SCody P Schafer REQUEST(__field(0,	8,	partition_id)
7497bf2640SCody P Schafer 	__count(0x8,	8,	entitled_cycles)
7597bf2640SCody P Schafer 	__count(0x10,	8,	consumed_capped_cycles)
7697bf2640SCody P Schafer 	__count(0x18,	8,	consumed_uncapped_cycles)
7797bf2640SCody P Schafer 	__count(0x20,	8,	cycles_donated)
7897bf2640SCody P Schafer 	__count(0x28,	8,	purr_idle_cycles)
7997bf2640SCody P Schafer )
8097bf2640SCody P Schafer #include I(REQUEST_END)
8197bf2640SCody P Schafer 
8297bf2640SCody P Schafer /*
8397bf2640SCody P Schafer  * Not available for counter_info_version >= 0x8, use
8497bf2640SCody P Schafer  * run_instruction_cycles_by_partition(0x100) instead.
8597bf2640SCody P Schafer  */
8697bf2640SCody P Schafer #define REQUEST_NAME run_instructions_run_cycles_by_partition
8797bf2640SCody P Schafer #define REQUEST_NUM 0x30
8897bf2640SCody P Schafer #define REQUEST_IDX_KIND "sibling_part_id=?"
8997bf2640SCody P Schafer #include I(REQUEST_BEGIN)
9097bf2640SCody P Schafer REQUEST(__field(0,	8,	partition_id)
9197bf2640SCody P Schafer 	__count(0x8,	8,	instructions_completed)
9297bf2640SCody P Schafer 	__count(0x10,	8,	cycles)
9397bf2640SCody P Schafer )
9497bf2640SCody P Schafer #include I(REQUEST_END)
9597bf2640SCody P Schafer 
969e9f6010SCody P Schafer #define REQUEST_NAME system_performance_capabilities
979e9f6010SCody P Schafer #define REQUEST_NUM 0x40
98*0f9866f7SKajol Jain #define REQUEST_IDX_KIND "starting_index=0xffffffff"
999e9f6010SCody P Schafer #include I(REQUEST_BEGIN)
1009e9f6010SCody P Schafer REQUEST(__field(0,	1,	perf_collect_privileged)
1019e9f6010SCody P Schafer 	__field(0x1,	1,	capability_mask)
1029e9f6010SCody P Schafer 	__array(0x2,	0xE,	reserved)
1039e9f6010SCody P Schafer )
1049e9f6010SCody P Schafer #include I(REQUEST_END)
1059e9f6010SCody P Schafer 
10697bf2640SCody P Schafer #define REQUEST_NAME processor_bus_utilization_abc_links
10797bf2640SCody P Schafer #define REQUEST_NUM 0x50
10897bf2640SCody P Schafer #define REQUEST_IDX_KIND "hw_chip_id=?"
10997bf2640SCody P Schafer #include I(REQUEST_BEGIN)
11097bf2640SCody P Schafer REQUEST(__field(0,	4,	hw_chip_id)
11197bf2640SCody P Schafer 	__array(0x4,	0xC,	reserved1)
11297bf2640SCody P Schafer 	__count(0x10,	8,	total_link_cycles)
11397bf2640SCody P Schafer 	__count(0x18,	8,	idle_cycles_for_a_link)
11497bf2640SCody P Schafer 	__count(0x20,	8,	idle_cycles_for_b_link)
11597bf2640SCody P Schafer 	__count(0x28,	8,	idle_cycles_for_c_link)
11697bf2640SCody P Schafer 	__array(0x30,	0x20,	reserved2)
11797bf2640SCody P Schafer )
11897bf2640SCody P Schafer #include I(REQUEST_END)
11997bf2640SCody P Schafer 
12097bf2640SCody P Schafer #define REQUEST_NAME processor_bus_utilization_wxyz_links
12197bf2640SCody P Schafer #define REQUEST_NUM 0x60
12297bf2640SCody P Schafer #define REQUEST_IDX_KIND "hw_chip_id=?"
12397bf2640SCody P Schafer #include I(REQUEST_BEGIN)
12497bf2640SCody P Schafer REQUEST(__field(0,	4,	hw_chip_id)
12597bf2640SCody P Schafer 	__array(0x4,	0xC,	reserved1)
12697bf2640SCody P Schafer 	__count(0x10,	8,	total_link_cycles)
12797bf2640SCody P Schafer 	__count(0x18,	8,	idle_cycles_for_w_link)
12897bf2640SCody P Schafer 	__count(0x20,	8,	idle_cycles_for_x_link)
12997bf2640SCody P Schafer 	__count(0x28,	8,	idle_cycles_for_y_link)
13097bf2640SCody P Schafer 	__count(0x30,	8,	idle_cycles_for_z_link)
13197bf2640SCody P Schafer 	__array(0x38,	0x28,	reserved2)
13297bf2640SCody P Schafer )
13397bf2640SCody P Schafer #include I(REQUEST_END)
13497bf2640SCody P Schafer 
13597bf2640SCody P Schafer #define REQUEST_NAME processor_bus_utilization_gx_links
13697bf2640SCody P Schafer #define REQUEST_NUM 0x70
13797bf2640SCody P Schafer #define REQUEST_IDX_KIND "hw_chip_id=?"
13897bf2640SCody P Schafer #include I(REQUEST_BEGIN)
13997bf2640SCody P Schafer REQUEST(__field(0,	4,	hw_chip_id)
14097bf2640SCody P Schafer 	__array(0x4,	0xC,	reserved1)
14197bf2640SCody P Schafer 	__count(0x10,	8,	gx0_in_address_cycles)
14297bf2640SCody P Schafer 	__count(0x18,	8,	gx0_in_data_cycles)
14397bf2640SCody P Schafer 	__count(0x20,	8,	gx0_in_retries)
14497bf2640SCody P Schafer 	__count(0x28,	8,	gx0_in_bus_cycles)
14597bf2640SCody P Schafer 	__count(0x30,	8,	gx0_in_cycles_total)
14697bf2640SCody P Schafer 	__count(0x38,	8,	gx0_out_address_cycles)
14797bf2640SCody P Schafer 	__count(0x40,	8,	gx0_out_data_cycles)
14897bf2640SCody P Schafer 	__count(0x48,	8,	gx0_out_retries)
14997bf2640SCody P Schafer 	__count(0x50,	8,	gx0_out_bus_cycles)
15097bf2640SCody P Schafer 	__count(0x58,	8,	gx0_out_cycles_total)
15197bf2640SCody P Schafer 	__count(0x60,	8,	gx1_in_address_cycles)
15297bf2640SCody P Schafer 	__count(0x68,	8,	gx1_in_data_cycles)
15397bf2640SCody P Schafer 	__count(0x70,	8,	gx1_in_retries)
15497bf2640SCody P Schafer 	__count(0x78,	8,	gx1_in_bus_cycles)
15597bf2640SCody P Schafer 	__count(0x80,	8,	gx1_in_cycles_total)
15697bf2640SCody P Schafer 	__count(0x88,	8,	gx1_out_address_cycles)
15797bf2640SCody P Schafer 	__count(0x90,	8,	gx1_out_data_cycles)
15897bf2640SCody P Schafer 	__count(0x98,	8,	gx1_out_retries)
15997bf2640SCody P Schafer 	__count(0xA0,	8,	gx1_out_bus_cycles)
16097bf2640SCody P Schafer 	__count(0xA8,	8,	gx1_out_cycles_total)
16197bf2640SCody P Schafer )
16297bf2640SCody P Schafer #include I(REQUEST_END)
16397bf2640SCody P Schafer 
16497bf2640SCody P Schafer #define REQUEST_NAME processor_bus_utilization_mc_links
16597bf2640SCody P Schafer #define REQUEST_NUM 0x80
16697bf2640SCody P Schafer #define REQUEST_IDX_KIND "hw_chip_id=?"
16797bf2640SCody P Schafer #include I(REQUEST_BEGIN)
16897bf2640SCody P Schafer REQUEST(__field(0,	4,	hw_chip_id)
16997bf2640SCody P Schafer 	__array(0x4,	0xC,	reserved1)
17097bf2640SCody P Schafer 	__count(0x10,	8,	mc0_frames)
17197bf2640SCody P Schafer 	__count(0x18,	8,	mc0_reads)
17297bf2640SCody P Schafer 	__count(0x20,	8,	mc0_write)
17397bf2640SCody P Schafer 	__count(0x28,	8,	mc0_total_cycles)
17497bf2640SCody P Schafer 	__count(0x30,	8,	mc1_frames)
17597bf2640SCody P Schafer 	__count(0x38,	8,	mc1_reads)
17697bf2640SCody P Schafer 	__count(0x40,	8,	mc1_writes)
17797bf2640SCody P Schafer 	__count(0x48,	8,	mc1_total_cycles)
17897bf2640SCody P Schafer )
17997bf2640SCody P Schafer #include I(REQUEST_END)
18097bf2640SCody P Schafer 
18197bf2640SCody P Schafer /* Processor_config (0x90) skipped, no counters */
18297bf2640SCody P Schafer /* Current_processor_frequency (0x91) skipped, no counters */
18397bf2640SCody P Schafer 
18497bf2640SCody P Schafer #define REQUEST_NAME processor_core_utilization
18597bf2640SCody P Schafer #define REQUEST_NUM 0x94
18697bf2640SCody P Schafer #define REQUEST_IDX_KIND "phys_processor_idx=?"
18797bf2640SCody P Schafer #include I(REQUEST_BEGIN)
18897bf2640SCody P Schafer REQUEST(__field(0,	4,	phys_processor_idx)
18997bf2640SCody P Schafer 	__field(0x4,	4,	hw_processor_id)
19097bf2640SCody P Schafer 	__count(0x8,	8,	cycles_across_any_thread)
19197bf2640SCody P Schafer 	__count(0x10,	8,	timebase_at_collection)
19297bf2640SCody P Schafer 	__count(0x18,	8,	purr_cycles)
19397bf2640SCody P Schafer 	__count(0x20,	8,	sum_of_cycles_across_all_threads)
19497bf2640SCody P Schafer 	__count(0x28,	8,	instructions_completed)
19597bf2640SCody P Schafer )
19697bf2640SCody P Schafer #include I(REQUEST_END)
19797bf2640SCody P Schafer 
19897bf2640SCody P Schafer /* Processor_core_power_mode (0x95) skipped, no counters */
19997bf2640SCody P Schafer /* Affinity_domain_information_by_virtual_processor (0xA0) skipped,
20097bf2640SCody P Schafer  *	no counters */
20197bf2640SCody P Schafer /* Affinity_domain_information_by_domain (0xB0) skipped, no counters */
20297bf2640SCody P Schafer /* Affinity_domain_information_by_partition (0xB1) skipped, no counters */
20397bf2640SCody P Schafer /* Physical_memory_info (0xC0) skipped, no counters */
20497bf2640SCody P Schafer /* Processor_bus_topology (0xD0) skipped, no counters */
20597bf2640SCody P Schafer 
20697bf2640SCody P Schafer #define REQUEST_NAME partition_hypervisor_queuing_times
20797bf2640SCody P Schafer #define REQUEST_NUM 0xE0
20897bf2640SCody P Schafer #define REQUEST_IDX_KIND "partition_id=?"
20997bf2640SCody P Schafer #include I(REQUEST_BEGIN)
21097bf2640SCody P Schafer REQUEST(__field(0,	2, partition_id)
21197bf2640SCody P Schafer 	__array(0x2,	6, reserved1)
21297bf2640SCody P Schafer 	__count(0x8,	8, time_waiting_for_entitlement)
21397bf2640SCody P Schafer 	__count(0x10,	8, times_waited_for_entitlement)
21497bf2640SCody P Schafer 	__count(0x18,	8, time_waiting_for_phys_processor)
21597bf2640SCody P Schafer 	__count(0x20,	8, times_waited_for_phys_processor)
21697bf2640SCody P Schafer 	__count(0x28,	8, dispatches_on_home_core)
21797bf2640SCody P Schafer 	__count(0x30,	8, dispatches_on_home_primary_affinity_domain)
21897bf2640SCody P Schafer 	__count(0x38,	8, dispatches_on_home_secondary_affinity_domain)
21997bf2640SCody P Schafer 	__count(0x40,	8, dispatches_off_home_secondary_affinity_domain)
22097bf2640SCody P Schafer 	__count(0x48,	8, dispatches_on_dedicated_processor_donating_cycles)
22197bf2640SCody P Schafer )
22297bf2640SCody P Schafer #include I(REQUEST_END)
22397bf2640SCody P Schafer 
22497bf2640SCody P Schafer #define REQUEST_NAME system_hypervisor_times
22597bf2640SCody P Schafer #define REQUEST_NUM 0xF0
226*0f9866f7SKajol Jain #define REQUEST_IDX_KIND "starting_index=0xffffffff"
22797bf2640SCody P Schafer #include I(REQUEST_BEGIN)
22897bf2640SCody P Schafer REQUEST(__count(0,	8,	time_spent_to_dispatch_virtual_processors)
22997bf2640SCody P Schafer 	__count(0x8,	8,	time_spent_processing_virtual_processor_timers)
23097bf2640SCody P Schafer 	__count(0x10,	8,	time_spent_managing_partitions_over_entitlement)
23197bf2640SCody P Schafer 	__count(0x18,	8,	time_spent_on_system_management)
23297bf2640SCody P Schafer )
23397bf2640SCody P Schafer #include I(REQUEST_END)
23497bf2640SCody P Schafer 
23597bf2640SCody P Schafer #define REQUEST_NAME system_tlbie_count_and_time
23697bf2640SCody P Schafer #define REQUEST_NUM 0xF4
237*0f9866f7SKajol Jain #define REQUEST_IDX_KIND "starting_index=0xffffffff"
23897bf2640SCody P Schafer #include I(REQUEST_BEGIN)
23997bf2640SCody P Schafer REQUEST(__count(0,	8,	tlbie_instructions_issued)
24097bf2640SCody P Schafer 	/*
24197bf2640SCody P Schafer 	 * FIXME: The spec says the offset here is 0x10, which I suspect
24297bf2640SCody P Schafer 	 *	  is wrong.
24397bf2640SCody P Schafer 	 */
24497bf2640SCody P Schafer 	__count(0x8,	8,	time_spent_issuing_tlbies)
24597bf2640SCody P Schafer )
24697bf2640SCody P Schafer #include I(REQUEST_END)
24797bf2640SCody P Schafer 
24897bf2640SCody P Schafer #define REQUEST_NAME partition_instruction_count_and_time
24997bf2640SCody P Schafer #define REQUEST_NUM 0x100
25097bf2640SCody P Schafer #define REQUEST_IDX_KIND "partition_id=?"
25197bf2640SCody P Schafer #include I(REQUEST_BEGIN)
25297bf2640SCody P Schafer REQUEST(__field(0,	2,	partition_id)
25397bf2640SCody P Schafer 	__array(0x2,	0x6,	reserved1)
25497bf2640SCody P Schafer 	__count(0x8,	8,	instructions_performed)
25597bf2640SCody P Schafer 	__count(0x10,	8,	time_collected)
25697bf2640SCody P Schafer )
25797bf2640SCody P Schafer #include I(REQUEST_END)
25897bf2640SCody P Schafer 
25997bf2640SCody P Schafer /* set_mmcrh (0x80001000) skipped, no counters */
26097bf2640SCody P Schafer /* retrieve_hpmcx (0x80002000) skipped, no counters */
26197bf2640SCody P Schafer 
2629e9f6010SCody P Schafer #include "req-gen/_end.h"
263