xref: /openbmc/linux/arch/powerpc/perf/hv-gpci.h (revision 275876e2)
1 #ifndef LINUX_POWERPC_PERF_HV_GPCI_H_
2 #define LINUX_POWERPC_PERF_HV_GPCI_H_
3 
4 #include <linux/types.h>
5 
6 /* From the document "H_GetPerformanceCounterInfo Interface" v1.07 */
7 
8 /* H_GET_PERF_COUNTER_INFO argument */
9 struct hv_get_perf_counter_info_params {
10 	__be32 counter_request; /* I */
11 	__be32 starting_index;  /* IO */
12 	__be16 secondary_index; /* IO */
13 	__be16 returned_values; /* O */
14 	__be32 detail_rc; /* O, only needed when called via *_norets() */
15 
16 	/*
17 	 * O, size each of counter_value element in bytes, only set for version
18 	 * >= 0x3
19 	 */
20 	__be16 cv_element_size;
21 
22 	/* I, 0 (zero) for versions < 0x3 */
23 	__u8 counter_info_version_in;
24 
25 	/* O, 0 (zero) if version < 0x3. Must be set to 0 when making hcall */
26 	__u8 counter_info_version_out;
27 	__u8 reserved[0xC];
28 	__u8 counter_value[];
29 } __packed;
30 
31 /*
32  * counter info version => fw version/reference (spec version)
33  *
34  * 8 => power8 (1.07)
35  * [7 is skipped by spec 1.07]
36  * 6 => TLBIE (1.07)
37  * 5 => v7r7m0.phyp (1.05)
38  * [4 skipped]
39  * 3 => v7r6m0.phyp (?)
40  * [1,2 skipped]
41  * 0 => v7r{2,3,4}m0.phyp (?)
42  */
43 #define COUNTER_INFO_VERSION_CURRENT 0x8
44 
45 /*
46  * These determine the counter_value[] layout and the meaning of starting_index
47  * and secondary_index.
48  *
49  * Unless otherwise noted, @secondary_index is unused and ignored.
50  */
51 enum counter_info_requests {
52 
53 	/* GENERAL */
54 
55 	/* @starting_index: must be -1 (to refer to the current partition)
56 	 */
57 	CIR_SYSTEM_PERFORMANCE_CAPABILITIES = 0X40,
58 };
59 
60 struct cv_system_performance_capabilities {
61 	/* If != 0, allowed to collect data from other partitions */
62 	__u8 perf_collect_privileged;
63 
64 	/* These following are only valid if counter_info_version >= 0x3 */
65 #define CV_CM_GA       (1 << 7)
66 #define CV_CM_EXPANDED (1 << 6)
67 #define CV_CM_LAB      (1 << 5)
68 	/* remaining bits are reserved */
69 	__u8 capability_mask;
70 	__u8 reserved[0xE];
71 } __packed;
72 
73 #endif
74