Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lukasz Laguna <lukasz.laguna@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: marcin.bernatowicz@intel.com
Subject: [PATCH 2/2] tests/intel/xe_sriov_flr: Extend GGTT clearing checks
Date: Thu, 30 Jul 2026 11:38:07 +0200	[thread overview]
Message-ID: <20260730093807.926456-3-lukasz.laguna@intel.com> (raw)
In-Reply-To: <20260730093807.926456-1-lukasz.laguna@intel.com>

In addition to GPA clearing, verify that VFID and the page present bit
are correctly set after VF FLR.

Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
---
 lib/xe/xe_ggtt.c           | 15 +++++++++++++++
 lib/xe/xe_ggtt.h           |  9 +++++++++
 tests/intel/xe_sriov_flr.c | 21 +++++++++++++++++++++
 3 files changed, 45 insertions(+)

diff --git a/lib/xe/xe_ggtt.c b/lib/xe/xe_ggtt.c
index 96b189b7a..8a98e9027 100644
--- a/lib/xe/xe_ggtt.c
+++ b/lib/xe/xe_ggtt.c
@@ -6,6 +6,14 @@
 #include "igt.h"
 #include "xe/xe_ggtt.h"
 
+xe_ggtt_pte_mask_t xe_ggtt_get_vfid_mask(int pf_fd)
+{
+	uint16_t dev_id = intel_get_drm_devid(pf_fd);
+
+	return (intel_graphics_ver(dev_id) >= IP_VER(12, 50)) ?
+		GGTT_PTE_VFID_MASK : TGL_GGTT_PTE_VFID_MASK;
+}
+
 xe_ggtt_pte_mask_t xe_ggtt_get_gpa_mask(int pf_fd)
 {
 	if (IS_TIGERLAKE(intel_get_drm_devid(pf_fd)))
@@ -14,6 +22,13 @@ xe_ggtt_pte_mask_t xe_ggtt_get_gpa_mask(int pf_fd)
 	return GGTT_PTE_ADDR_MASK;
 }
 
+uint8_t xe_ggtt_pte_get_vfid(int pf_fd, xe_ggtt_pte_t pte)
+{
+	xe_ggtt_pte_mask_t mask = xe_ggtt_get_vfid_mask(pf_fd);
+
+	return (uint8_t)((pte & mask) >> GGTT_PTE_VFID_SHIFT);
+}
+
 uint64_t xe_ggtt_pte_get_gpa(int pf_fd, xe_ggtt_pte_t pte)
 {
 	xe_ggtt_pte_mask_t mask = xe_ggtt_get_gpa_mask(pf_fd);
diff --git a/lib/xe/xe_ggtt.h b/lib/xe/xe_ggtt.h
index 5e4038591..ada7ddbb0 100644
--- a/lib/xe/xe_ggtt.h
+++ b/lib/xe/xe_ggtt.h
@@ -12,10 +12,19 @@
 #define TGL_GGTT_PTE_ADDR_MASK		GENMASK_ULL(38, 12)
 #define   GGTT_PTE_ADDR_SHIFT		12
 
+#define GGTT_PTE_VFID_MASK		GENMASK_ULL(11, 2)
+#define TGL_GGTT_PTE_VFID_MASK		GENMASK_ULL(4, 2)
+#define   GGTT_PTE_VFID_SHIFT		2
+
+#define GGTT_PAGE_PRESENT		GENMASK_ULL(0, 0)
+
 typedef uint64_t xe_ggtt_pte_t;
 typedef uint64_t xe_ggtt_pte_mask_t;
 
+xe_ggtt_pte_mask_t xe_ggtt_get_vfid_mask(int pf_fd);
 xe_ggtt_pte_mask_t xe_ggtt_get_gpa_mask(int pf_fd);
+
+uint8_t xe_ggtt_pte_get_vfid(int pf_fd, xe_ggtt_pte_t pte);
 uint64_t xe_ggtt_pte_get_gpa(int pf_fd, xe_ggtt_pte_t pte);
 
 #endif /* __XE_GGTT_H__ */
diff --git a/tests/intel/xe_sriov_flr.c b/tests/intel/xe_sriov_flr.c
index 556979d7b..34a379586 100644
--- a/tests/intel/xe_sriov_flr.c
+++ b/tests/intel/xe_sriov_flr.c
@@ -709,6 +709,16 @@ static bool check_pte_gpa(int pf_fd, xe_ggtt_pte_t pte, uint8_t expected)
 	return (xe_ggtt_pte_get_gpa(pf_fd, pte) == expected);
 }
 
+static bool check_pte_vfid(int pf_fd, xe_ggtt_pte_t pte, uint8_t expected)
+{
+	return (xe_ggtt_pte_get_vfid(pf_fd, pte) == expected);
+}
+
+static bool check_pte_valid(int pf_fd, xe_ggtt_pte_t pte)
+{
+	return (pte & GGTT_PAGE_PRESENT);
+}
+
 static int populate_ggtt_pte_offsets(struct ggtt_data *gdata)
 {
 	int ret, pf_fd = gdata->base.pf_fd, num_vfs = gdata->base.num_vfs;
@@ -828,6 +838,17 @@ static void ggtt_subcheck_verify_vf(int vf_id, int flr_vf_id, struct subcheck_da
 			failed = true;
 		}
 
+		if (!check_pte_vfid(pf_fd, pte, vf_id)) {
+			igt_debug("Wrong GGTT VFID on VF%u after VF%u FLR\n", vf_id, flr_vf_id);
+			failed = true;
+		}
+
+		if (!check_pte_valid(pf_fd, pte)) {
+			igt_debug("GGTT page present bit not set on VF%u after VF%u FLR\n",
+				  vf_id, flr_vf_id);
+			failed = true;
+		}
+
 		if (failed) {
 			set_fail_reason(data,
 					"GGTT check after VF%u FLR failed on VF%u: Read PTE: %#" PRIx64 " at offset: %#x\n",
-- 
2.43.0


  parent reply	other threads:[~2026-07-30  9:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30  9:38 [PATCH 0/2] tests/intel/xe_sriov_flr: Extend GGTT clearing checks Lukasz Laguna
2026-07-30  9:38 ` [PATCH 1/2] lib/xe/xe_ggtt: Extract generic GGTT code into library Lukasz Laguna
2026-08-03 12:24   ` Bernatowicz, Marcin
2026-07-30  9:38 ` Lukasz Laguna [this message]
2026-08-03 12:26   ` [PATCH 2/2] tests/intel/xe_sriov_flr: Extend GGTT clearing checks Bernatowicz, Marcin
2026-07-30 13:43 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-07-30 13:45 ` ✓ i915.CI.BAT: " Patchwork
2026-07-30 16:38 ` ✓ Xe.CI.FULL: " Patchwork
2026-07-30 19:22 ` ✗ i915.CI.Full: 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=20260730093807.926456-3-lukasz.laguna@intel.com \
    --to=lukasz.laguna@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=marcin.bernatowicz@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