|
8 | 8 | #include <linux/delay.h>
|
9 | 9 |
|
10 | 10 | #include <drm/drm_managed.h>
|
| 11 | +#include <drm/drm_print.h> |
11 | 12 | #include <generated/xe_wa_oob.h>
|
12 | 13 |
|
13 | 14 | #include "abi/guc_actions_slpc_abi.h"
|
@@ -1131,3 +1132,61 @@ int xe_guc_pc_init(struct xe_guc_pc *pc)
|
1131 | 1132 |
|
1132 | 1133 | return devm_add_action_or_reset(xe->drm.dev, xe_guc_pc_fini_hw, pc);
|
1133 | 1134 | }
|
| 1135 | + |
| 1136 | +static const char *pc_get_state_string(struct xe_guc_pc *pc) |
| 1137 | +{ |
| 1138 | + switch (slpc_shared_data_read(pc, header.global_state)) { |
| 1139 | + case SLPC_GLOBAL_STATE_NOT_RUNNING: |
| 1140 | + return "not running"; |
| 1141 | + case SLPC_GLOBAL_STATE_INITIALIZING: |
| 1142 | + return "initializing"; |
| 1143 | + case SLPC_GLOBAL_STATE_RESETTING: |
| 1144 | + return "resetting"; |
| 1145 | + case SLPC_GLOBAL_STATE_RUNNING: |
| 1146 | + return "running"; |
| 1147 | + case SLPC_GLOBAL_STATE_SHUTTING_DOWN: |
| 1148 | + return "shutting down"; |
| 1149 | + case SLPC_GLOBAL_STATE_ERROR: |
| 1150 | + return "error"; |
| 1151 | + default: |
| 1152 | + return "unknown"; |
| 1153 | + } |
| 1154 | +} |
| 1155 | + |
| 1156 | +/** |
| 1157 | + * xe_guc_pc_print - Print GuC's Power Conservation information for debug |
| 1158 | + * @pc: Xe_GuC_PC instance |
| 1159 | + * @p: drm_printer |
| 1160 | + */ |
| 1161 | +void xe_guc_pc_print(struct xe_guc_pc *pc, struct drm_printer *p) |
| 1162 | +{ |
| 1163 | + drm_printf(p, "SLPC Shared Data Header:\n"); |
| 1164 | + drm_printf(p, "\tSize: %x\n", slpc_shared_data_read(pc, header.size)); |
| 1165 | + drm_printf(p, "\tGlobal State: %s\n", pc_get_state_string(pc)); |
| 1166 | + |
| 1167 | + if (pc_action_query_task_state(pc)) |
| 1168 | + return; |
| 1169 | + |
| 1170 | + drm_printf(p, "\nSLPC Tasks Status:\n"); |
| 1171 | + drm_printf(p, "\tGTPERF enabled: %s\n", |
| 1172 | + str_yes_no(slpc_shared_data_read(pc, task_state_data.status) & |
| 1173 | + SLPC_GTPERF_TASK_ENABLED)); |
| 1174 | + drm_printf(p, "\tDCC enabled: %s\n", |
| 1175 | + str_yes_no(slpc_shared_data_read(pc, task_state_data.status) & |
| 1176 | + SLPC_DCC_TASK_ENABLED)); |
| 1177 | + drm_printf(p, "\tDCC in use: %s\n", |
| 1178 | + str_yes_no(slpc_shared_data_read(pc, task_state_data.status) & |
| 1179 | + SLPC_IN_DCC)); |
| 1180 | + drm_printf(p, "\tBalancer enabled: %s\n", |
| 1181 | + str_yes_no(slpc_shared_data_read(pc, task_state_data.status) & |
| 1182 | + SLPC_BALANCER_ENABLED)); |
| 1183 | + drm_printf(p, "\tIBC enabled: %s\n", |
| 1184 | + str_yes_no(slpc_shared_data_read(pc, task_state_data.status) & |
| 1185 | + SLPC_IBC_TASK_ENABLED)); |
| 1186 | + drm_printf(p, "\tBalancer IA LMT enabled: %s\n", |
| 1187 | + str_yes_no(slpc_shared_data_read(pc, task_state_data.status) & |
| 1188 | + SLPC_BALANCER_IA_LMT_ENABLED)); |
| 1189 | + drm_printf(p, "\tBalancer IA LMT active: %s\n", |
| 1190 | + str_yes_no(slpc_shared_data_read(pc, task_state_data.status) & |
| 1191 | + SLPC_BALANCER_IA_LMT_ACTIVE)); |
| 1192 | +} |
0 commit comments