From: Matthew Brost <matthew.brost@intel.com>
To: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH] drm/xe/guc: Fail immediately on GuC load error
Date: Fri, 20 Feb 2026 14:43:51 -0800 [thread overview]
Message-ID: <aZjjp9y9lOTjdwTC@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <20260219214529.1235106-2-daniele.ceraolospurio@intel.com>
On Thu, Feb 19, 2026 at 01:45:30PM -0800, Daniele Ceraolo Spurio wrote:
> 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: a4916b4da448 ("drm/xe/guc: Refactor GuC load to use poll_timeout_us()")
> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> ---
> drivers/gpu/drm/xe/xe_guc.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_guc.c b/drivers/gpu/drm/xe/xe_guc.c
> index cbbb4d665b8f..aacf77f09522 100644
> --- a/drivers/gpu/drm/xe/xe_guc.c
> +++ b/drivers/gpu/drm/xe/xe_guc.c
> @@ -1179,6 +1179,7 @@ static int guc_wait_ucode(struct xe_guc *guc)
> struct xe_guc_pc *guc_pc = >->uc.guc.pc;
> u32 before_freq, act_freq, cur_freq;
> u32 status = 0, tries = 0;
> + int load_result;
> ktime_t before;
> u64 delta_ms;
> int ret;
Nit: load_result declared on same line as 'ret'?
Feel free to fix this up at merging.
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> @@ -1186,7 +1187,7 @@ static int guc_wait_ucode(struct xe_guc *guc)
> before_freq = xe_guc_pc_get_act_freq(guc_pc);
> before = ktime_get();
>
> - ret = poll_timeout_us(ret = guc_load_done(gt, &status, &tries), ret,
> + ret = poll_timeout_us(load_result = guc_load_done(gt, &status, &tries), load_result,
> 10 * USEC_PER_MSEC,
> GUC_LOAD_TIMEOUT_SEC * USEC_PER_SEC, false);
>
> @@ -1194,7 +1195,7 @@ static int guc_wait_ucode(struct xe_guc *guc)
> act_freq = xe_guc_pc_get_act_freq(guc_pc);
> cur_freq = xe_guc_pc_get_cur_freq_fw(guc_pc);
>
> - if (ret) {
> + if (ret || load_result <= 0) {
> xe_gt_err(gt, "load failed: status = 0x%08X, time = %lldms, freq = %dMHz (req %dMHz)\n",
> status, delta_ms, xe_guc_pc_get_act_freq(guc_pc),
> xe_guc_pc_get_cur_freq_fw(guc_pc));
> --
> 2.43.0
>
prev parent reply other threads:[~2026-02-20 22:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-19 21:45 [PATCH] drm/xe/guc: Fail immediately on GuC load error Daniele Ceraolo Spurio
2026-02-19 21:54 ` ✓ CI.KUnit: success for " Patchwork
2026-02-20 8:56 ` ✓ Xe.CI.BAT: " Patchwork
2026-02-20 15:48 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-02-20 22:43 ` Matthew Brost [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aZjjp9y9lOTjdwTC@lstrano-desk.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=daniele.ceraolospurio@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox