hv-gpci-requests.h 8.2 KB

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