From: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>,
"Matthew Auld" <matthew.auld@intel.com>
Subject: [PATCH i-g-t v7 2/4] lib/intel_pat: Expose getter of PAT registers
Date: Wed, 1 Apr 2026 15:53:46 +0200 [thread overview]
Message-ID: <20260401135343.2874239-8-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20260401135343.2874239-6-zbigniew.kempczynski@intel.com>
Kernel exposes two debugfs files (per gt) which describe PAT configuration
- pat_sw_config and pat. First contain table which is written to PAT
registers whereas second one returns tables via registers access.
Add possibility to parse second file which might be handy for tests
which wants to verify register state.
Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
---
lib/intel_pat.c | 46 ++++++++++++++++++++++++++++++++++++++++++++--
lib/intel_pat.h | 1 +
2 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/lib/intel_pat.c b/lib/intel_pat.c
index 2693228a73..f1f5644dce 100644
--- a/lib/intel_pat.c
+++ b/lib/intel_pat.c
@@ -8,6 +8,11 @@
#include "intel_pat.h"
#include "xe/xe_query.h"
+enum xe_pat_config {
+ PAT_SW_CONFIG,
+ PAT_HW_CONFIG
+};
+
/**
* xe_get_pat_sw_config - Helper to read PAT (Page Attribute Table) software configuration
* from debugfs
@@ -19,7 +24,8 @@
* Returns: The number of PAT entries successfully read on success, or a negative error
* code on failure
*/
-int32_t xe_get_pat_sw_config(int drm_fd, struct intel_pat_cache *xe_pat_cache, int gt)
+static int32_t xe_get_pat_config(int drm_fd, struct intel_pat_cache *xe_pat_cache,
+ int gt, enum xe_pat_config pat_config)
{
char *line = NULL;
size_t line_len = 0;
@@ -29,7 +35,11 @@ int32_t xe_get_pat_sw_config(int drm_fd, struct intel_pat_cache *xe_pat_cache, i
FILE *dbgfs_file = NULL;
char config[64];
- snprintf(config, sizeof(config), "gt%d/pat_sw_config", gt);
+ if (pat_config == PAT_SW_CONFIG)
+ snprintf(config, sizeof(config), "gt%d/pat_sw_config", gt);
+ else
+ snprintf(config, sizeof(config), "gt%d/pat", gt);
+
dbgfs_fd = igt_debugfs_open(drm_fd, config, O_RDONLY);
if (dbgfs_fd < 0)
return dbgfs_fd;
@@ -100,6 +110,38 @@ int32_t xe_get_pat_sw_config(int drm_fd, struct intel_pat_cache *xe_pat_cache, i
return parsed;
}
+/**
+ * xe_get_pat_sw_config - Helper to read PAT (Page Attribute Table) software configuration
+ * from debugfs
+ *
+ * @drm_fd: DRM device fd to use with igt_debugfs_open
+ * @xe_pat_cache: Pointer to a struct that will receive the parsed PAT configuration
+ * @gt: gt id number
+ *
+ * Returns: The number of PAT entries successfully read on success, or a negative error
+ * code on failure
+ */
+int32_t xe_get_pat_sw_config(int drm_fd, struct intel_pat_cache *xe_pat_cache, int gt)
+{
+ return xe_get_pat_config(drm_fd, xe_pat_cache, gt, PAT_SW_CONFIG);
+}
+
+/**
+ * xe_get_pat_hw_config - Helper to read PAT (Page Attribute Table)
+ * configuration programmed in PAT registers from debugfs.
+ *
+ * @drm_fd: DRM device fd to use with igt_debugfs_open
+ * @xe_pat_cache: Pointer to a struct that will receive the parsed PAT configuration
+ * @gt: gt id number
+ *
+ * Returns: The number of PAT entries successfully read on success, or a negative error
+ * code on failure
+ */
+int32_t xe_get_pat_hw_config(int drm_fd, struct intel_pat_cache *xe_pat_cache, int gt)
+{
+ return xe_get_pat_config(drm_fd, xe_pat_cache, gt, PAT_HW_CONFIG);
+}
+
/*
* Hardcoded PAT indices for Xe platforms, used as a fallback when the
* kernel doesn't expose gt0/pat_sw_config in debugfs.
diff --git a/lib/intel_pat.h b/lib/intel_pat.h
index a658c6ffeb..a31b60e86e 100644
--- a/lib/intel_pat.h
+++ b/lib/intel_pat.h
@@ -38,5 +38,6 @@ uint8_t intel_get_pat_idx_wb(int fd);
uint8_t intel_get_pat_idx_uc_comp(int fd);
int32_t xe_get_pat_sw_config(int drm_fd, struct intel_pat_cache *xe_pat_cache, int gt);
+int32_t xe_get_pat_hw_config(int drm_fd, struct intel_pat_cache *xe_pat_cache, int gt);
#endif /* INTEL_PAT_H */
--
2.43.0
next prev parent reply other threads:[~2026-04-01 13:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-01 13:53 [PATCH i-g-t v7 0/4] Verify PTA entries contains expected values Zbigniew Kempczyński
2026-04-01 13:53 ` [PATCH i-g-t v7 1/4] lib/intel_pat: Support other than gt0 during parsing debugfs PAT Zbigniew Kempczyński
2026-04-01 13:53 ` Zbigniew Kempczyński [this message]
2026-04-01 13:53 ` [PATCH i-g-t v7 3/4] lib/intel_pat: Set PTA + ATS PAT entries to invalid value Zbigniew Kempczyński
2026-04-01 13:53 ` [PATCH i-g-t v7 4/4] tests/xe_pat: Verify PAT entries contain expected values Zbigniew Kempczyński
2026-04-01 17:54 ` Wang, X
2026-04-01 19:44 ` ✓ Xe.CI.BAT: success for Verify PTA entries contains expected values (rev7) Patchwork
2026-04-01 19:59 ` ✓ i915.CI.BAT: " Patchwork
2026-04-02 1:31 ` ✓ Xe.CI.FULL: " Patchwork
2026-04-02 14:14 ` ✓ i915.CI.Full: " 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=20260401135343.2874239-8-zbigniew.kempczynski@intel.com \
--to=zbigniew.kempczynski@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=matthew.auld@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