hv-24x7.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef LINUX_POWERPC_PERF_HV_24X7_H_
  3. #define LINUX_POWERPC_PERF_HV_24X7_H_
  4. #include <linux/types.h>
  5. enum hv_perf_domains {
  6. #define DOMAIN(n, v, x, c) HV_PERF_DOMAIN_##n = v,
  7. #include "hv-24x7-domains.h"
  8. #undef DOMAIN
  9. HV_PERF_DOMAIN_MAX,
  10. };
  11. #define H24x7_REQUEST_SIZE(iface_version) (iface_version == 1 ? 16 : 32)
  12. struct hv_24x7_request {
  13. /* PHYSICAL domains require enabling via phyp/hmc. */
  14. __u8 performance_domain;
  15. __u8 reserved[0x1];
  16. /* bytes to read starting at @data_offset. must be a multiple of 8 */
  17. __be16 data_size;
  18. /*
  19. * byte offset within the perf domain to read from. must be 8 byte
  20. * aligned
  21. */
  22. __be32 data_offset;
  23. /*
  24. * only valid for VIRTUAL_PROCESSOR domains, ignored for others.
  25. * -1 means "current partition only"
  26. * Enabling via phyp/hmc required for non-"-1" values. 0 forbidden
  27. * unless requestor is 0.
  28. */
  29. __be16 starting_lpar_ix;
  30. /*
  31. * Ignored when @starting_lpar_ix == -1
  32. * Ignored when @performance_domain is not VIRTUAL_PROCESSOR_*
  33. * -1 means "infinite" or all
  34. */
  35. __be16 max_num_lpars;
  36. /* chip, core, or virtual processor based on @performance_domain */
  37. __be16 starting_ix;
  38. __be16 max_ix;
  39. /* The following fields were added in v2 of the 24x7 interface. */
  40. __u8 starting_thread_group_ix;
  41. /* -1 means all thread groups starting at @starting_thread_group_ix */
  42. __u8 max_num_thread_groups;
  43. __u8 reserved2[0xE];
  44. } __packed;
  45. struct hv_24x7_request_buffer {
  46. /* 0 - ? */
  47. /* 1 - ? */
  48. __u8 interface_version;
  49. __u8 num_requests;
  50. __u8 reserved[0xE];
  51. struct hv_24x7_request requests[];
  52. } __packed;
  53. struct hv_24x7_result_element_v1 {
  54. __be16 lpar_ix;
  55. /*
  56. * represents the core, chip, or virtual processor based on the
  57. * request's @performance_domain
  58. */
  59. __be16 domain_ix;
  60. /* -1 if @performance_domain does not refer to a virtual processor */
  61. __be32 lpar_cfg_instance_id;
  62. /* size = @result_element_data_size of containing result. */
  63. __u64 element_data[];
  64. } __packed;
  65. /*
  66. * We need a separate struct for v2 because the offset of @element_data changed
  67. * between versions.
  68. */
  69. struct hv_24x7_result_element_v2 {
  70. __be16 lpar_ix;
  71. /*
  72. * represents the core, chip, or virtual processor based on the
  73. * request's @performance_domain
  74. */
  75. __be16 domain_ix;
  76. /* -1 if @performance_domain does not refer to a virtual processor */
  77. __be32 lpar_cfg_instance_id;
  78. __u8 thread_group_ix;
  79. __u8 reserved[7];
  80. /* size = @result_element_data_size of containing result. */
  81. __u64 element_data[];
  82. } __packed;
  83. struct hv_24x7_result {
  84. /*
  85. * The index of the 24x7 Request Structure in the 24x7 Request Buffer
  86. * used to request this result.
  87. */
  88. __u8 result_ix;
  89. /*
  90. * 0 = not all result elements fit into the buffer, additional requests
  91. * required
  92. * 1 = all result elements were returned
  93. */
  94. __u8 results_complete;
  95. __be16 num_elements_returned;
  96. /*
  97. * This is a copy of @data_size from the corresponding hv_24x7_request
  98. *
  99. * Warning: to obtain the size of each element in @elements you have
  100. * to add the size of the other members of the result_element struct.
  101. */
  102. __be16 result_element_data_size;
  103. __u8 reserved[0x2];
  104. /*
  105. * Either
  106. * struct hv_24x7_result_element_v1[@num_elements_returned]
  107. * or
  108. * struct hv_24x7_result_element_v2[@num_elements_returned]
  109. *
  110. * depending on the interface_version field of the
  111. * struct hv_24x7_data_result_buffer containing this result.
  112. */
  113. char elements[];
  114. } __packed;
  115. struct hv_24x7_data_result_buffer {
  116. /* See versioning for request buffer */
  117. __u8 interface_version;
  118. __u8 num_results;
  119. __u8 reserved[0x1];
  120. __u8 failing_request_ix;
  121. __be32 detailed_rc;
  122. __be64 cec_cfg_instance_id;
  123. __be64 catalog_version_num;
  124. __u8 reserved2[0x8];
  125. /* WARNING: only valid for the first result due to variable sizes of
  126. * results */
  127. struct hv_24x7_result results[]; /* [@num_results] */
  128. } __packed;
  129. #endif