hv-gpci-requests.h 8.3 KB

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