Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/xe: Introduce GuC PC debugfs

Allows the visualization of the current GuC power conservation
status and policies.

v2: Fix DCC msg (Vinay)
v3: Simplify pc_get_state_string (Jonathan)

Reviewed-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250115145053.1142023-1-rodrigo.vivi@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

+76
+15
drivers/gpu/drm/xe/xe_guc_debugfs.c
··· 13 13 #include "xe_guc.h" 14 14 #include "xe_guc_ct.h" 15 15 #include "xe_guc_log.h" 16 + #include "xe_guc_pc.h" 16 17 #include "xe_macros.h" 17 18 #include "xe_pm.h" 18 19 ··· 61 60 return 0; 62 61 } 63 62 63 + static int guc_pc(struct seq_file *m, void *data) 64 + { 65 + struct xe_guc *guc = node_to_guc(m->private); 66 + struct xe_device *xe = guc_to_xe(guc); 67 + struct drm_printer p = drm_seq_file_printer(m); 68 + 69 + xe_pm_runtime_get(xe); 70 + xe_guc_pc_print(&guc->pc, &p); 71 + xe_pm_runtime_put(xe); 72 + 73 + return 0; 74 + } 75 + 64 76 static const struct drm_info_list debugfs_list[] = { 65 77 {"guc_info", guc_info, 0}, 66 78 {"guc_log", guc_log, 0}, 67 79 {"guc_ctb", guc_ctb, 0}, 80 + {"guc_pc", guc_pc, 0}, 68 81 }; 69 82 70 83 void xe_guc_debugfs_register(struct xe_guc *guc, struct dentry *parent)
+59
drivers/gpu/drm/xe/xe_guc_pc.c
··· 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 1130 pc->bo = bo; 1132 1131 1133 1132 return devm_add_action_or_reset(xe->drm.dev, xe_guc_pc_fini_hw, pc); 1133 + } 1134 + 1135 + static const char *pc_get_state_string(struct xe_guc_pc *pc) 1136 + { 1137 + switch (slpc_shared_data_read(pc, header.global_state)) { 1138 + case SLPC_GLOBAL_STATE_NOT_RUNNING: 1139 + return "not running"; 1140 + case SLPC_GLOBAL_STATE_INITIALIZING: 1141 + return "initializing"; 1142 + case SLPC_GLOBAL_STATE_RESETTING: 1143 + return "resetting"; 1144 + case SLPC_GLOBAL_STATE_RUNNING: 1145 + return "running"; 1146 + case SLPC_GLOBAL_STATE_SHUTTING_DOWN: 1147 + return "shutting down"; 1148 + case SLPC_GLOBAL_STATE_ERROR: 1149 + return "error"; 1150 + default: 1151 + return "unknown"; 1152 + } 1153 + } 1154 + 1155 + /** 1156 + * xe_guc_pc_print - Print GuC's Power Conservation information for debug 1157 + * @pc: Xe_GuC_PC instance 1158 + * @p: drm_printer 1159 + */ 1160 + void xe_guc_pc_print(struct xe_guc_pc *pc, struct drm_printer *p) 1161 + { 1162 + drm_printf(p, "SLPC Shared Data Header:\n"); 1163 + drm_printf(p, "\tSize: %x\n", slpc_shared_data_read(pc, header.size)); 1164 + drm_printf(p, "\tGlobal State: %s\n", pc_get_state_string(pc)); 1165 + 1166 + if (pc_action_query_task_state(pc)) 1167 + return; 1168 + 1169 + drm_printf(p, "\nSLPC Tasks Status:\n"); 1170 + drm_printf(p, "\tGTPERF enabled: %s\n", 1171 + str_yes_no(slpc_shared_data_read(pc, task_state_data.status) & 1172 + SLPC_GTPERF_TASK_ENABLED)); 1173 + drm_printf(p, "\tDCC enabled: %s\n", 1174 + str_yes_no(slpc_shared_data_read(pc, task_state_data.status) & 1175 + SLPC_DCC_TASK_ENABLED)); 1176 + drm_printf(p, "\tDCC in use: %s\n", 1177 + str_yes_no(slpc_shared_data_read(pc, task_state_data.status) & 1178 + SLPC_IN_DCC)); 1179 + drm_printf(p, "\tBalancer enabled: %s\n", 1180 + str_yes_no(slpc_shared_data_read(pc, task_state_data.status) & 1181 + SLPC_BALANCER_ENABLED)); 1182 + drm_printf(p, "\tIBC enabled: %s\n", 1183 + str_yes_no(slpc_shared_data_read(pc, task_state_data.status) & 1184 + SLPC_IBC_TASK_ENABLED)); 1185 + drm_printf(p, "\tBalancer IA LMT enabled: %s\n", 1186 + str_yes_no(slpc_shared_data_read(pc, task_state_data.status) & 1187 + SLPC_BALANCER_IA_LMT_ENABLED)); 1188 + drm_printf(p, "\tBalancer IA LMT active: %s\n", 1189 + str_yes_no(slpc_shared_data_read(pc, task_state_data.status) & 1190 + SLPC_BALANCER_IA_LMT_ACTIVE)); 1134 1191 }
+2
drivers/gpu/drm/xe/xe_guc_pc.h
··· 10 10 11 11 struct xe_guc_pc; 12 12 enum slpc_gucrc_mode; 13 + struct drm_printer; 13 14 14 15 int xe_guc_pc_init(struct xe_guc_pc *pc); 15 16 int xe_guc_pc_start(struct xe_guc_pc *pc); ··· 18 17 int xe_guc_pc_gucrc_disable(struct xe_guc_pc *pc); 19 18 int xe_guc_pc_override_gucrc_mode(struct xe_guc_pc *pc, enum slpc_gucrc_mode mode); 20 19 int xe_guc_pc_unset_gucrc_mode(struct xe_guc_pc *pc); 20 + void xe_guc_pc_print(struct xe_guc_pc *pc, struct drm_printer *p); 21 21 22 22 u32 xe_guc_pc_get_act_freq(struct xe_guc_pc *pc); 23 23 int xe_guc_pc_get_cur_freq(struct xe_guc_pc *pc, u32 *freq);