Skip to content

Commit 50802d4

Browse files
dceraologregkh
authored andcommitted
drm/xe/guc: Fail immediately on GuC load error
[ Upstream commit 9b72283 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent c92738f commit 50802d4

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
@@ -1121,22 +1121,22 @@ static int guc_wait_ucode(struct xe_guc *guc)
11211121
struct xe_guc_pc *guc_pc = &gt->uc.guc.pc;
11221122
u32 before_freq, act_freq, cur_freq;
11231123
u32 status = 0, tries = 0;
1124+
int load_result, ret;
11241125
ktime_t before;
11251126
u64 delta_ms;
1126-
int ret;
11271127

11281128
before_freq = xe_guc_pc_get_act_freq(guc_pc);
11291129
before = ktime_get();
11301130

1131-
ret = poll_timeout_us(ret = guc_load_done(gt, &status, &tries), ret,
1131+
ret = poll_timeout_us(load_result = guc_load_done(gt, &status, &tries), load_result,
11321132
10 * USEC_PER_MSEC,
11331133
GUC_LOAD_TIMEOUT_SEC * USEC_PER_SEC, false);
11341134

11351135
delta_ms = ktime_to_ms(ktime_sub(ktime_get(), before));
11361136
act_freq = xe_guc_pc_get_act_freq(guc_pc);
11371137
cur_freq = xe_guc_pc_get_cur_freq_fw(guc_pc);
11381138

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

0 commit comments

Comments
 (0)