public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Wang, X" <x.wang@intel.com>
To: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>,
	igt-dev@lists.freedesktop.org
Cc: Matthew Auld <matthew.auld@intel.com>,
	Matt Roper <matthew.d.roper@intel.com>
Subject: Re: [PATCH i-g-t v7 4/4] tests/xe_pat: Verify PAT entries contain expected values
Date: Wed, 1 Apr 2026 10:54:14 -0700	[thread overview]
Message-ID: <b19b1853-6f32-4b45-b807-072e8514ed42@intel.com> (raw)
In-Reply-To: <20260401135343.2874239-10-zbigniew.kempczynski@intel.com>


On 4/1/2026 06:53, Zbigniew Kempczyński wrote:
> Debugfs exposes PAT entries for different GTs so verify they
> contain expected values. Verify they are correct also in reset
> and suspend scenarios.
>
> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> Cc: Matthew Auld <matthew.auld@intel.com>
> Cc: Matt Roper <matthew.d.roper@intel.com>
> Cc: X Wang <x.wang@intel.com>
> ---
> v4: Test is rewritten to support PAT + PTA + ATS entries.
> v6: Skip on !pf and assert in case of problem with access PAT (Wang)
> v7: Skip on vf
> ---
>   tests/intel/xe_pat.c | 85 ++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 85 insertions(+)
>
> diff --git a/tests/intel/xe_pat.c b/tests/intel/xe_pat.c
> index 2e2d7e01e7..81c28677ac 100644
> --- a/tests/intel/xe_pat.c
> +++ b/tests/intel/xe_pat.c
> @@ -19,6 +19,7 @@
>   #include "igt_fs.h"
>   #include "igt_kmod.h"
>   #include "igt_map.h"
> +#include "igt_sriov_device.h"
>   #include "igt_syncobj.h"
>   #include "igt_sysfs.h"
>   #include "igt_vgem.h"
> @@ -238,6 +239,81 @@ static void pat_sanity(int fd)
>   	}
>   }
>   
> +enum pat_test_opts {
> +	PAT_CHECK = 1,
> +	PAT_RESET_GT = 2,
> +	PAT_SUSPEND = 3,
> +};
> +
> +/**
> + * SUBTEST: pat-sw-hw-compare
> + * Description: verify debugfs 'pat' reflects 'pat_sw_config'
> + *
> + * SUBTEST: pat-sw-hw-reset-compare
> + * Description: verify debugfs 'pat' reflects 'pat_sw_config' after gt reset
> + *
> + * SUBTEST: pat-sw-hw-suspend
> + * Description: verify debugfs 'pat' reflects 'pat_sw_config' after suspend
> + */
> +static void pat_sw_hw_compare(int fd, enum pat_test_opts opts)
> +{
> +	bool matches = true;
> +	int gt;
> +
> +	igt_skip_on(intel_is_vf_device(fd));
> +
> +	xe_for_each_gt(fd, gt) {
> +		struct intel_pat_cache pat_hw_config = {};
> +		struct intel_pat_cache pat_sw_config = {};
> +		int hw_entries, sw_entries;
> +
> +		if (opts == PAT_RESET_GT)
> +			xe_force_gt_reset_sync(fd, gt);
> +		else if (opts == PAT_SUSPEND)
> +			igt_system_suspend_autoresume(SUSPEND_STATE_STANDBY, SUSPEND_TEST_NONE);
> +
> +		hw_entries = xe_get_pat_hw_config(fd, &pat_hw_config, gt);
> +		sw_entries = xe_get_pat_sw_config(fd, &pat_sw_config, gt);
> +
> +		igt_debug("[GT%d] hw_entries: %d, sw_entries: %d\n", gt, hw_entries, sw_entries);
> +
> +		igt_assert_eq(hw_entries, sw_entries);
> +		igt_assert_lt(0, hw_entries);
> +		igt_assert_lt(0, sw_entries);
> +
> +		for (int i = 0; i < hw_entries; i++) {
> +			uint32_t hw_pat, sw_pat;
> +
> +			hw_pat = pat_hw_config.entries[i].pat;
> +			sw_pat = pat_sw_config.entries[i].pat;
> +			if (hw_pat != sw_pat) {
> +				igt_debug("[GT%d] Mismatch of pat register vs sw config "
> +					  "- index: %i, entries: %08x <> %08x\n",
> +					  gt, i, hw_pat, sw_pat);
> +				matches = false;
> +			}
> +		}
> +
> +		/* Check PTA if was explicitly programmed */
> +		if (pat_sw_config.pta_mode != UINT32_MAX &&
> +			pat_hw_config.pta_mode != pat_sw_config.pta_mode) {
> +			igt_debug("[GT%d] Mismatch of PTA_MODE - pta: %x, pta expected: %x\n",
> +				  gt, pat_hw_config.pta_mode, pat_sw_config.pta_mode);
> +			matches = false;
> +		}
> +
> +		/* Check ATS if was explicitly programmed */
> +		if (pat_sw_config.pat_ats != UINT32_MAX &&
> +			pat_hw_config.pat_ats != pat_sw_config.pat_ats) {
> +			igt_debug("[GT%d] Mismatch of PAT_ATS - ats: %x, ats expected: %x\n",
> +				  gt, pat_hw_config.pat_ats, pat_sw_config.pat_ats);
> +			matches = false;
> +		}
> +	}
> +
> +	igt_assert_eq(matches, true);
> +}
> +
>   /**
>    * SUBTEST: pat-index-all
>    * Test category: functionality test
> @@ -2152,6 +2228,15 @@ int igt_main_args("V", NULL, help_str, opt_handler, NULL)
>   	igt_subtest("pat-sanity")
>   		pat_sanity(fd);
>   
> +	igt_subtest("pat-sw-hw-compare")
> +		pat_sw_hw_compare(fd, 0);
> +
> +	igt_subtest("pat-sw-hw-reset-compare")
> +		pat_sw_hw_compare(fd, PAT_RESET_GT);
> +
> +	igt_subtest("pat-sw-hw-suspend")
> +		pat_sw_hw_compare(fd, PAT_SUSPEND);
> +
>   	igt_subtest("pat-index-all")
>   		pat_index_all(fd);
>   
Reviewed-by: Xin Wang <x.wang@intel.com>

  reply	other threads:[~2026-04-01 17: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 ` [PATCH i-g-t v7 2/4] lib/intel_pat: Expose getter of PAT registers Zbigniew Kempczyński
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 [this message]
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=b19b1853-6f32-4b45-b807-072e8514ed42@intel.com \
    --to=x.wang@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --cc=matthew.d.roper@intel.com \
    --cc=zbigniew.kempczynski@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