[PATCH 0/5] drm/xe: Add user commands to WA BB via configfs

Lucas De Marchi lucas.demarchi at intel.com
Fri May 23 18:54:34 UTC 2025


First patch is just the squash of patch series sent at
20250523-engine-mask-v3-0-11817dc6eb63 at intel.com.

The other patches refactor the WA BB recently added in commit
82b98cadb01f ("drm/xe: Add WA BB to capture active context utilization")
so it can be used for things other than the timestamp keeping.

This is then integrated with configfs to allow validation to experiment
with the GPU, executing commands on every context switch.

This received some limited test on BMG. The interface works, but I'd
still like to extend it in the next versions. It's good just for a first
round of review. Things I'm thinkging about:

	- Extend the dump functions in xe_lrc to interpret the commands
	  from WA BB
	- Double check commands are actually executed correctly in igt
	- Support another interface to write an mmio - although it's
	  possible to pass the LRI command directly, it would be good if
	  the user could simply pass the register to write (taking care
	  of it being a write or rmw.... for that we should probably
	  re-use what's done for the ctx workarounds when priming the
	  default context.
	- The WA BB executes at the end of the context switch. If it's
	  useful we could also allow to plug the cmds and mmio writes to a
	  buffer before it (or better, in the middle) by using the
	  indirect context ptr. We could probably spin that off
	  20250516190000.GL5080 at mdroper-desk1.amr.corp.intel.com.
	- Fix the use of iomem before building on top for the WA BB.
	  There was an issue pointed out by Tvrtko with the BB WAs
	  simply writing directly to the vaddr, without considering it
	  may be iomem. Here I completely ignore the issue and just
	  build on top. However it would be better to fix that before
	  applying this. See
	  https://lore.kernel.org/intel-xe/cdeayuczdl6ncimrrdjdbrbxn27cantuafsyikevqn7v6ziwf6@q7kowyi4chuw/

Finally I'm also not very happy with the bound checks in configfs. From what I
see it guarantees to NUL-terminate the buffer for the write method, but
for the show() there's little we can do. Right now we have a big enough
buffer that will not overflow. However I think it'd be better to double
check how it could be improved.

Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---
Lucas De Marchi (5):
      FOR-CI: Add-configfs-to-load-with-fewer-engines
      drm/xe/lrc: Extract post context restore function
      drm/xe/lrc: Sanity check bb space
      drm/xe/lrc: Allow to add user commands on context switch
      drm/xe/configfs: Add interface to wa_bb commands

 drivers/gpu/drm/xe/xe_configfs.c  | 320 ++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_configfs.h  |  16 +-
 drivers/gpu/drm/xe/xe_hw_engine.c |  20 +++
 drivers/gpu/drm/xe/xe_lrc.c       |  47 +++++-
 4 files changed, 391 insertions(+), 12 deletions(-)

base-commit: 5ed61f4a36b342006a85c561ce0d1ccdd035f9c7
change-id: 20250523-wa-bb-cmds-2a81a7121fc2

Lucas De Marchi



More information about the Intel-xe mailing list