Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Sk Anirban <sk.anirban@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <anshuman.gupta@intel.com>,
	<badal.nilawar@intel.com>, <riana.tauro@intel.com>,
	<karthik.poosa@intel.com>, <raag.jadav@intel.com>,
	<soham.purkait@intel.com>,  <mallesh.koujalagi@intel.com>
Subject: Re: [PATCH] drm/xe/xe_late_bind_fw: Skip OCODE late bind if same version is already running
Date: Tue, 17 Nov 2026 10:27:13 -0500	[thread overview]
Message-ID: <avxyUc1VLSYm7DbG@intel.com> (raw)
In-Reply-To: <20261117125904.2877468-2-sk.anirban@intel.com>

On Tue, Nov 17, 2026 at 06:29:05PM +0530, Sk Anirban wrote:
> Late binding currently uploads OCODE without checking what is already
> running. Before the upload, check whether OCODE is initialized and
> compare its version with the payload's. Skip the push when they
> match.
> 
> Signed-off-by: Sk Anirban <sk.anirban@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_late_bind_fw.c | 31 ++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_late_bind_fw.c b/drivers/gpu/drm/xe/xe_late_bind_fw.c
> index 355d7c841871..4b8c48871d8c 100644
> --- a/drivers/gpu/drm/xe/xe_late_bind_fw.c
> +++ b/drivers/gpu/drm/xe/xe_late_bind_fw.c
> @@ -246,6 +246,31 @@ static void wait_for_worker_completion(struct xe_late_bind *late_bind)
>  	}
>  }
>  
> +static bool xe_late_bind_ocode_is_current(struct xe_late_bind_fw *lbfw)
> +{
> +	struct xe_device *xe = late_bind_fw_to_xe(lbfw);
> +	u16 running_ver;
> +	int ret;
> +
> +	if (lbfw->type != INTEL_LB_TYPE_OCODE || !xe->info.has_sysctrl)
> +		return false;
> +
> +	if (!xe_sysctrl_is_oobmsm_fw_ready(xe))
> +		return false;
> +
> +	ret = xe_sysctrl_sdk_api_version(xe, &running_ver);
> +	if (ret) {
> +		drm_dbg(&xe->drm, "Failed to get running OCODE SDK API version: %pe\n",
> +			ERR_PTR(ret));
> +		return false;
> +	}
> +
> +	drm_dbg(&xe->drm, "OCODE SDK API version running %u, payload %u\n",
> +		running_ver, lbfw->sdk_api_version);
> +
> +	return running_ver == lbfw->sdk_api_version;

This is always true: __xe_late_bind_fw_init() already drops blobs with a
different SDK API version. It isn't the oCode version either.

Overall we need this behavior, but it needs some changes. Please:

- Drop the sdk_api_version check (it also saves a mailbox call). Just check
  xe_sysctrl_is_oobmsm_fw_ready().
- Subject: "Skip OCODE late bind if already running".
- Adjust the commit message to match: if oCode is already running, keep it;
  a new blob takes effect at the next device reset.

Thanks,
Rodrigo

> +}
> +
>  static void xe_late_bind_work(struct work_struct *work)
>  {
>  	struct xe_late_bind_fw *lbfw = container_of(work, struct xe_late_bind_fw, work);
> @@ -258,6 +283,12 @@ static void xe_late_bind_work(struct work_struct *work)
>  
>  	xe_device_assert_mem_access(xe);
>  
> +	if (xe_late_bind_ocode_is_current(lbfw)) {
> +		drm_dbg(&xe->drm, "%s firmware already loaded, skipping\n",
> +			fw_id_to_name[lbfw->id]);
> +		goto out;
> +	}
> +
>  	/* we can queue this before the component is bound */
>  	for (slept = 0; slept < LB_INIT_TIMEOUT_MS; slept += 100) {
>  		if (late_bind->component.ops)
> -- 
> 2.43.0
> 

      parent reply	other threads:[~2026-11-17 15:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 12:59 [PATCH] drm/xe/xe_late_bind_fw: Skip OCODE late bind if same version is already running Sk Anirban
2026-11-17 13:24 ` ✓ CI.KUnit: success for " Patchwork
2026-11-17 13:29 ` [PATCH] " sashiko-bot
2026-11-17 13:55 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-11-17 15:27 ` Rodrigo Vivi [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=avxyUc1VLSYm7DbG@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=karthik.poosa@intel.com \
    --cc=mallesh.koujalagi@intel.com \
    --cc=raag.jadav@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=sk.anirban@intel.com \
    --cc=soham.purkait@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