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