From: Matt Roper <matthew.d.roper@intel.com>
To: Xin Wang <x.wang@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, Brian Nguyen <brian3.nguyen@intel.com>
Subject: Re: [PATCH v4] drm/xe: use entry_dump callbacks for xe2+ PAT dumps
Date: Fri, 30 Jan 2026 10:30:32 -0800 [thread overview]
Message-ID: <20260130183032.GC458797@mdroper-desk1.amr.corp.intel.com> (raw)
In-Reply-To: <20260130175349.2249033-1-x.wang@intel.com>
On Fri, Jan 30, 2026 at 05:53:49PM +0000, Xin Wang wrote:
> Move xe2+ PAT entry printing into the entry_dump op so platform
> specific logic stays localized, simplifying future maintenance.
>
> v2:
> - Do not null xe->pat.ops for VFs.
> - Skip PAT init and dump on VFs (-EOPNOTSUPP), avoiding NULL ops use.
>
> v3:
> - fixed typo
>
> v4: (Matt)
> - Switch xe2_dump() to use the new ops->entry_dump() vfunc.
> - Remove xe3p_xpc_dump() and reuse the common xe2_dump() for Xe3p XPC.
> - This also fixes Xe3p_HPM media PAT dumping by using the proper
> non-MCR access for the PAT register range (bspec 76445).
>
> Cc: Matt Roper <matthew.d.roper@intel.com>
> Suggested-by: Brian Nguyen <brian3.nguyen@intel.com>
> Signed-off-by: Xin Wang <x.wang@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
> ---
> drivers/gpu/drm/xe/xe_pat.c | 67 +++++++++----------------------------
> 1 file changed, 16 insertions(+), 51 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_pat.c b/drivers/gpu/drm/xe/xe_pat.c
> index 14d0dce5190a..2cd3fd1c3953 100644
> --- a/drivers/gpu/drm/xe/xe_pat.c
> +++ b/drivers/gpu/drm/xe/xe_pat.c
> @@ -88,6 +88,7 @@ struct xe_pat_ops {
> void (*program_media)(struct xe_gt *gt, const struct xe_pat_table_entry table[],
> int n_entries);
> int (*dump)(struct xe_gt *gt, struct drm_printer *p);
> + void (*entry_dump)(struct drm_printer *p, const char *label, u32 pat, bool rsvd);
> };
>
> static const struct xe_pat_table_entry xelp_pat_table[] = {
> @@ -458,7 +459,7 @@ static int xe2_dump(struct xe_gt *gt, struct drm_printer *p)
> pat = xe_gt_mcr_unicast_read_any(gt, XE_REG_MCR(_PAT_INDEX(i)));
>
> xe_pat_index_label(label, sizeof(label), i);
> - xe2_pat_entry_dump(p, label, pat, !xe->pat.table[i].valid);
> + xe->pat.ops->entry_dump(p, label, pat, !xe->pat.table[i].valid);
> }
>
> /*
> @@ -471,7 +472,7 @@ static int xe2_dump(struct xe_gt *gt, struct drm_printer *p)
> pat = xe_gt_mcr_unicast_read_any(gt, XE_REG_MCR(_PAT_PTA));
>
> drm_printf(p, "Page Table Access:\n");
> - xe2_pat_entry_dump(p, "PTA_MODE", pat, false);
> + xe->pat.ops->entry_dump(p, "PTA_MODE", pat, false);
>
> return 0;
> }
> @@ -480,44 +481,14 @@ static const struct xe_pat_ops xe2_pat_ops = {
> .program_graphics = program_pat_mcr,
> .program_media = program_pat,
> .dump = xe2_dump,
> + .entry_dump = xe2_pat_entry_dump,
> };
>
> -static int xe3p_xpc_dump(struct xe_gt *gt, struct drm_printer *p)
> -{
> - struct xe_device *xe = gt_to_xe(gt);
> - u32 pat;
> - int i;
> - char label[PAT_LABEL_LEN];
> -
> - CLASS(xe_force_wake, fw_ref)(gt_to_fw(gt), XE_FW_GT);
> - if (!fw_ref.domains)
> - return -ETIMEDOUT;
> -
> - 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)));
> -
> - xe_pat_index_label(label, sizeof(label), i);
> - xe3p_xpc_pat_entry_dump(p, label, pat, !xe->pat.table[i].valid);
> - }
> -
> - /*
> - * Also print PTA_MODE, which describes how the hardware accesses
> - * PPGTT entries.
> - */
> - pat = xe_gt_mcr_unicast_read_any(gt, XE_REG_MCR(_PAT_PTA));
> -
> - drm_printf(p, "Page Table Access:\n");
> - xe3p_xpc_pat_entry_dump(p, "PTA_MODE", pat, false);
> -
> - return 0;
> -}
> -
> static const struct xe_pat_ops xe3p_xpc_pat_ops = {
> .program_graphics = program_pat_mcr,
> .program_media = program_pat,
> - .dump = xe3p_xpc_dump,
> + .dump = xe2_dump,
> + .entry_dump = xe3p_xpc_pat_entry_dump,
> };
>
> void xe_pat_init_early(struct xe_device *xe)
> @@ -600,20 +571,17 @@ void xe_pat_init_early(struct xe_device *xe)
> GRAPHICS_VER(xe), GRAPHICS_VERx100(xe) % 100);
> }
>
> - /* VFs can't program nor dump PAT settings */
> - if (IS_SRIOV_VF(xe))
> - xe->pat.ops = NULL;
> -
> - xe_assert(xe, !xe->pat.ops || xe->pat.ops->dump);
> - xe_assert(xe, !xe->pat.ops || xe->pat.ops->program_graphics);
> - xe_assert(xe, !xe->pat.ops || MEDIA_VER(xe) < 13 || xe->pat.ops->program_media);
> + xe_assert(xe, xe->pat.ops->dump);
> + xe_assert(xe, xe->pat.ops->program_graphics);
> + xe_assert(xe, MEDIA_VER(xe) < 13 || xe->pat.ops->program_media);
> + xe_assert(xe, GRAPHICS_VER(xe) < 20 || xe->pat.ops->entry_dump);
> }
>
> void xe_pat_init(struct xe_gt *gt)
> {
> struct xe_device *xe = gt_to_xe(gt);
>
> - if (!xe->pat.ops)
> + if (IS_SRIOV_VF(xe))
> return;
>
> if (xe_gt_is_media_type(gt))
> @@ -633,7 +601,7 @@ int xe_pat_dump(struct xe_gt *gt, struct drm_printer *p)
> {
> struct xe_device *xe = gt_to_xe(gt);
>
> - if (!xe->pat.ops)
> + if (IS_SRIOV_VF(xe))
> return -EOPNOTSUPP;
>
> return xe->pat.ops->dump(gt, p);
> @@ -658,12 +626,9 @@ int xe_pat_dump_sw_config(struct xe_gt *gt, struct drm_printer *p)
> for (u32 i = 0; i < xe->pat.n_entries; i++) {
> u32 pat = xe->pat.table[i].value;
>
> - if (GRAPHICS_VERx100(xe) == 3511) {
> - xe_pat_index_label(label, sizeof(label), i);
> - xe3p_xpc_pat_entry_dump(p, label, pat, !xe->pat.table[i].valid);
> - } else if (GRAPHICS_VER(xe) == 30 || GRAPHICS_VER(xe) == 20) {
> + if (GRAPHICS_VER(xe) >= 20) {
> xe_pat_index_label(label, sizeof(label), i);
> - xe2_pat_entry_dump(p, label, pat, !xe->pat.table[i].valid);
> + xe->pat.ops->entry_dump(p, label, pat, !xe->pat.table[i].valid);
> } else if (xe->info.platform == XE_METEORLAKE) {
> xelpg_pat_entry_dump(p, i, pat);
> } else if (xe->info.platform == XE_PVC) {
> @@ -679,14 +644,14 @@ int xe_pat_dump_sw_config(struct xe_gt *gt, struct drm_printer *p)
> u32 pat = xe->pat.pat_pta->value;
>
> drm_printf(p, "Page Table Access:\n");
> - xe2_pat_entry_dump(p, "PTA_MODE", pat, false);
> + xe->pat.ops->entry_dump(p, "PTA_MODE", pat, false);
> }
>
> if (xe->pat.pat_ats) {
> u32 pat = xe->pat.pat_ats->value;
>
> drm_printf(p, "PCIe ATS/PASID:\n");
> - xe2_pat_entry_dump(p, "PAT_ATS ", pat, false);
> + xe->pat.ops->entry_dump(p, "PAT_ATS ", pat, false);
> }
>
> drm_printf(p, "Cache Level:\n");
> --
> 2.43.0
>
--
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
next prev parent reply other threads:[~2026-01-30 18:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-30 17:53 [PATCH v4] drm/xe: use entry_dump callbacks for xe2+ PAT dumps Xin Wang
2026-01-30 18:00 ` ✓ CI.KUnit: success for drm/xe: use entry_dump callbacks for xe2+ PAT dumps (rev4) Patchwork
2026-01-30 18:30 ` Matt Roper [this message]
2026-02-02 16:36 ` ✓ Xe.CI.BAT: " Patchwork
2026-02-02 18:05 ` 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=20260130183032.GC458797@mdroper-desk1.amr.corp.intel.com \
--to=matthew.d.roper@intel.com \
--cc=brian3.nguyen@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=x.wang@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