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 82*03f7c1d2SKajol Jain #ifdef ENABLE_EVENTS_COUNTERINFO_V6 8397bf2640SCody P Schafer /* 8497bf2640SCody P Schafer * Not available for counter_info_version >= 0x8, use 8597bf2640SCody P Schafer * run_instruction_cycles_by_partition(0x100) instead. 8697bf2640SCody P Schafer */ 8797bf2640SCody P Schafer #define REQUEST_NAME run_instructions_run_cycles_by_partition 8897bf2640SCody P Schafer #define REQUEST_NUM 0x30 8997bf2640SCody P Schafer #define REQUEST_IDX_KIND "sibling_part_id=?" 9097bf2640SCody P Schafer #include I(REQUEST_BEGIN) 9197bf2640SCody P Schafer REQUEST(__field(0, 8, partition_id) 9297bf2640SCody P Schafer __count(0x8, 8, instructions_completed) 9397bf2640SCody P Schafer __count(0x10, 8, cycles) 9497bf2640SCody P Schafer ) 9597bf2640SCody P Schafer #include I(REQUEST_END) 96*03f7c1d2SKajol Jain #endif 9797bf2640SCody P Schafer 989e9f6010SCody P Schafer #define REQUEST_NAME system_performance_capabilities 999e9f6010SCody P Schafer #define REQUEST_NUM 0x40 1000f9866f7SKajol Jain #define REQUEST_IDX_KIND "starting_index=0xffffffff" 1019e9f6010SCody P Schafer #include I(REQUEST_BEGIN) 1029e9f6010SCody P Schafer REQUEST(__field(0, 1, perf_collect_privileged) 1039e9f6010SCody P Schafer __field(0x1, 1, capability_mask) 1049e9f6010SCody P Schafer __array(0x2, 0xE, reserved) 1059e9f6010SCody P Schafer ) 1069e9f6010SCody P Schafer #include I(REQUEST_END) 1079e9f6010SCody P Schafer 108*03f7c1d2SKajol Jain #ifdef ENABLE_EVENTS_COUNTERINFO_V6 10997bf2640SCody P Schafer #define REQUEST_NAME processor_bus_utilization_abc_links 11097bf2640SCody P Schafer #define REQUEST_NUM 0x50 11197bf2640SCody P Schafer #define REQUEST_IDX_KIND "hw_chip_id=?" 11297bf2640SCody P Schafer #include I(REQUEST_BEGIN) 11397bf2640SCody P Schafer REQUEST(__field(0, 4, hw_chip_id) 11497bf2640SCody P Schafer __array(0x4, 0xC, reserved1) 11597bf2640SCody P Schafer __count(0x10, 8, total_link_cycles) 11697bf2640SCody P Schafer __count(0x18, 8, idle_cycles_for_a_link) 11797bf2640SCody P Schafer __count(0x20, 8, idle_cycles_for_b_link) 11897bf2640SCody P Schafer __count(0x28, 8, idle_cycles_for_c_link) 11997bf2640SCody P Schafer __array(0x30, 0x20, reserved2) 12097bf2640SCody P Schafer ) 12197bf2640SCody P Schafer #include I(REQUEST_END) 12297bf2640SCody P Schafer 12397bf2640SCody P Schafer #define REQUEST_NAME processor_bus_utilization_wxyz_links 12497bf2640SCody P Schafer #define REQUEST_NUM 0x60 12597bf2640SCody P Schafer #define REQUEST_IDX_KIND "hw_chip_id=?" 12697bf2640SCody P Schafer #include I(REQUEST_BEGIN) 12797bf2640SCody P Schafer REQUEST(__field(0, 4, hw_chip_id) 12897bf2640SCody P Schafer __array(0x4, 0xC, reserved1) 12997bf2640SCody P Schafer __count(0x10, 8, total_link_cycles) 13097bf2640SCody P Schafer __count(0x18, 8, idle_cycles_for_w_link) 13197bf2640SCody P Schafer __count(0x20, 8, idle_cycles_for_x_link) 13297bf2640SCody P Schafer __count(0x28, 8, idle_cycles_for_y_link) 13397bf2640SCody P Schafer __count(0x30, 8, idle_cycles_for_z_link) 13497bf2640SCody P Schafer __array(0x38, 0x28, reserved2) 13597bf2640SCody P Schafer ) 13697bf2640SCody P Schafer #include I(REQUEST_END) 13797bf2640SCody P Schafer 13897bf2640SCody P Schafer #define REQUEST_NAME processor_bus_utilization_gx_links 13997bf2640SCody P Schafer #define REQUEST_NUM 0x70 14097bf2640SCody P Schafer #define REQUEST_IDX_KIND "hw_chip_id=?" 14197bf2640SCody P Schafer #include I(REQUEST_BEGIN) 14297bf2640SCody P Schafer REQUEST(__field(0, 4, hw_chip_id) 14397bf2640SCody P Schafer __array(0x4, 0xC, reserved1) 14497bf2640SCody P Schafer __count(0x10, 8, gx0_in_address_cycles) 14597bf2640SCody P Schafer __count(0x18, 8, gx0_in_data_cycles) 14697bf2640SCody P Schafer __count(0x20, 8, gx0_in_retries) 14797bf2640SCody P Schafer __count(0x28, 8, gx0_in_bus_cycles) 14897bf2640SCody P Schafer __count(0x30, 8, gx0_in_cycles_total) 14997bf2640SCody P Schafer __count(0x38, 8, gx0_out_address_cycles) 15097bf2640SCody P Schafer __count(0x40, 8, gx0_out_data_cycles) 15197bf2640SCody P Schafer __count(0x48, 8, gx0_out_retries) 15297bf2640SCody P Schafer __count(0x50, 8, gx0_out_bus_cycles) 15397bf2640SCody P Schafer __count(0x58, 8, gx0_out_cycles_total) 15497bf2640SCody P Schafer __count(0x60, 8, gx1_in_address_cycles) 15597bf2640SCody P Schafer __count(0x68, 8, gx1_in_data_cycles) 15697bf2640SCody P Schafer __count(0x70, 8, gx1_in_retries) 15797bf2640SCody P Schafer __count(0x78, 8, gx1_in_bus_cycles) 15897bf2640SCody P Schafer __count(0x80, 8, gx1_in_cycles_total) 15997bf2640SCody P Schafer __count(0x88, 8, gx1_out_address_cycles) 16097bf2640SCody P Schafer __count(0x90, 8, gx1_out_data_cycles) 16197bf2640SCody P Schafer __count(0x98, 8, gx1_out_retries) 16297bf2640SCody P Schafer __count(0xA0, 8, gx1_out_bus_cycles) 16397bf2640SCody P Schafer __count(0xA8, 8, gx1_out_cycles_total) 16497bf2640SCody P Schafer ) 16597bf2640SCody P Schafer #include I(REQUEST_END) 16697bf2640SCody P Schafer 16797bf2640SCody P Schafer #define REQUEST_NAME processor_bus_utilization_mc_links 16897bf2640SCody P Schafer #define REQUEST_NUM 0x80 16997bf2640SCody P Schafer #define REQUEST_IDX_KIND "hw_chip_id=?" 17097bf2640SCody P Schafer #include I(REQUEST_BEGIN) 17197bf2640SCody P Schafer REQUEST(__field(0, 4, hw_chip_id) 17297bf2640SCody P Schafer __array(0x4, 0xC, reserved1) 17397bf2640SCody P Schafer __count(0x10, 8, mc0_frames) 17497bf2640SCody P Schafer __count(0x18, 8, mc0_reads) 17597bf2640SCody P Schafer __count(0x20, 8, mc0_write) 17697bf2640SCody P Schafer __count(0x28, 8, mc0_total_cycles) 17797bf2640SCody P Schafer __count(0x30, 8, mc1_frames) 17897bf2640SCody P Schafer __count(0x38, 8, mc1_reads) 17997bf2640SCody P Schafer __count(0x40, 8, mc1_writes) 18097bf2640SCody P Schafer __count(0x48, 8, mc1_total_cycles) 18197bf2640SCody P Schafer ) 18297bf2640SCody P Schafer #include I(REQUEST_END) 18397bf2640SCody P Schafer 18497bf2640SCody P Schafer /* Processor_config (0x90) skipped, no counters */ 18597bf2640SCody P Schafer /* Current_processor_frequency (0x91) skipped, no counters */ 18697bf2640SCody P Schafer 18797bf2640SCody P Schafer #define REQUEST_NAME processor_core_utilization 18897bf2640SCody P Schafer #define REQUEST_NUM 0x94 18997bf2640SCody P Schafer #define REQUEST_IDX_KIND "phys_processor_idx=?" 19097bf2640SCody P Schafer #include I(REQUEST_BEGIN) 19197bf2640SCody P Schafer REQUEST(__field(0, 4, phys_processor_idx) 19297bf2640SCody P Schafer __field(0x4, 4, hw_processor_id) 19397bf2640SCody P Schafer __count(0x8, 8, cycles_across_any_thread) 19497bf2640SCody P Schafer __count(0x10, 8, timebase_at_collection) 19597bf2640SCody P Schafer __count(0x18, 8, purr_cycles) 19697bf2640SCody P Schafer __count(0x20, 8, sum_of_cycles_across_all_threads) 19797bf2640SCody P Schafer __count(0x28, 8, instructions_completed) 19897bf2640SCody P Schafer ) 19997bf2640SCody P Schafer #include I(REQUEST_END) 200*03f7c1d2SKajol Jain #endif 20197bf2640SCody P Schafer 20297bf2640SCody P Schafer /* Processor_core_power_mode (0x95) skipped, no counters */ 20397bf2640SCody P Schafer /* Affinity_domain_information_by_virtual_processor (0xA0) skipped, 20497bf2640SCody P Schafer * no counters */ 20597bf2640SCody P Schafer /* Affinity_domain_information_by_domain (0xB0) skipped, no counters */ 20697bf2640SCody P Schafer /* Affinity_domain_information_by_partition (0xB1) skipped, no counters */ 20797bf2640SCody P Schafer /* Physical_memory_info (0xC0) skipped, no counters */ 20897bf2640SCody P Schafer /* Processor_bus_topology (0xD0) skipped, no counters */ 20997bf2640SCody P Schafer 21097bf2640SCody P Schafer #define REQUEST_NAME partition_hypervisor_queuing_times 21197bf2640SCody P Schafer #define REQUEST_NUM 0xE0 21297bf2640SCody P Schafer #define REQUEST_IDX_KIND "partition_id=?" 21397bf2640SCody P Schafer #include I(REQUEST_BEGIN) 21497bf2640SCody P Schafer REQUEST(__field(0, 2, partition_id) 21597bf2640SCody P Schafer __array(0x2, 6, reserved1) 21697bf2640SCody P Schafer __count(0x8, 8, time_waiting_for_entitlement) 21797bf2640SCody P Schafer __count(0x10, 8, times_waited_for_entitlement) 21897bf2640SCody P Schafer __count(0x18, 8, time_waiting_for_phys_processor) 21997bf2640SCody P Schafer __count(0x20, 8, times_waited_for_phys_processor) 22097bf2640SCody P Schafer __count(0x28, 8, dispatches_on_home_core) 22197bf2640SCody P Schafer __count(0x30, 8, dispatches_on_home_primary_affinity_domain) 22297bf2640SCody P Schafer __count(0x38, 8, dispatches_on_home_secondary_affinity_domain) 22397bf2640SCody P Schafer __count(0x40, 8, dispatches_off_home_secondary_affinity_domain) 22497bf2640SCody P Schafer __count(0x48, 8, dispatches_on_dedicated_processor_donating_cycles) 22597bf2640SCody P Schafer ) 22697bf2640SCody P Schafer #include I(REQUEST_END) 22797bf2640SCody P Schafer 22897bf2640SCody P Schafer #define REQUEST_NAME system_hypervisor_times 22997bf2640SCody P Schafer #define REQUEST_NUM 0xF0 2300f9866f7SKajol Jain #define REQUEST_IDX_KIND "starting_index=0xffffffff" 23197bf2640SCody P Schafer #include I(REQUEST_BEGIN) 23297bf2640SCody P Schafer REQUEST(__count(0, 8, time_spent_to_dispatch_virtual_processors) 23397bf2640SCody P Schafer __count(0x8, 8, time_spent_processing_virtual_processor_timers) 23497bf2640SCody P Schafer __count(0x10, 8, time_spent_managing_partitions_over_entitlement) 23597bf2640SCody P Schafer __count(0x18, 8, time_spent_on_system_management) 23697bf2640SCody P Schafer ) 23797bf2640SCody P Schafer #include I(REQUEST_END) 23897bf2640SCody P Schafer 23997bf2640SCody P Schafer #define REQUEST_NAME system_tlbie_count_and_time 24097bf2640SCody P Schafer #define REQUEST_NUM 0xF4 2410f9866f7SKajol Jain #define REQUEST_IDX_KIND "starting_index=0xffffffff" 24297bf2640SCody P Schafer #include I(REQUEST_BEGIN) 24397bf2640SCody P Schafer REQUEST(__count(0, 8, tlbie_instructions_issued) 24497bf2640SCody P Schafer /* 24597bf2640SCody P Schafer * FIXME: The spec says the offset here is 0x10, which I suspect 24697bf2640SCody P Schafer * is wrong. 24797bf2640SCody P Schafer */ 24897bf2640SCody P Schafer __count(0x8, 8, time_spent_issuing_tlbies) 24997bf2640SCody P Schafer ) 25097bf2640SCody P Schafer #include I(REQUEST_END) 25197bf2640SCody P Schafer 25297bf2640SCody P Schafer #define REQUEST_NAME partition_instruction_count_and_time 25397bf2640SCody P Schafer #define REQUEST_NUM 0x100 25497bf2640SCody P Schafer #define REQUEST_IDX_KIND "partition_id=?" 25597bf2640SCody P Schafer #include I(REQUEST_BEGIN) 25697bf2640SCody P Schafer REQUEST(__field(0, 2, partition_id) 25797bf2640SCody P Schafer __array(0x2, 0x6, reserved1) 25897bf2640SCody P Schafer __count(0x8, 8, instructions_performed) 25997bf2640SCody P Schafer __count(0x10, 8, time_collected) 26097bf2640SCody P Schafer ) 26197bf2640SCody P Schafer #include I(REQUEST_END) 26297bf2640SCody P Schafer 26397bf2640SCody P Schafer /* set_mmcrh (0x80001000) skipped, no counters */ 26497bf2640SCody P Schafer /* retrieve_hpmcx (0x80002000) skipped, no counters */ 26597bf2640SCody P Schafer 2669e9f6010SCody P Schafer #include "req-gen/_end.h" 267