Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef LINUX_POWERPC_PERF_HV_24X7_H_
0003 #define LINUX_POWERPC_PERF_HV_24X7_H_
0004 
0005 #include <linux/types.h>
0006 
0007 enum hv_perf_domains {
0008 #define DOMAIN(n, v, x, c) HV_PERF_DOMAIN_##n = v,
0009 #include "hv-24x7-domains.h"
0010 #undef DOMAIN
0011     HV_PERF_DOMAIN_MAX,
0012 };
0013 
0014 #define H24x7_REQUEST_SIZE(iface_version)   (iface_version == 1 ? 16 : 32)
0015 
0016 struct hv_24x7_request {
0017     /* PHYSICAL domains require enabling via phyp/hmc. */
0018     __u8 performance_domain;
0019     __u8 reserved[0x1];
0020 
0021     /* bytes to read starting at @data_offset. must be a multiple of 8 */
0022     __be16 data_size;
0023 
0024     /*
0025      * byte offset within the perf domain to read from. must be 8 byte
0026      * aligned
0027      */
0028     __be32 data_offset;
0029 
0030     /*
0031      * only valid for VIRTUAL_PROCESSOR domains, ignored for others.
0032      * -1 means "current partition only"
0033      *  Enabling via phyp/hmc required for non-"-1" values. 0 forbidden
0034      *  unless requestor is 0.
0035      */
0036     __be16 starting_lpar_ix;
0037 
0038     /*
0039      * Ignored when @starting_lpar_ix == -1
0040      * Ignored when @performance_domain is not VIRTUAL_PROCESSOR_*
0041      * -1 means "infinite" or all
0042      */
0043     __be16 max_num_lpars;
0044 
0045     /* chip, core, or virtual processor based on @performance_domain */
0046     __be16 starting_ix;
0047     __be16 max_ix;
0048 
0049     /* The following fields were added in v2 of the 24x7 interface. */
0050 
0051     __u8 starting_thread_group_ix;
0052 
0053     /* -1 means all thread groups starting at @starting_thread_group_ix */
0054     __u8 max_num_thread_groups;
0055 
0056     __u8 reserved2[0xE];
0057 } __packed;
0058 
0059 struct hv_24x7_request_buffer {
0060     /* 0 - ? */
0061     /* 1 - ? */
0062     __u8 interface_version;
0063     __u8 num_requests;
0064     __u8 reserved[0xE];
0065     struct hv_24x7_request requests[];
0066 } __packed;
0067 
0068 struct hv_24x7_result_element_v1 {
0069     __be16 lpar_ix;
0070 
0071     /*
0072      * represents the core, chip, or virtual processor based on the
0073      * request's @performance_domain
0074      */
0075     __be16 domain_ix;
0076 
0077     /* -1 if @performance_domain does not refer to a virtual processor */
0078     __be32 lpar_cfg_instance_id;
0079 
0080     /* size = @result_element_data_size of containing result. */
0081     __u64 element_data[];
0082 } __packed;
0083 
0084 /*
0085  * We need a separate struct for v2 because the offset of @element_data changed
0086  * between versions.
0087  */
0088 struct hv_24x7_result_element_v2 {
0089     __be16 lpar_ix;
0090 
0091     /*
0092      * represents the core, chip, or virtual processor based on the
0093      * request's @performance_domain
0094      */
0095     __be16 domain_ix;
0096 
0097     /* -1 if @performance_domain does not refer to a virtual processor */
0098     __be32 lpar_cfg_instance_id;
0099 
0100     __u8 thread_group_ix;
0101 
0102     __u8 reserved[7];
0103 
0104     /* size = @result_element_data_size of containing result. */
0105     __u64 element_data[];
0106 } __packed;
0107 
0108 struct hv_24x7_result {
0109     /*
0110      * The index of the 24x7 Request Structure in the 24x7 Request Buffer
0111      * used to request this result.
0112      */
0113     __u8 result_ix;
0114 
0115     /*
0116      * 0 = not all result elements fit into the buffer, additional requests
0117      *     required
0118      * 1 = all result elements were returned
0119      */
0120     __u8 results_complete;
0121     __be16 num_elements_returned;
0122 
0123     /*
0124      * This is a copy of @data_size from the corresponding hv_24x7_request
0125      *
0126      * Warning: to obtain the size of each element in @elements you have
0127      * to add the size of the other members of the result_element struct.
0128      */
0129     __be16 result_element_data_size;
0130     __u8 reserved[0x2];
0131 
0132     /*
0133      * Either
0134      *  struct hv_24x7_result_element_v1[@num_elements_returned]
0135      * or
0136      *  struct hv_24x7_result_element_v2[@num_elements_returned]
0137      *
0138      * depending on the interface_version field of the
0139      * struct hv_24x7_data_result_buffer containing this result.
0140      */
0141     char elements[];
0142 } __packed;
0143 
0144 struct hv_24x7_data_result_buffer {
0145     /* See versioning for request buffer */
0146     __u8 interface_version;
0147 
0148     __u8 num_results;
0149     __u8 reserved[0x1];
0150     __u8 failing_request_ix;
0151     __be32 detailed_rc;
0152     __be64 cec_cfg_instance_id;
0153     __be64 catalog_version_num;
0154     __u8 reserved2[0x8];
0155     /* WARNING: only valid for the first result due to variable sizes of
0156      *      results */
0157     struct hv_24x7_result results[]; /* [@num_results] */
0158 } __packed;
0159 
0160 #endif