Skip to content

Commit 9b72283

Browse files
dceraoloThomas Hellström
authored andcommitted
drm/xe/guc: Fail immediately on GuC load error
By using the same variable for both the return of poll_timeout_us and the return of the polled function guc_wait_ucode, the return value of the latter is overwritten and lost after exiting the polling loop. Since guc_wait_ucode returns -1 on GuC load failure, we lose that information and always continue as if the GuC had been loaded correctly. This is fixed by simply using 2 separate variables. Fixes: a4916b4 ("drm/xe/guc: Refactor GuC load to use poll_timeout_us()") Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com> Link: https://patch.msgid.link/20260303001732.2540493-2-daniele.ceraolospurio@intel.com (cherry picked from commit c85ec5c) Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
1 parent 1f318b9 commit 9b72283

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/gpu/drm/xe/xe_guc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,22 +1124,22 @@ static int guc_wait_ucode(struct xe_guc *guc)
11241124
struct xe_guc_pc *guc_pc = &gt->uc.guc.pc;
11251125
u32 before_freq, act_freq, cur_freq;
11261126
u32 status = 0, tries = 0;
1127+
int load_result, ret;
11271128
ktime_t before;
11281129
u64 delta_ms;
1129-
int ret;
11301130

11311131
before_freq = xe_guc_pc_get_act_freq(guc_pc);
11321132
before = ktime_get();
11331133

1134-
ret = poll_timeout_us(ret = guc_load_done(gt, &status, &tries), ret,
1134+
ret = poll_timeout_us(load_result = guc_load_done(gt, &status, &tries), load_result,
11351135
10 * USEC_PER_MSEC,
11361136
GUC_LOAD_TIMEOUT_SEC * USEC_PER_SEC, false);
11371137

11381138
delta_ms = ktime_to_ms(ktime_sub(ktime_get(), before));
11391139
act_freq = xe_guc_pc_get_act_freq(guc_pc);
11401140
cur_freq = xe_guc_pc_get_cur_freq_fw(guc_pc);
11411141

1142-
if (ret) {
1142+
if (ret || load_result <= 0) {
11431143
xe_gt_err(gt, "load failed: status = 0x%08X, time = %lldms, freq = %dMHz (req %dMHz)\n",
11441144
status, delta_ms, xe_guc_pc_get_act_freq(guc_pc),
11451145
xe_guc_pc_get_cur_freq_fw(guc_pc));

0 commit comments

Comments
 (0)