| 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | #ifndef _FEATURES_H |
| 3 | #define _FEATURES_H |
| 4 | |
| 5 | #include <linux/bits.h> |
| 6 | #include <linux/types.h> |
| 7 | |
| 8 | /* Common masks */ |
| 9 | #define PMT_CAP_TELEM BIT(0) |
| 10 | #define PMT_CAP_WATCHER BIT(1) |
| 11 | #define PMT_CAP_CRASHLOG BIT(2) |
| 12 | #define PMT_CAP_STREAMING BIT(3) |
| 13 | #define PMT_CAP_THRESHOLD BIT(4) |
| 14 | #define PMT_CAP_WINDOW BIT(5) |
| 15 | #define PMT_CAP_CONFIG BIT(6) |
| 16 | #define PMT_CAP_TRACING BIT(7) |
| 17 | #define PMT_CAP_INBAND BIT(8) |
| 18 | #define PMT_CAP_OOB BIT(9) |
| 19 | #define PMT_CAP_SECURED_CHAN BIT(10) |
| 20 | |
| 21 | #define PMT_CAP_PMT_SP BIT(11) |
| 22 | #define PMT_CAP_PMT_SP_POLICY GENMASK(17, 12) |
| 23 | |
| 24 | /* Per Core Performance Telemetry (PCPT) specific masks */ |
| 25 | #define PMT_CAP_PCPT_CORE_PERF BIT(18) |
| 26 | #define PMT_CAP_PCPT_CORE_C0_RES BIT(19) |
| 27 | #define PMT_CAP_PCPT_CORE_ACTIVITY BIT(20) |
| 28 | #define PMT_CAP_PCPT_CACHE_PERF BIT(21) |
| 29 | #define PMT_CAP_PCPT_QUALITY_TELEM BIT(22) |
| 30 | |
| 31 | /* Per Core Environmental Telemetry (PCET) specific masks */ |
| 32 | #define PMT_CAP_PCET_WORKPOINT_HIST BIT(18) |
| 33 | #define PMT_CAP_PCET_CORE_CURR_TEMP BIT(19) |
| 34 | #define PMT_CAP_PCET_CORE_INST_RES BIT(20) |
| 35 | #define PMT_CAP_PCET_QUALITY_TELEM BIT(21) /* Same as PMT_CAP_PCPT */ |
| 36 | #define PMT_CAP_PCET_CORE_CDYN_LVL BIT(22) |
| 37 | #define PMT_CAP_PCET_CORE_STRESS_LVL BIT(23) |
| 38 | #define PMT_CAP_PCET_CORE_DAS BIT(24) |
| 39 | #define PMT_CAP_PCET_FIVR_HEALTH BIT(25) |
| 40 | #define PMT_CAP_PCET_ENERGY BIT(26) |
| 41 | #define PMT_CAP_PCET_PEM_STATUS BIT(27) |
| 42 | #define PMT_CAP_PCET_CORE_C_STATE BIT(28) |
| 43 | |
| 44 | /* Per RMID Performance Telemetry specific masks */ |
| 45 | #define PMT_CAP_RMID_CORES_PERF BIT(18) |
| 46 | #define PMT_CAP_RMID_CACHE_PERF BIT(19) |
| 47 | #define PMT_CAP_RMID_PERF_QUAL BIT(20) |
| 48 | |
| 49 | /* Accelerator Telemetry specific masks */ |
| 50 | #define PMT_CAP_ACCEL_CPM_TELEM BIT(18) |
| 51 | #define PMT_CAP_ACCEL_TIP_TELEM BIT(19) |
| 52 | |
| 53 | /* Uncore Telemetry specific masks */ |
| 54 | #define PMT_CAP_UNCORE_IO_CA_TELEM BIT(18) |
| 55 | #define PMT_CAP_UNCORE_RMID_TELEM BIT(19) |
| 56 | #define PMT_CAP_UNCORE_D2D_ULA_TELEM BIT(20) |
| 57 | #define PMT_CAP_UNCORE_PKGC_TELEM BIT(21) |
| 58 | |
| 59 | /* Crash Log specific masks */ |
| 60 | #define PMT_CAP_CRASHLOG_MAN_TRIG BIT(11) |
| 61 | #define PMT_CAP_CRASHLOG_CORE BIT(12) |
| 62 | #define PMT_CAP_CRASHLOG_UNCORE BIT(13) |
| 63 | #define PMT_CAP_CRASHLOG_TOR BIT(14) |
| 64 | #define PMT_CAP_CRASHLOG_S3M BIT(15) |
| 65 | #define PMT_CAP_CRASHLOG_PERSISTENCY BIT(16) |
| 66 | #define PMT_CAP_CRASHLOG_CLIP_GPIO BIT(17) |
| 67 | #define PMT_CAP_CRASHLOG_PRE_RESET BIT(18) |
| 68 | #define PMT_CAP_CRASHLOG_POST_RESET BIT(19) |
| 69 | |
| 70 | /* PeTe Log specific masks */ |
| 71 | #define PMT_CAP_PETE_MAN_TRIG BIT(11) |
| 72 | #define PMT_CAP_PETE_ENCRYPTION BIT(12) |
| 73 | #define PMT_CAP_PETE_PERSISTENCY BIT(13) |
| 74 | #define PMT_CAP_PETE_REQ_TOKENS BIT(14) |
| 75 | #define PMT_CAP_PETE_PROD_ENABLED BIT(15) |
| 76 | #define PMT_CAP_PETE_DEBUG_ENABLED BIT(16) |
| 77 | |
| 78 | /* TPMI control specific masks */ |
| 79 | #define PMT_CAP_TPMI_MAILBOX BIT(11) |
| 80 | #define PMT_CAP_TPMI_LOCK BIT(12) |
| 81 | |
| 82 | /* Tracing specific masks */ |
| 83 | #define PMT_CAP_TRACE_SRAR BIT(11) |
| 84 | #define PMT_CAP_TRACE_CORRECTABLE BIT(12) |
| 85 | #define PMT_CAP_TRACE_MCTP BIT(13) |
| 86 | #define PMT_CAP_TRACE_MRT BIT(14) |
| 87 | |
| 88 | /* Per RMID Energy Telemetry specific masks */ |
| 89 | #define PMT_CAP_RMID_ENERGY BIT(18) |
| 90 | #define PMT_CAP_RMID_ACTIVITY BIT(19) |
| 91 | #define PMT_CAP_RMID_ENERGY_QUAL BIT(20) |
| 92 | |
| 93 | enum pmt_feature_id { |
| 94 | FEATURE_INVALID = 0x0, |
| 95 | FEATURE_PER_CORE_PERF_TELEM = 0x1, |
| 96 | FEATURE_PER_CORE_ENV_TELEM = 0x2, |
| 97 | FEATURE_PER_RMID_PERF_TELEM = 0x3, |
| 98 | FEATURE_ACCEL_TELEM = 0x4, |
| 99 | FEATURE_UNCORE_TELEM = 0x5, |
| 100 | FEATURE_CRASH_LOG = 0x6, |
| 101 | FEATURE_PETE_LOG = 0x7, |
| 102 | FEATURE_TPMI_CTRL = 0x8, |
| 103 | FEATURE_RESERVED = 0x9, |
| 104 | FEATURE_TRACING = 0xA, |
| 105 | FEATURE_PER_RMID_ENERGY_TELEM = 0xB, |
| 106 | FEATURE_MAX = 0xB, |
| 107 | }; |
| 108 | |
| 109 | enum feature_layout { |
| 110 | LAYOUT_RMID, |
| 111 | LAYOUT_WATCHER, |
| 112 | LAYOUT_COMMAND, |
| 113 | LAYOUT_CAPS_ONLY, |
| 114 | }; |
| 115 | |
| 116 | struct pmt_cap { |
| 117 | u32 mask; |
| 118 | const char *name; |
| 119 | }; |
| 120 | |
| 121 | extern const char * const pmt_feature_names[]; |
| 122 | extern enum feature_layout feature_layout[]; |
| 123 | extern struct pmt_cap pmt_cap_common[]; |
| 124 | extern struct pmt_cap pmt_cap_pcpt[]; |
| 125 | extern struct pmt_cap *pmt_caps_pcpt[]; |
| 126 | extern struct pmt_cap pmt_cap_pcet[]; |
| 127 | extern struct pmt_cap *pmt_caps_pcet[]; |
| 128 | extern struct pmt_cap pmt_cap_rmid_perf[]; |
| 129 | extern struct pmt_cap *pmt_caps_rmid_perf[]; |
| 130 | extern struct pmt_cap pmt_cap_accel[]; |
| 131 | extern struct pmt_cap *pmt_caps_accel[]; |
| 132 | extern struct pmt_cap pmt_cap_uncore[]; |
| 133 | extern struct pmt_cap *pmt_caps_uncore[]; |
| 134 | extern struct pmt_cap pmt_cap_crashlog[]; |
| 135 | extern struct pmt_cap *pmt_caps_crashlog[]; |
| 136 | extern struct pmt_cap pmt_cap_pete[]; |
| 137 | extern struct pmt_cap *pmt_caps_pete[]; |
| 138 | extern struct pmt_cap pmt_cap_tpmi[]; |
| 139 | extern struct pmt_cap *pmt_caps_tpmi[]; |
| 140 | extern struct pmt_cap pmt_cap_s3m[]; |
| 141 | extern struct pmt_cap *pmt_caps_s3m[]; |
| 142 | extern struct pmt_cap pmt_cap_tracing[]; |
| 143 | extern struct pmt_cap *pmt_caps_tracing[]; |
| 144 | extern struct pmt_cap pmt_cap_rmid_energy[]; |
| 145 | extern struct pmt_cap *pmt_caps_rmid_energy[]; |
| 146 | |
| 147 | static inline bool pmt_feature_id_is_valid(enum pmt_feature_id id) |
| 148 | { |
| 149 | if (id > FEATURE_MAX) |
| 150 | return false; |
| 151 | |
| 152 | if (id == FEATURE_INVALID || id == FEATURE_RESERVED) |
| 153 | return false; |
| 154 | |
| 155 | return true; |
| 156 | } |
| 157 | #endif |
| 158 | |