Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
	Stuart Summers <stuart.summers@intel.com>,
	Matt Roper <matthew.d.roper@intel.com>,
	"Riana Tauro" <riana.tauro@intel.com>,
	Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>,
	Tvrtko Ursulin <tursulin@ursulin.net>,
	Raag Jadav <raag.jadav@intel.com>
Subject: Re: [PATCH v5 7/7] drm/xe/configfs: Add mid context restore bb
Date: Wed, 17 Sep 2025 15:53:44 -0400	[thread overview]
Message-ID: <aMsRyLSumWeO69mN@intel.com> (raw)
In-Reply-To: <20250916-wa-bb-cmds-v5-7-306bddbc15da@intel.com>

On Tue, Sep 16, 2025 at 02:15:44PM -0700, Lucas De Marchi wrote:
> Like done for post context restore, allow the user to add commands to
> the middle of context restore, at the beginning of engine restore
> commands.
> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>

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

> ---
>  drivers/gpu/drm/xe/xe_configfs.c | 46 ++++++++++++++++++++++++++++++++++++----
>  1 file changed, 42 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_configfs.c b/drivers/gpu/drm/xe/xe_configfs.c
> index 90bc5a4b5da71..640df5bee4579 100644
> --- a/drivers/gpu/drm/xe/xe_configfs.c
> +++ b/drivers/gpu/drm/xe/xe_configfs.c
> @@ -126,13 +126,21 @@
>   * not intended for normal execution and will taint the kernel with TAINT_TEST
>   * when used.
>   *
> - * Currently this is implemented only for post context restore. Examples:
> + * Currently this is implemented only for post and mid context restore.
> + * Examples:
>   *
> - * #. Execute a LRI command to write 0xDEADBEEF to register 0x4f10::
> + * #. Execute a LRI command to write 0xDEADBEEF to register 0x4f10 after the
> + *    normal context restore::
>   *
>   *	# echo 'rcs cmd 11000001 4F100 DEADBEEF' \
>   *		> /sys/kernel/config/xe/0000:03:00.0/ctx_restore_post_bb
>   *
> + * #. Execute a LRI command to write 0xDEADBEEF to register 0x4f10 at the
> + *    beginning of the context restore::
> + *
> + *	# echo 'rcs cmd 11000001 4F100 DEADBEEF' \
> + *		> /sys/kernel/config/xe/0000:03:00.0/ctx_restore_mid_bb
> +
>   * #. Load certain values in a couple of registers (it can be used as a simpler
>   *    alternative to the `cmd`) action::
>   *
> @@ -146,7 +154,7 @@
>   *       When using multiple lines, make sure to use a command that is
>   *       implemented with a single write syscall, like HEREDOC.
>   *
> - * This attribute can only be set before binding to the device.
> + * These attributes can only be set before binding to the device.
>   *
>   * Remove devices
>   * ==============
> @@ -168,6 +176,7 @@ struct xe_config_group_device {
>  	struct xe_config_device {
>  		u64 engines_allowed;
>  		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 enable_psmi;
>  	} config;
> @@ -467,6 +476,13 @@ static ssize_t wa_bb_show(struct xe_config_group_device *dev,
>  	return p - data;
>  }
>  
> +static ssize_t ctx_restore_mid_bb_show(struct config_item *item, char *page)
> +{
> +	struct xe_config_group_device *dev = to_xe_config_group_device(item);
> +
> +	return wa_bb_show(dev, dev->config.ctx_restore_mid_bb, page, SZ_4K);
> +}
> +
>  static ssize_t ctx_restore_post_bb_show(struct config_item *item, char *page)
>  {
>  	struct xe_config_group_device *dev = to_xe_config_group_device(item);
> @@ -623,6 +639,14 @@ static ssize_t wa_bb_store(struct wa_bb wa_bb[static XE_ENGINE_CLASS_MAX],
>  	return len;
>  }
>  
> +static ssize_t ctx_restore_mid_bb_store(struct config_item *item,
> +					const char *data, size_t sz)
> +{
> +	struct xe_config_group_device *dev = to_xe_config_group_device(item);
> +
> +	return wa_bb_store(dev->config.ctx_restore_mid_bb, dev, data, sz);
> +}
> +
>  static ssize_t ctx_restore_post_bb_store(struct config_item *item,
>  					 const char *data, size_t sz)
>  {
> @@ -631,12 +655,14 @@ static ssize_t ctx_restore_post_bb_store(struct config_item *item,
>  	return wa_bb_store(dev->config.ctx_restore_post_bb, dev, data, sz);
>  }
>  
> +CONFIGFS_ATTR(, ctx_restore_mid_bb);
>  CONFIGFS_ATTR(, ctx_restore_post_bb);
>  CONFIGFS_ATTR(, enable_psmi);
>  CONFIGFS_ATTR(, engines_allowed);
>  CONFIGFS_ATTR(, survivability_mode);
>  
>  static struct configfs_attribute *xe_config_device_attrs[] = {
> +	&attr_ctx_restore_mid_bb,
>  	&attr_ctx_restore_post_bb,
>  	&attr_enable_psmi,
>  	&attr_engines_allowed,
> @@ -909,7 +935,19 @@ u32 xe_configfs_get_ctx_restore_mid_bb(struct pci_dev *pdev,
>  				       enum xe_engine_class class,
>  				       const u32 **cs)
>  {
> -	return 0;
> +	struct xe_config_group_device *dev = find_xe_config_group_device(pdev);
> +	u32 len;
> +
> +	if (!dev)
> +		return 0;
> +
> +	if (cs)
> +		*cs = dev->config.ctx_restore_mid_bb[class].cs;
> +
> +	len = dev->config.ctx_restore_mid_bb[class].len;
> +	config_group_put(&dev->group);
> +
> +	return len;
>  }
>  
>  /**
> 
> -- 
> 2.50.1
> 

  reply	other threads:[~2025-09-17 19:53 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-16 21:15 [PATCH v5 0/7] drm/xe: Add user commands to WA BB via configfs Lucas De Marchi
2025-09-16 21:15 ` [PATCH v5 1/7] drm/xe/configfs: Extract function to parse engine Lucas De Marchi
2025-09-16 21:15 ` [PATCH v5 2/7] drm/xe/configfs: Allow to select by class only Lucas De Marchi
2025-09-16 21:15 ` [PATCH v5 3/7] drm/xe/lrc: Allow to add user commands on context switch Lucas De Marchi
2025-09-17 16:32   ` Rodrigo Vivi
2025-09-16 21:15 ` [PATCH v5 4/7] drm/xe/configfs: Add post context restore bb Lucas De Marchi
2025-09-24 20:31   ` Kees Bakker
2025-09-24 21:34     ` Lucas De Marchi
2025-09-16 21:15 ` [PATCH v5 5/7] drm/xe/lrc: Allow INDIRECT_CTX for more engine classes Lucas De Marchi
2025-09-17 19:52   ` Rodrigo Vivi
2025-09-16 21:15 ` [PATCH v5 6/7] drm/xe/lrc: Allow to add user commands mid context switch Lucas De Marchi
2025-09-17 19:53   ` Rodrigo Vivi
2025-09-16 21:15 ` [PATCH v5 7/7] drm/xe/configfs: Add mid context restore bb Lucas De Marchi
2025-09-17 19:53   ` Rodrigo Vivi [this message]
2025-09-16 21:21 ` ✗ CI.checkpatch: warning for drm/xe: Add user commands to WA BB via configfs Patchwork
2025-09-16 21:23 ` ✓ CI.KUnit: success " Patchwork
2025-09-16 21:58 ` ✓ Xe.CI.BAT: " Patchwork
2025-09-17  1:22 ` ✗ Xe.CI.Full: failure " Patchwork
2025-09-17  6:44 ` [PATCH v5 0/7] " Raag Jadav
2025-09-18 21:47 ` Lucas De Marchi

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=aMsRyLSumWeO69mN@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=matthew.d.roper@intel.com \
    --cc=raag.jadav@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=stuart.summers@intel.com \
    --cc=tursulin@ursulin.net \
    --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