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>,
	<hiresh.kumar.yadav@intel.com>
Subject: Re: [PATCH v2 2/2] drm/xe: Add debug configfs option to force OCODE load
Date: Wed, 25 Nov 2026 10:33:23 -0500	[thread overview]
Message-ID: <awb_w8MKM7VUJEwK@intel.com> (raw)
In-Reply-To: <20261125125011.192907-6-sk.anirban@intel.com>

On Wed, Nov 25, 2026 at 06:20:14PM +0530, Sk Anirban wrote:
> The late-bind worker skips uploading OCODE when SysCtrl reports it is
> already running.
> Add a debug-only configfs attribute, ocode_force_load, under the

still uses the old name here, but no worries, I'm changing it while merging it.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> per-device xe configfs directory. When set, the late-bind worker skips
> the "OCODE already running" check at probe and uploads the cached
> OCODE payload.
> 
> The attribute must be set before binding the device:
> 
> 	echo 1 > /sys/kernel/config/xe/0000:03:00.0/force_ocode_load
> 
> v2: Rename configfs (Rodrigo)
>     Apply the override on both probe and resume paths (Rodrigo)
> 
> Signed-off-by: Sk Anirban <sk.anirban@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_configfs.c           | 58 ++++++++++++++++++++++
>  drivers/gpu/drm/xe/xe_configfs.h           |  1 +
>  drivers/gpu/drm/xe/xe_late_bind_fw.c       |  6 ++-
>  drivers/gpu/drm/xe/xe_late_bind_fw_types.h |  2 +
>  4 files changed, 66 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_configfs.c b/drivers/gpu/drm/xe/xe_configfs.c
> index 2ddd707a6dbd..801b22fe3c36 100644
> --- a/drivers/gpu/drm/xe/xe_configfs.c
> +++ b/drivers/gpu/drm/xe/xe_configfs.c
> @@ -85,6 +85,13 @@
>   *
>   * This attribute can only be set before binding to the device.
>   *
> + * Force OCODE load:
> + * -----------------
> + *
> + * With CONFIG_DRM_XE_DEBUG enabled, force an OCODE load at probe and resume
> + * even if OCODE is already running. This attribute can only be set before
> + * binding.
> + *
>   * Allowed GT types:
>   * -----------------
>   *
> @@ -302,6 +309,7 @@ struct xe_config_group_device {
>  		struct wa_bb ctx_restore_post_bb[XE_ENGINE_CLASS_MAX];
>  		struct wa_bb ctx_restore_mid_bb[XE_ENGINE_CLASS_MAX];
>  		bool survivability_mode;
> +		bool force_ocode_load;
>  		bool enable_psmi;
>  		bool enable_multi_queue;
>  		bool disable_vram_page_offline;
> @@ -324,6 +332,7 @@ static const struct xe_config_device device_defaults = {
>  	.engines_allowed = U64_MAX,
>  	.migrate_ulls_period_ms = 5,
>  	.survivability_mode = false,
> +	.force_ocode_load = false,
>  	.enable_psmi = false,
>  	.enable_multi_queue = true,
>  	.disable_vram_page_offline = false,
> @@ -429,6 +438,32 @@ static ssize_t survivability_mode_store(struct config_item *item, const char *pa
>  	return len;
>  }
>  
> +static ssize_t force_ocode_load_show(struct config_item *item, char *page)
> +{
> +	struct xe_config_device *dev = to_xe_config_device(item);
> +
> +	return sprintf(page, "%d\n", dev->force_ocode_load);
> +}
> +
> +static ssize_t force_ocode_load_store(struct config_item *item, const char *page, size_t len)
> +{
> +	struct xe_config_group_device *dev = to_xe_config_group_device(item);
> +	bool force_load;
> +	int ret;
> +
> +	ret = kstrtobool(page, &force_load);
> +	if (ret)
> +		return ret;
> +
> +	guard(mutex)(&dev->lock);
> +	if (is_bound(dev))
> +		return -EBUSY;
> +
> +	dev->config.force_ocode_load = force_load;
> +
> +	return len;
> +}
> +
>  static ssize_t gt_types_allowed_show(struct config_item *item, char *page)
>  {
>  	struct xe_config_device *dev = to_xe_config_device(item);
> @@ -946,6 +981,7 @@ CONFIGFS_ATTR(, disable_vram_page_offline);
>  CONFIGFS_ATTR(, engines_allowed);
>  CONFIGFS_ATTR(, gt_types_allowed);
>  CONFIGFS_ATTR(, survivability_mode);
> +CONFIGFS_ATTR(, force_ocode_load);
>  
>  static struct configfs_attribute *xe_config_device_attrs[] = {
>  	&attr_ctx_restore_mid_bb,
> @@ -957,6 +993,7 @@ static struct configfs_attribute *xe_config_device_attrs[] = {
>  	&attr_engines_allowed,
>  	&attr_gt_types_allowed,
>  	&attr_survivability_mode,
> +	&attr_force_ocode_load,
>  	NULL,
>  };
>  
> @@ -980,6 +1017,9 @@ static bool xe_config_device_is_visible(struct config_item *item,
>  {
>  	struct xe_config_group_device *dev = to_xe_config_group_device(item);
>  
> +	if (attr == &attr_force_ocode_load && !IS_ENABLED(CONFIG_DRM_XE_DEBUG))
> +		return false;
> +
>  	if (attr == &attr_survivability_mode) {
>  		if (!dev->desc->is_dgfx || dev->desc->platform < XE_BATTLEMAGE)
>  			return false;
> @@ -1240,6 +1280,7 @@ static void dump_custom_dev_config(struct pci_dev *pdev,
>  	PRI_CUSTOM_ATTR("%d", enable_psmi);
>  	PRI_CUSTOM_ATTR("%d", disable_vram_page_offline);
>  	PRI_CUSTOM_ATTR("%d", survivability_mode);
> +	PRI_CUSTOM_ATTR("%d", force_ocode_load);
>  	PRI_CUSTOM_ATTR("%u", sriov.admin_only_pf);
>  
>  #undef PRI_CUSTOM_ATTR
> @@ -1288,6 +1329,23 @@ bool xe_configfs_get_survivability_mode(struct pci_dev *pdev)
>  	return mode;
>  }
>  
> +bool xe_configfs_get_force_ocode_load(struct pci_dev *pdev)
> +{
> +	struct xe_config_group_device *dev = find_xe_config_group_device(pdev);
> +	bool force_load;
> +
> +	if (!dev || !IS_ENABLED(CONFIG_DRM_XE_DEBUG)) {
> +		if (dev)
> +			config_group_put(&dev->group);
> +		return false;
> +	}
> +
> +	force_load = dev->config.force_ocode_load;
> +	config_group_put(&dev->group);
> +
> +	return force_load;
> +}
> +
>  static u64 get_gt_types_allowed(struct pci_dev *pdev)
>  {
>  	struct xe_config_group_device *dev = find_xe_config_group_device(pdev);
> diff --git a/drivers/gpu/drm/xe/xe_configfs.h b/drivers/gpu/drm/xe/xe_configfs.h
> index d726800de26a..3f0d68bfb9c9 100644
> --- a/drivers/gpu/drm/xe/xe_configfs.h
> +++ b/drivers/gpu/drm/xe/xe_configfs.h
> @@ -18,6 +18,7 @@ int xe_configfs_init(void);
>  void xe_configfs_exit(void);
>  void xe_configfs_check_device(struct pci_dev *pdev);
>  bool xe_configfs_get_survivability_mode(struct pci_dev *pdev);
> +bool xe_configfs_get_force_ocode_load(struct pci_dev *pdev);
>  bool xe_configfs_primary_gt_allowed(struct pci_dev *pdev);
>  bool xe_configfs_media_gt_allowed(struct pci_dev *pdev);
>  u64 xe_configfs_get_engines_allowed(struct pci_dev *pdev);
> diff --git a/drivers/gpu/drm/xe/xe_late_bind_fw.c b/drivers/gpu/drm/xe/xe_late_bind_fw.c
> index dfff1693bf1f..ad39383a7e41 100644
> --- a/drivers/gpu/drm/xe/xe_late_bind_fw.c
> +++ b/drivers/gpu/drm/xe/xe_late_bind_fw.c
> @@ -12,6 +12,7 @@
>  #include <drm/intel/intel_lb_mei_interface.h>
>  #include <drm/drm_print.h>
>  
> +#include "xe_configfs.h"
>  #include "xe_device.h"
>  #include "xe_late_bind_fw.h"
>  #include "xe_pcode.h"
> @@ -259,7 +260,8 @@ static void xe_late_bind_work(struct work_struct *work)
>  	xe_device_assert_mem_access(xe);
>  
>  	/* TODO: Compare the running OCODE version at probe when available. */
> -	if (lbfw->type == INTEL_LB_TYPE_OCODE && xe_sysctrl_is_oobmsm_fw_ready(xe)) {
> +	if (lbfw->type == INTEL_LB_TYPE_OCODE && !late_bind->force_ocode_load &&
> +	    xe_sysctrl_is_oobmsm_fw_ready(xe)) {
>  		drm_dbg(&xe->drm, "%s firmware already loaded, skipping\n",
>  			fw_id_to_name[lbfw->id]);
>  		goto out;
> @@ -557,6 +559,8 @@ int xe_late_bind_init(struct xe_late_bind *late_bind)
>  	if (err)
>  		return err;
>  
> +	late_bind->force_ocode_load = xe_configfs_get_force_ocode_load(to_pci_dev(xe->drm.dev));
> +
>  	xe_late_bind_fw_load(late_bind);
>  
>  	return 0;
> diff --git a/drivers/gpu/drm/xe/xe_late_bind_fw_types.h b/drivers/gpu/drm/xe/xe_late_bind_fw_types.h
> index c7b3ffc743cf..2762442580fb 100644
> --- a/drivers/gpu/drm/xe/xe_late_bind_fw_types.h
> +++ b/drivers/gpu/drm/xe/xe_late_bind_fw_types.h
> @@ -75,6 +75,8 @@ struct xe_late_bind {
>  	bool component_added;
>  	/** @disable: to block late binding reload during pm resume flow*/
>  	bool disable;
> +	/** @force_ocode_load: force OCODE loading even if already running */
> +	bool force_ocode_load;
>  };
>  
>  #endif
> -- 
> 2.43.0
> 

  reply	other threads:[~2026-11-25 15:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 12:50 [PATCH v2 0/2] Skip OCODE late bind if already running Sk Anirban
2026-11-25 12:50 ` [PATCH v2 1/2] drm/xe: " Sk Anirban
2026-11-25 15:34   ` Rodrigo Vivi
2026-11-25 12:50 ` [PATCH v2 2/2] drm/xe: Add debug configfs option to force OCODE load Sk Anirban
2026-11-25 15:33   ` Rodrigo Vivi [this message]
2026-11-25 14:05 ` ✓ CI.KUnit: success for Skip OCODE late bind if already running Patchwork
2026-11-25 14:44 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-25 21:34 ` ✗ Xe.CI.FULL: failure " 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=awb_w8MKM7VUJEwK@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=hiresh.kumar.yadav@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