|
9 | 9 | #include <linux/ktime.h>
|
10 | 10 |
|
11 | 11 | #include <drm/drm_managed.h>
|
| 12 | +#include <drm/drm_print.h> |
12 | 13 | #include <generated/xe_wa_oob.h>
|
13 | 14 |
|
14 | 15 | #include "abi/guc_actions_slpc_abi.h"
|
@@ -1158,3 +1159,61 @@ int xe_guc_pc_init(struct xe_guc_pc *pc)
|
1158 | 1159 |
|
1159 | 1160 | return devm_add_action_or_reset(xe->drm.dev, xe_guc_pc_fini_hw, pc);
|
1160 | 1161 | }
|
| 1162 | + |
| 1163 | +static const char *pc_get_state_string(struct xe_guc_pc *pc) |
| 1164 | +{ |
| 1165 | + switch (slpc_shared_data_read(pc, header.global_state)) { |
| 1166 | + case SLPC_GLOBAL_STATE_NOT_RUNNING: |
| 1167 | + return "not running"; |
| 1168 | + case SLPC_GLOBAL_STATE_INITIALIZING: |
| 1169 | + return "initializing"; |
| 1170 | + case SLPC_GLOBAL_STATE_RESETTING: |
| 1171 | + return "resetting"; |
| 1172 | + case SLPC_GLOBAL_STATE_RUNNING: |
| 1173 | + return "running"; |
| 1174 | + case SLPC_GLOBAL_STATE_SHUTTING_DOWN: |
| 1175 | + return "shutting down"; |
| 1176 | + case SLPC_GLOBAL_STATE_ERROR: |
| 1177 | + return "error"; |
| 1178 | + default: |
| 1179 | + return "unknown"; |
| 1180 | + } |
| 1181 | +} |
| 1182 | + |
| 1183 | +/** |
| 1184 | + * xe_guc_pc_print - Print GuC's Power Conservation information for debug |
| 1185 | + * @pc: Xe_GuC_PC instance |
| 1186 | + * @p: drm_printer |
| 1187 | + */ |
| 1188 | +void xe_guc_pc_print(struct xe_guc_pc *pc, struct drm_printer *p) |
| 1189 | +{ |
| 1190 | + drm_printf(p, "SLPC Shared Data Header:\n"); |
| 1191 | + drm_printf(p, "\tSize: %x\n", slpc_shared_data_read(pc, header.size)); |
| 1192 | + drm_printf(p, "\tGlobal State: %s\n", pc_get_state_string(pc)); |
| 1193 | + |
| 1194 | + if (pc_action_query_task_state(pc)) |
| 1195 | + return; |
| 1196 | + |
| 1197 | + drm_printf(p, "\nSLPC Tasks Status:\n"); |
| 1198 | + drm_printf(p, "\tGTPERF enabled: %s\n", |
| 1199 | + str_yes_no(slpc_shared_data_read(pc, task_state_data.status) & |
| 1200 | + SLPC_GTPERF_TASK_ENABLED)); |
| 1201 | + drm_printf(p, "\tDCC enabled: %s\n", |
| 1202 | + str_yes_no(slpc_shared_data_read(pc, task_state_data.status) & |
| 1203 | + SLPC_DCC_TASK_ENABLED)); |
| 1204 | + drm_printf(p, "\tDCC in use: %s\n", |
| 1205 | + str_yes_no(slpc_shared_data_read(pc, task_state_data.status) & |
| 1206 | + SLPC_IN_DCC)); |
| 1207 | + drm_printf(p, "\tBalancer enabled: %s\n", |
| 1208 | + str_yes_no(slpc_shared_data_read(pc, task_state_data.status) & |
| 1209 | + SLPC_BALANCER_ENABLED)); |
| 1210 | + drm_printf(p, "\tIBC enabled: %s\n", |
| 1211 | + str_yes_no(slpc_shared_data_read(pc, task_state_data.status) & |
| 1212 | + SLPC_IBC_TASK_ENABLED)); |
| 1213 | + drm_printf(p, "\tBalancer IA LMT enabled: %s\n", |
| 1214 | + str_yes_no(slpc_shared_data_read(pc, task_state_data.status) & |
| 1215 | + SLPC_BALANCER_IA_LMT_ENABLED)); |
| 1216 | + drm_printf(p, "\tBalancer IA LMT active: %s\n", |
| 1217 | + str_yes_no(slpc_shared_data_read(pc, task_state_data.status) & |
| 1218 | + SLPC_BALANCER_IA_LMT_ACTIVE)); |
| 1219 | +} |
0 commit comments