From: Matt Roper <matthew.d.roper@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: matthew.d.roper@intel.com
Subject: [PATCH v2 4/4] drm/xe/reg_sr: Allow register_save_restore_check debugfs to verify LRC values
Date: Wed, 11 Feb 2026 15:34:16 -0800 [thread overview]
Message-ID: <20260211233411.614951-10-matthew.d.roper@intel.com> (raw)
In-Reply-To: <20260211233411.614951-6-matthew.d.roper@intel.com>
reg_sr programming that applies to an engines LRC cannot be verified by
a simple CPU-based register readout because the reg_sr's values may not
be in effect if no context is executing on the hardware at the time we
check. Instead, we should verify correct reg_sr application by
searching for the register in the default_lrc.
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
drivers/gpu/drm/xe/xe_gt_debugfs.c | 4 ++--
drivers/gpu/drm/xe/xe_reg_sr.c | 29 +++++++++++++++++++++++++++++
drivers/gpu/drm/xe/xe_reg_sr.h | 4 ++++
3 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_gt_debugfs.c b/drivers/gpu/drm/xe/xe_gt_debugfs.c
index aa43427a9f4b..f45306308cd6 100644
--- a/drivers/gpu/drm/xe/xe_gt_debugfs.c
+++ b/drivers/gpu/drm/xe/xe_gt_debugfs.c
@@ -173,8 +173,8 @@ static int register_save_restore_check(struct xe_gt *gt, struct drm_printer *p)
xe_reg_sr_readback_check(>->reg_sr, gt, p);
for_each_hw_engine(hwe, gt, id)
xe_reg_sr_readback_check(&hwe->reg_sr, gt, p);
-
- /* TODO: Check hwe->reg_lrc against contents of default_lrc. */
+ for_each_hw_engine(hwe, gt, id)
+ xe_reg_sr_lrc_check(&hwe->reg_lrc, gt, hwe, p);
return 0;
}
diff --git a/drivers/gpu/drm/xe/xe_reg_sr.c b/drivers/gpu/drm/xe/xe_reg_sr.c
index 75aa4426b3ec..27a9447a672b 100644
--- a/drivers/gpu/drm/xe/xe_reg_sr.c
+++ b/drivers/gpu/drm/xe/xe_reg_sr.c
@@ -21,6 +21,7 @@
#include "xe_gt_printk.h"
#include "xe_gt_types.h"
#include "xe_hw_engine_types.h"
+#include "xe_lrc.h"
#include "xe_mmio.h"
#include "xe_rtp_types.h"
@@ -242,3 +243,31 @@ void xe_reg_sr_readback_check(struct xe_reg_sr *sr,
offset, mask, entry->set_bits, val & mask);
}
}
+
+/**
+ * xe_reg_sr_lrc_check() - Check LRC for registers referenced in save/restore
+ * entries and check whether the programming is in place.
+ * @sr: Save/restore entries
+ * @gt: GT to read register from
+ * @p: DRM printer to report discrepancies on
+ */
+void xe_reg_sr_lrc_check(struct xe_reg_sr *sr,
+ struct xe_gt *gt,
+ struct xe_hw_engine *hwe,
+ struct drm_printer *p)
+{
+ struct xe_reg_sr_entry *entry;
+ unsigned long offset;
+
+ xa_for_each(&sr->xa, offset, entry) {
+ u32 val;
+ int ret = xe_lrc_lookup_default_reg_value(gt, hwe->class, offset, &val);
+ u32 mask = entry->clr_bits | entry->set_bits;
+
+ if (ret == -ENOENT)
+ drm_printf(p, "%#8lx :: not found in LRC for %s\n", offset, hwe->name);
+ else if ((val & mask) != entry->set_bits)
+ drm_printf(p, "%#8lx & %#10x :: expected %#10x got %#10x\n",
+ offset, mask, entry->set_bits, val & mask);
+ }
+}
diff --git a/drivers/gpu/drm/xe/xe_reg_sr.h b/drivers/gpu/drm/xe/xe_reg_sr.h
index cd133a09aa9b..1ec6e8ecf278 100644
--- a/drivers/gpu/drm/xe/xe_reg_sr.h
+++ b/drivers/gpu/drm/xe/xe_reg_sr.h
@@ -22,6 +22,10 @@ void xe_reg_sr_dump(struct xe_reg_sr *sr, struct drm_printer *p);
void xe_reg_sr_readback_check(struct xe_reg_sr *sr,
struct xe_gt *gt,
struct drm_printer *p);
+void xe_reg_sr_lrc_check(struct xe_reg_sr *sr,
+ struct xe_gt *gt,
+ struct xe_hw_engine *hwe,
+ struct drm_printer *p);
int xe_reg_sr_add(struct xe_reg_sr *sr, const struct xe_reg_sr_entry *e,
struct xe_gt *gt);
--
2.53.0
next prev parent reply other threads:[~2026-02-11 23:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-11 23:34 [PATCH v2 0/4] Add debugfs facility to catch RTP mistakes Matt Roper
2026-02-11 23:34 ` [PATCH v2 1/4] drm/xe/reg_sr: Don't process gt/hwe lists in VF Matt Roper
2026-02-11 23:34 ` [PATCH v2 2/4] drm/xe/reg_sr: Add debugfs to verify status of reg_sr programming Matt Roper
2026-02-11 23:34 ` [PATCH v2 3/4] drm/xe: Add facility to lookup the value of a register in a default LRC Matt Roper
2026-02-11 23:34 ` Matt Roper [this message]
2026-02-12 0:23 ` ✓ CI.KUnit: success for Add debugfs facility to catch RTP mistakes Patchwork
2026-02-12 1:05 ` ✗ Xe.CI.BAT: 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=20260211233411.614951-10-matthew.d.roper@intel.com \
--to=matthew.d.roper@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/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