Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Xin Wang <x.wang@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: matthew.d.roper@intel.com, shuicheng.lin@intel.com,
	Xin Wang <x.wang@intel.com>
Subject: [PATCH v3] drm/xe: highlight reserved PAT entries in dump output
Date: Thu, 30 Oct 2025 22:17:34 +0000	[thread overview]
Message-ID: <20251030221734.1058350-1-x.wang@intel.com> (raw)
In-Reply-To: <20251022215504.5559-1-x.wang@intel.com>

Enhance the PAT table dump by marking reserved entries with an
asterisk (*) for improved readability and debugging.

V2:
  Added a note in the "PAT table" header explaining the meaning of
the asterisk(*) to improve clarity for readers. (Matt Roper)

V3:
  Introduced a valid field in struct xe_pat_table_entry to
explicitly track whether an entry is valid or reserved, avoiding
reliance on coh_mode == 0. (Matt Roper)

Signed-off-by: Xin Wang <x.wang@intel.com>
---
 drivers/gpu/drm/xe/xe_pat.c | 15 ++++++++-------
 drivers/gpu/drm/xe/xe_pat.h |  5 +++++
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_pat.c b/drivers/gpu/drm/xe/xe_pat.c
index 059e3a88ce5a..47e76a46ef02 100644
--- a/drivers/gpu/drm/xe/xe_pat.c
+++ b/drivers/gpu/drm/xe/xe_pat.c
@@ -109,7 +109,8 @@ static const struct xe_pat_table_entry xelpg_pat_table[] = {
 			REG_FIELD_PREP(XE2_L4_POLICY, l4_policy) | \
 			REG_FIELD_PREP(XE2_COH_MODE, __coh_mode), \
 		.coh_mode = (BUILD_BUG_ON_ZERO(__coh_mode && comp_en) || __coh_mode) ? \
-			XE_COH_AT_LEAST_1WAY : XE_COH_NONE \
+			XE_COH_AT_LEAST_1WAY : XE_COH_NONE, \
+		.valid = 1 \
 	}
 
 static const struct xe_pat_table_entry xe2_pat_table[] = {
@@ -403,7 +404,7 @@ static int xe2_dump(struct xe_gt *gt, struct drm_printer *p)
 	if (!fw_ref)
 		return -ETIMEDOUT;
 
-	drm_printf(p, "PAT table:\n");
+	drm_printf(p, "PAT table: (* = reserved entry)\n");
 
 	for (i = 0; i < xe->pat.n_entries; i++) {
 		if (xe_gt_is_media_type(gt))
@@ -411,14 +412,14 @@ static int xe2_dump(struct xe_gt *gt, struct drm_printer *p)
 		else
 			pat = xe_gt_mcr_unicast_read_any(gt, XE_REG_MCR(_PAT_INDEX(i)));
 
-		drm_printf(p, "PAT[%2d] = [ %u, %u, %u, %u, %u, %u ]  (%#8x)\n", i,
+		drm_printf(p, "PAT[%2d] = [ %u, %u, %u, %u, %u, %u ]  (%#8x)%s\n", i,
 			   !!(pat & XE2_NO_PROMOTE),
 			   !!(pat & XE2_COMP_EN),
 			   REG_FIELD_GET(XE2_L3_CLOS, pat),
 			   REG_FIELD_GET(XE2_L3_POLICY, pat),
 			   REG_FIELD_GET(XE2_L4_POLICY, pat),
 			   REG_FIELD_GET(XE2_COH_MODE, pat),
-			   pat);
+			   pat, xe->pat.table[i].valid ? "" : " *");
 	}
 
 	/*
@@ -461,18 +462,18 @@ static int xe3p_xpc_dump(struct xe_gt *gt, struct drm_printer *p)
 	if (!fw_ref)
 		return -ETIMEDOUT;
 
-	drm_printf(p, "PAT table:\n");
+	drm_printf(p, "PAT table: (* = reserved entry)\n");
 
 	for (i = 0; i < xe->pat.n_entries; i++) {
 		pat = xe_gt_mcr_unicast_read_any(gt, XE_REG_MCR(_PAT_INDEX(i)));
 
-		drm_printf(p, "PAT[%2d] = [ %u, %u, %u, %u, %u ]  (%#8x)\n", i,
+		drm_printf(p, "PAT[%2d] = [ %u, %u, %u, %u, %u ]  (%#8x)%s\n", i,
 			   !!(pat & XE2_NO_PROMOTE),
 			   REG_FIELD_GET(XE2_L3_CLOS, pat),
 			   REG_FIELD_GET(XE2_L3_POLICY, pat),
 			   REG_FIELD_GET(XE2_L4_POLICY, pat),
 			   REG_FIELD_GET(XE2_COH_MODE, pat),
-			   pat);
+			   pat, xe->pat.table[i].valid ? "" : " *");
 	}
 
 	/*
diff --git a/drivers/gpu/drm/xe/xe_pat.h b/drivers/gpu/drm/xe/xe_pat.h
index 268c9a899f56..05dae03a5f54 100644
--- a/drivers/gpu/drm/xe/xe_pat.h
+++ b/drivers/gpu/drm/xe/xe_pat.h
@@ -29,6 +29,11 @@ struct xe_pat_table_entry {
 #define XE_COH_NONE          1
 #define XE_COH_AT_LEAST_1WAY 2
 	u16 coh_mode;
+
+	/**
+	 * @valid: Set to 1 if the entry is valid, 0 if it's reserved.
+	 */
+	u16 valid;
 };
 
 /**
-- 
2.43.0


  parent reply	other threads:[~2025-10-30 22:17 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22 21:55 [PATCH] drm/xe: Dump PAT entries with reserved mark Xin Wang
2025-10-22 22:09 ` Wang, X
2025-10-29 19:48   ` Matt Roper
2025-10-29 21:28     ` Wang, X
2025-10-29 21:39       ` Matt Roper
2025-10-23  1:50 ` ✓ CI.KUnit: success for " Patchwork
2025-10-23  2:28 ` ✓ Xe.CI.BAT: " Patchwork
2025-10-23  9:07 ` ✗ Xe.CI.Full: failure " Patchwork
2025-10-29 23:39 ` [PATCH v2] drm/xe: highlight reserved PAT entries in dump output Xin Wang
2025-10-30 16:35   ` Matt Roper
2025-10-30 19:55     ` Wang, X
2025-10-30 20:13       ` Matt Roper
2025-10-30 20:38         ` Wang, X
2025-10-30 16:15 ` Xin Wang
2025-10-30 18:31 ` ✓ CI.KUnit: success for drm/xe: Dump PAT entries with reserved mark (rev2) Patchwork
2025-10-30 19:09 ` ✓ Xe.CI.BAT: " Patchwork
2025-10-30 22:17 ` Xin Wang [this message]
2025-10-30 22:30   ` [PATCH v3] drm/xe: highlight reserved PAT entries in dump output Matt Roper
2025-10-31  0:40 ` ✗ Xe.CI.Full: failure for drm/xe: Dump PAT entries with reserved mark (rev2) Patchwork
2025-10-31  1:14 ` ✓ CI.KUnit: success for drm/xe: Dump PAT entries with reserved mark (rev3) Patchwork
2025-10-31  2:04 ` ✓ Xe.CI.BAT: " Patchwork
2025-10-31 11:04 ` ✓ Xe.CI.Full: " Patchwork
2025-10-31 15:49   ` Matt Roper

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=20251030221734.1058350-1-x.wang@intel.com \
    --to=x.wang@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.d.roper@intel.com \
    --cc=shuicheng.lin@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