/* SPDX-License-Identifier: GPL-2.0 */1#ifndef LINUX_POWERPC_PERF_HV_24X7_H_2#define LINUX_POWERPC_PERF_HV_24X7_H_34#include <linux/types.h>56enum hv_perf_domains {7#define DOMAIN(n, v, x, c) HV_PERF_DOMAIN_##n = v,8#include "hv-24x7-domains.h"9#undef DOMAIN10HV_PERF_DOMAIN_MAX,11};1213#define H24x7_REQUEST_SIZE(iface_version) (iface_version == 1 ? 16 : 32)1415struct hv_24x7_request {16/* PHYSICAL domains require enabling via phyp/hmc. */17__u8 performance_domain;18__u8 reserved[0x1];1920/* bytes to read starting at @data_offset. must be a multiple of 8 */21__be16 data_size;2223/*24* byte offset within the perf domain to read from. must be 8 byte25* aligned26*/27__be32 data_offset;2829/*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 forbidden33* unless requestor is 0.34*/35__be16 starting_lpar_ix;3637/*38* Ignored when @starting_lpar_ix == -139* Ignored when @performance_domain is not VIRTUAL_PROCESSOR_*40* -1 means "infinite" or all41*/42__be16 max_num_lpars;4344/* chip, core, or virtual processor based on @performance_domain */45__be16 starting_ix;46__be16 max_ix;4748/* The following fields were added in v2 of the 24x7 interface. */4950__u8 starting_thread_group_ix;5152/* -1 means all thread groups starting at @starting_thread_group_ix */53__u8 max_num_thread_groups;5455__u8 reserved2[0xE];56} __packed;5758struct hv_24x7_request_buffer {59/* 0 - ? */60/* 1 - ? */61__u8 interface_version;62__u8 num_requests;63__u8 reserved[0xE];64struct hv_24x7_request requests[];65} __packed;6667struct hv_24x7_result_element_v1 {68__be16 lpar_ix;6970/*71* represents the core, chip, or virtual processor based on the72* request's @performance_domain73*/74__be16 domain_ix;7576/* -1 if @performance_domain does not refer to a virtual processor */77__be32 lpar_cfg_instance_id;7879/* size = @result_element_data_size of containing result. */80__u64 element_data[];81} __packed;8283/*84* We need a separate struct for v2 because the offset of @element_data changed85* between versions.86*/87struct hv_24x7_result_element_v2 {88__be16 lpar_ix;8990/*91* represents the core, chip, or virtual processor based on the92* request's @performance_domain93*/94__be16 domain_ix;9596/* -1 if @performance_domain does not refer to a virtual processor */97__be32 lpar_cfg_instance_id;9899__u8 thread_group_ix;100101__u8 reserved[7];102103/* size = @result_element_data_size of containing result. */104__u64 element_data[];105} __packed;106107struct hv_24x7_result {108/*109* The index of the 24x7 Request Structure in the 24x7 Request Buffer110* used to request this result.111*/112__u8 result_ix;113114/*115* 0 = not all result elements fit into the buffer, additional requests116* required117* 1 = all result elements were returned118*/119__u8 results_complete;120__be16 num_elements_returned;121122/*123* This is a copy of @data_size from the corresponding hv_24x7_request124*125* Warning: to obtain the size of each element in @elements you have126* to add the size of the other members of the result_element struct.127*/128__be16 result_element_data_size;129__u8 reserved[0x2];130131/*132* Either133* struct hv_24x7_result_element_v1[@num_elements_returned]134* or135* struct hv_24x7_result_element_v2[@num_elements_returned]136*137* depending on the interface_version field of the138* struct hv_24x7_data_result_buffer containing this result.139*/140char elements[];141} __packed;142143struct hv_24x7_data_result_buffer {144/* See versioning for request buffer */145__u8 interface_version;146147__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 of155* results */156struct hv_24x7_result results[]; /* [@num_results] */157} __packed;158159#endif160161162