Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>,
	<intel-xe@lists.freedesktop.org>
Cc: <daniele.ceraolospurio@intel.com>, <aravind.iddamsetty@intel.com>,
	<mallesh.koujalagi@intel.com>,
	<alan.previn.teres.alexis@intel.com>, <julia.filipchuk@intel.com>
Subject: Re: [PATCH v2 1/5] drm/xe/guc: Use different error codes for GuC load errors
Date: Wed, 2 Sep 2026 14:56:37 +0200	[thread overview]
Message-ID: <50f9e238-660e-4b40-b2a4-b15fd9bc4a26@intel.com> (raw)
In-Reply-To: <20260901211204.131972-8-umesh.nerlige.ramappa@intel.com>



On 9/1/2026 11:12 PM, Umesh Nerlige Ramappa wrote:
> From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> 
> Instead of always returning -EPROTO no matter what goes wrong, use
> different error codes based on the error type.
> 
> v2: split to its own patch
> 
> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_guc.c | 22 ++++++++++++----------
>  1 file changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_guc.c b/drivers/gpu/drm/xe/xe_guc.c
> index c7f8bbd4cb92..5285d4cecbc8 100644
> --- a/drivers/gpu/drm/xe/xe_guc.c
> +++ b/drivers/gpu/drm/xe/xe_guc.c
> @@ -1144,8 +1144,8 @@ static void print_load_status_err(struct xe_gt *gt, u32 status)
>   * Check GUC_STATUS looking for known terminal states (either completion or
>   * failure) of either the microkernel status field or the boot ROM status field.
>   *
> - * Returns 1 for successful completion, -1 for failure and 0 for any
> - * intermediate state.
> + * Returns 0 for successful completion, -EBUSY for any intermediate state and
> + * other errno values for failure cases.
>   */
>  static int guc_load_done(struct xe_gt *gt, u32 *status, u32 *tries)
>  {
> @@ -1157,20 +1157,22 @@ static int guc_load_done(struct xe_gt *gt, u32 *status, u32 *tries)
>  
>  	switch (ukernel) {
>  	case XE_GUC_LOAD_STATUS_READY:
> -		return 1;
> +		return 0;
>  	case XE_GUC_LOAD_STATUS_ERROR_DEVID_BUILD_MISMATCH:
>  	case XE_GUC_LOAD_STATUS_GUC_PREPROD_BUILD_MISMATCH:
>  	case XE_GUC_LOAD_STATUS_ERROR_DEVID_INVALID_GUCTYPE:
>  	case XE_GUC_LOAD_STATUS_HWCONFIG_ERROR:
>  	case XE_GUC_LOAD_STATUS_BOOTROM_VERSION_MISMATCH:
> +		return -ENOEXEC;
>  	case XE_GUC_LOAD_STATUS_DPC_ERROR:
>  	case XE_GUC_LOAD_STATUS_EXCEPTION:
> +		return -EIO;
>  	case XE_GUC_LOAD_STATUS_INIT_DATA_INVALID:
>  	case XE_GUC_LOAD_STATUS_MPU_DATA_INVALID:
>  	case XE_GUC_LOAD_STATUS_INIT_MMIO_SAVE_RESTORE_INVALID:
>  	case XE_GUC_LOAD_STATUS_KLV_WORKAROUND_INIT_ERROR:
>  	case XE_GUC_LOAD_STATUS_INVALID_FTR_FLAG:
> -		return -1;
> +		return -EINVAL;
>  	}
>  
>  	switch (bootrom) {
> @@ -1184,7 +1186,7 @@ static int guc_load_done(struct xe_gt *gt, u32 *status, u32 *tries)
>  	case XE_BOOTROM_STATUS_MPUMAP_INCORRECT:
>  	case XE_BOOTROM_STATUS_EXCEPTION:
>  	case XE_BOOTROM_STATUS_PROD_KEY_CHECK_FAILURE:
> -		return -1;
> +		return -ENOEXEC;
>  	}
>  
>  	if (++*tries >= 100) {
> @@ -1197,7 +1199,7 @@ static int guc_load_done(struct xe_gt *gt, u32 *status, u32 *tries)
>  			  *status, ukernel, bootrom);
>  	}
>  
> -	return 0;
> +	return -EBUSY;
>  }
>  
>  static int guc_wait_ucode(struct xe_guc *guc)
> @@ -1213,21 +1215,21 @@ 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(load_result = guc_load_done(gt, &status, &tries), load_result,
> -			      10 * USEC_PER_MSEC,
> +	ret = poll_timeout_us(load_result = guc_load_done(gt, &status, &tries),
> +			      load_result != -EBUSY, 10 * USEC_PER_MSEC,
>  			      GUC_LOAD_TIMEOUT_SEC * USEC_PER_SEC, false);
>  
>  	delta_ms = ktime_to_ms(ktime_sub(ktime_get(), before));
>  	act_freq = xe_guc_pc_get_act_freq(guc_pc);
>  	cur_freq = xe_guc_pc_get_cur_freq_fw(guc_pc);
>  
> -	if (ret || load_result <= 0) {
> +	if (ret || load_result) {
>  		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));
>  		print_load_status_err(gt, status);
>  
> -		return -EPROTO;
> +		return ret ?: load_result;
>  	}
>  
>  	if (delta_ms > GUC_LOAD_TIME_WARN_MSEC) {

Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>


  reply	other threads:[~2026-09-02 12:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01 21:12 [PATCH v2 0/5] Use SIG_ID logs for GuC component Umesh Nerlige Ramappa
2026-09-01 21:12 ` [PATCH v2 1/5] drm/xe/guc: Use different error codes for GuC load errors Umesh Nerlige Ramappa
2026-09-02 12:56   ` Michal Wajdeczko [this message]
2026-09-01 21:12 ` [PATCH v2 2/5] drm/xe/guc: Use different error codes for CT errors Umesh Nerlige Ramappa
2026-09-02 14:22   ` Michal Wajdeczko
2026-09-02 22:35     ` Umesh Nerlige Ramappa
2026-09-01 21:12 ` [PATCH v2 3/5] drm/xe/uc: Report DMA failure using SIGID Umesh Nerlige Ramappa
2026-09-01 21:12 ` [PATCH v2 4/5] drm/xe/guc: Report major GuC failures " Umesh Nerlige Ramappa
2026-09-02 14:33   ` Michal Wajdeczko
2026-09-02 19:02     ` Umesh Nerlige Ramappa
2026-09-01 21:12 ` [PATCH v2 5/5] drm/xe/guc: Report errors that cause a CT shutdown " Umesh Nerlige Ramappa
2026-09-02 14:45   ` Michal Wajdeczko
2026-09-03 22:21     ` Umesh Nerlige Ramappa
2026-09-01 21:18 ` ✗ CI.checkpatch: warning for Use SIG_ID logs for GuC component Patchwork
2026-09-01 21:20 ` ✓ CI.KUnit: success " Patchwork
2026-09-02  6:57 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-02 12:05 ` ✓ Xe.CI.FULL: " Patchwork

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=50f9e238-660e-4b40-b2a4-b15fd9bc4a26@intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=alan.previn.teres.alexis@intel.com \
    --cc=aravind.iddamsetty@intel.com \
    --cc=daniele.ceraolospurio@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=julia.filipchuk@intel.com \
    --cc=mallesh.koujalagi@intel.com \
    --cc=umesh.nerlige.ramappa@intel.com \
    /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