[bug report] drm/xe/guc_pc: Retry and wait longer for GuC PC start

Dan Carpenter dan.carpenter at linaro.org
Wed Mar 12 06:59:34 UTC 2025


Hello Rodrigo Vivi,

Commit b4b05e53b550 ("drm/xe/guc_pc: Retry and wait longer for GuC PC
start") from Mar 7, 2025 (linux-next), leads to the following Smatch
static checker warning:

	drivers/gpu/drm/xe/xe_guc_pc.c:1073 xe_guc_pc_start()
	warn: missing error code here? '_dev_err()' failed. 'ret' = '0'

drivers/gpu/drm/xe/xe_guc_pc.c
    1028 int xe_guc_pc_start(struct xe_guc_pc *pc)
    1029 {
    1030         struct xe_device *xe = pc_to_xe(pc);
    1031         struct xe_gt *gt = pc_to_gt(pc);
    1032         u32 size = PAGE_ALIGN(sizeof(struct slpc_shared_data));
    1033         unsigned int fw_ref;
    1034         ktime_t earlier;
    1035         int ret;
    1036 
    1037         xe_gt_assert(gt, xe_device_uc_enabled(xe));
    1038 
    1039         fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
    1040         if (!xe_force_wake_ref_has_domain(fw_ref, XE_FW_GT)) {
    1041                 xe_force_wake_put(gt_to_fw(gt), fw_ref);
    1042                 return -ETIMEDOUT;
    1043         }
    1044 
    1045         if (xe->info.skip_guc_pc) {
    1046                 if (xe->info.platform != XE_PVC)
    1047                         xe_gt_idle_enable_c6(gt);
    1048 
    1049                 /* Request max possible since dynamic freq mgmt is not enabled */
    1050                 pc_set_cur_freq(pc, UINT_MAX);
    1051 
    1052                 ret = 0;
    1053                 goto out;
    1054         }
    1055 
    1056         memset(pc->bo->vmap.vaddr, 0, size);
    1057         slpc_shared_data_write(pc, header.size, size);
    1058 
    1059         earlier = ktime_get();
    1060         ret = pc_action_reset(pc);
    1061         if (ret)
    1062                 goto out;
    1063 
    1064         if (wait_for_pc_state(pc, SLPC_GLOBAL_STATE_RUNNING,
    1065                               SLPC_RESET_TIMEOUT_MS)) {
    1066                 xe_gt_warn(gt, "GuC PC start taking longer than normal [freq = %dMHz (req = %dMHz), perf_limit_reasons = 0x%08X]\n",
    1067                            xe_guc_pc_get_act_freq(pc), get_cur_freq(gt),
    1068                            xe_gt_throttle_get_limit_reasons(gt));
    1069 
    1070                 if (wait_for_pc_state(pc, SLPC_GLOBAL_STATE_RUNNING,
    1071                                       SLPC_RESET_EXTENDED_TIMEOUT_MS)) {
    1072                         xe_gt_err(gt, "GuC PC Start failed: Dynamic GT frequency control and GT sleep states are now disabled.\n");
--> 1073                         goto out;

Before this goto returned -EIO, but now it returns success.

    1074                 }
    1075 
    1076                 xe_gt_warn(gt, "GuC PC excessive start time: %lldms",
    1077                            ktime_ms_delta(ktime_get(), earlier));
    1078         }
    1079 
    1080         ret = pc_init_freqs(pc);
    1081         if (ret)
    1082                 goto out;
    1083 
    1084         ret = pc_set_mert_freq_cap(pc);
    1085         if (ret)
    1086                 goto out;
    1087 
    1088         if (xe->info.platform == XE_PVC) {
    1089                 xe_guc_pc_gucrc_disable(pc);
    1090                 ret = 0;
    1091                 goto out;
    1092         }
    1093 
    1094         ret = pc_action_setup_gucrc(pc, GUCRC_FIRMWARE_CONTROL);
    1095         if (ret)
    1096                 goto out;
    1097 
    1098         /* Enable SLPC Optimized Strategy for compute */
    1099         ret = pc_action_set_strategy(pc, SLPC_OPTIMIZED_STRATEGY_COMPUTE);
    1100 
    1101 out:
    1102         xe_force_wake_put(gt_to_fw(gt), fw_ref);
    1103         return ret;
    1104 }

regards,
dan carpenter


More information about the Intel-xe mailing list