2014-03-14 13:00:38 +08:00
|
|
|
#ifndef LINUX_POWERPC_PERF_HV_24X7_H_
|
|
|
|
#define LINUX_POWERPC_PERF_HV_24X7_H_
|
|
|
|
|
|
|
|
#include <linux/types.h>
|
|
|
|
|
powerpc/perf/hv-24x7: parse catalog and populate sysfs with events
Retrieves and parses the 24x7 catalog on POWER systems that supply it
(right now, only POWER 8). Events are exposed via sysfs in the standard
fashion, and are all parameterized.
$ cd /sys/bus/event_source/devices/hv_24x7/events
$ cat HPM_CS_FROM_L4_LDATA__PHYS_CORE
domain=0x2,offset=0xd58,core=?,lpar=0x0
$ cat HPM_TLBIE__VCPU_HOME_CHIP
domain=0x4,offset=0x358,vcpu=?,lpar=?
where user is required to specify values for the fields with '?' (like
core, vcpu, lpar above), when specifying the event with the perf tool.
Catalog is (at the moment) only parsed on boot. It needs re-parsing
when a some hypervisor events occur. At that point we'll also need to
prevent old events from continuing to function (counter that is passed
in via spare space in the config values?).
Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2015-01-31 05:46:00 +08:00
|
|
|
enum hv_perf_domains {
|
|
|
|
#define DOMAIN(n, v, x, c) HV_PERF_DOMAIN_##n = v,
|
|
|
|
#include "hv-24x7-domains.h"
|
|
|
|
#undef DOMAIN
|
2016-02-17 09:07:51 +08:00
|
|
|
HV_PERF_DOMAIN_MAX,
|
powerpc/perf/hv-24x7: parse catalog and populate sysfs with events
Retrieves and parses the 24x7 catalog on POWER systems that supply it
(right now, only POWER 8). Events are exposed via sysfs in the standard
fashion, and are all parameterized.
$ cd /sys/bus/event_source/devices/hv_24x7/events
$ cat HPM_CS_FROM_L4_LDATA__PHYS_CORE
domain=0x2,offset=0xd58,core=?,lpar=0x0
$ cat HPM_TLBIE__VCPU_HOME_CHIP
domain=0x4,offset=0x358,vcpu=?,lpar=?
where user is required to specify values for the fields with '?' (like
core, vcpu, lpar above), when specifying the event with the perf tool.
Catalog is (at the moment) only parsed on boot. It needs re-parsing
when a some hypervisor events occur. At that point we'll also need to
prevent old events from continuing to function (counter that is passed
in via spare space in the config values?).
Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2015-01-31 05:46:00 +08:00
|
|
|
};
|
|
|
|
|
2014-03-14 13:00:38 +08:00
|
|
|
struct hv_24x7_request {
|
|
|
|
/* PHYSICAL domains require enabling via phyp/hmc. */
|
|
|
|
__u8 performance_domain;
|
|
|
|
__u8 reserved[0x1];
|
|
|
|
|
|
|
|
/* bytes to read starting at @data_offset. must be a multiple of 8 */
|
|
|
|
__be16 data_size;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* byte offset within the perf domain to read from. must be 8 byte
|
|
|
|
* aligned
|
|
|
|
*/
|
|
|
|
__be32 data_offset;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* only valid for VIRTUAL_PROCESSOR domains, ignored for others.
|
|
|
|
* -1 means "current partition only"
|
|
|
|
* Enabling via phyp/hmc required for non-"-1" values. 0 forbidden
|
|
|
|
* unless requestor is 0.
|
|
|
|
*/
|
|
|
|
__be16 starting_lpar_ix;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Ignored when @starting_lpar_ix == -1
|
|
|
|
* Ignored when @performance_domain is not VIRTUAL_PROCESSOR_*
|
|
|
|
* -1 means "infinite" or all
|
|
|
|
*/
|
|
|
|
__be16 max_num_lpars;
|
|
|
|
|
|
|
|
/* chip, core, or virtual processor based on @performance_domain */
|
|
|
|
__be16 starting_ix;
|
|
|
|
__be16 max_ix;
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct hv_24x7_request_buffer {
|
|
|
|
/* 0 - ? */
|
|
|
|
/* 1 - ? */
|
|
|
|
#define HV_24X7_IF_VERSION_CURRENT 0x01
|
|
|
|
__u8 interface_version;
|
|
|
|
__u8 num_requests;
|
|
|
|
__u8 reserved[0xE];
|
2015-03-31 09:53:38 +08:00
|
|
|
struct hv_24x7_request requests[1];
|
2014-03-14 13:00:38 +08:00
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct hv_24x7_result_element {
|
|
|
|
__be16 lpar_ix;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* represents the core, chip, or virtual processor based on the
|
|
|
|
* request's @performance_domain
|
|
|
|
*/
|
|
|
|
__be16 domain_ix;
|
|
|
|
|
|
|
|
/* -1 if @performance_domain does not refer to a virtual processor */
|
|
|
|
__be32 lpar_cfg_instance_id;
|
|
|
|
|
2016-06-01 14:34:37 +08:00
|
|
|
/* size = @result_element_data_size of containing result. */
|
2015-03-31 09:53:38 +08:00
|
|
|
__u64 element_data[1];
|
2014-03-14 13:00:38 +08:00
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct hv_24x7_result {
|
2017-06-30 05:55:36 +08:00
|
|
|
/*
|
|
|
|
* The index of the 24x7 Request Structure in the 24x7 Request Buffer
|
|
|
|
* used to request this result.
|
|
|
|
*/
|
2014-03-14 13:00:38 +08:00
|
|
|
__u8 result_ix;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 0 = not all result elements fit into the buffer, additional requests
|
|
|
|
* required
|
|
|
|
* 1 = all result elements were returned
|
|
|
|
*/
|
|
|
|
__u8 results_complete;
|
|
|
|
__be16 num_elements_returned;
|
|
|
|
|
2017-06-30 05:55:36 +08:00
|
|
|
/*
|
|
|
|
* This is a copy of @data_size from the corresponding hv_24x7_request
|
|
|
|
*
|
|
|
|
* Warning: to obtain the size of each element in @elements you have
|
|
|
|
* to add the size of the other members of the result_element struct.
|
|
|
|
*/
|
2014-03-14 13:00:38 +08:00
|
|
|
__be16 result_element_data_size;
|
|
|
|
__u8 reserved[0x2];
|
|
|
|
|
|
|
|
/* WARNING: only valid for first result element due to variable sizes
|
|
|
|
* of result elements */
|
|
|
|
/* struct hv_24x7_result_element[@num_elements_returned] */
|
2015-03-31 09:53:38 +08:00
|
|
|
struct hv_24x7_result_element elements[1];
|
2014-03-14 13:00:38 +08:00
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct hv_24x7_data_result_buffer {
|
|
|
|
/* See versioning for request buffer */
|
|
|
|
__u8 interface_version;
|
|
|
|
|
|
|
|
__u8 num_results;
|
|
|
|
__u8 reserved[0x1];
|
|
|
|
__u8 failing_request_ix;
|
|
|
|
__be32 detailed_rc;
|
|
|
|
__be64 cec_cfg_instance_id;
|
|
|
|
__be64 catalog_version_num;
|
|
|
|
__u8 reserved2[0x8];
|
|
|
|
/* WARNING: only valid for the first result due to variable sizes of
|
|
|
|
* results */
|
2015-03-31 09:53:38 +08:00
|
|
|
struct hv_24x7_result results[1]; /* [@num_results] */
|
2014-03-14 13:00:38 +08:00
|
|
|
} __packed;
|
|
|
|
|
|
|
|
#endif
|