]> git.ipfire.org Git - thirdparty/linux.git/commit
drm/xe: Add facility to lookup the value of a register in a default LRC
authorMatt Roper <matthew.d.roper@intel.com>
Wed, 18 Feb 2026 22:09:14 +0000 (14:09 -0800)
committerMatt Roper <matthew.d.roper@intel.com>
Thu, 19 Feb 2026 15:31:05 +0000 (07:31 -0800)
commite950b06014793c035f5328915f2d6d93ec0b5874
treebd31146adae9411a260694c06ea6be7da417db05
parentd389489225b85aac3ad90ed8b5661679f27a2da4
drm/xe: Add facility to lookup the value of a register in a default LRC

An LRC is stored in memory as a special batchbuffer that hardware will
execute to re-load state when switching to the context; it's a
collection of register values (encoded as MI_LOAD_REGISTER_IMM commands)
and other state instructions (e.g., 3DSTATE_*).  The value that will be
loaded for a given register can be determined by parsing the batchbuffer
to find MI_LRI commands and extracting the value from the offset/value
pairs it contains.  Add functions to do this, which will be used in a
future patch to help verify that our expected reg_sr programming is in
place.

The implementation here returns the value as soon as it finds a match in
the LRC.  Technically a register could appear multiple times (either due
to memory corruption or a hardware defect) and the last value
encountered would be the one in effect when the context resumes
execution.  We can adjust the logic to keep looking and return the last
match instead of first in the future if we encounter real-world cases
where this would assist with debugging.

Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Link: https://patch.msgid.link/20260218-sr_verify-v4-3-35d6deeb3421@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
drivers/gpu/drm/xe/xe_lrc.c
drivers/gpu/drm/xe/xe_lrc.h