Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>,
	Francois Dugast <francois.dugast@intel.com>,
	Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
Subject: [PATCH i-g-t 2/2] tests/intel/xe_fault_injection: Make inject-fault-probe-function* tests VF-aware
Date: Thu, 17 Apr 2025 15:13:12 +0200	[thread overview]
Message-ID: <20250417131312.1016503-3-marcin.bernatowicz@linux.intel.com> (raw)
In-Reply-To: <20250417131312.1016503-1-marcin.bernatowicz@linux.intel.com>

Not all probe functions are invoked and cause a failure when fault
injection is performed in a Virtual Function (VF) context. Some of
these functions are only relevant for Physical Function (PF).

Mark such functions with a `pf_only` flag and update the fault injection
test logic to handle VF environments appropriately. When a PF-only
function is tested on a VF device, expect the probe to succeed and
validate accordingly.

This ensures that tests do not produce false failures when run on VFs.

Cc: Francois Dugast <francois.dugast@intel.com>
Cc: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
---
 tests/intel/xe_fault_injection.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/tests/intel/xe_fault_injection.c b/tests/intel/xe_fault_injection.c
index dc8005dc8..818f62ceb 100644
--- a/tests/intel/xe_fault_injection.c
+++ b/tests/intel/xe_fault_injection.c
@@ -16,6 +16,7 @@
 #include "igt.h"
 #include "igt_device.h"
 #include "igt_kmod.h"
+#include "igt_sriov_device.h"
 #include "igt_sysfs.h"
 #include "lib/igt_syncobj.h"
 #include "lib/intel_pat.h"
@@ -385,18 +386,20 @@ igt_main
 	struct drm_xe_engine_class_instance *hwe;
 	static uint32_t devid;
 	char pci_slot[NAME_MAX];
+	bool is_vf_device;
 	const struct section {
 		const char *name;
 		unsigned int flags;
+		bool pf_only;
 	} probe_fail_functions[] = {
 		{ "wait_for_lmem_ready" },
 		{ "xe_add_hw_engine_class_defaults" },
 		{ "xe_device_create" },
 		{ "xe_device_probe_early" },
 		{ "xe_ggtt_init_early" },
-		{ "xe_guc_ads_init" },
+		{ "xe_guc_ads_init", 0, true },
 		{ "xe_guc_ct_init" },
-		{ "xe_guc_log_init" },
+		{ "xe_guc_log_init", 0, true },
 		{ "xe_guc_relay_init" },
 		{ "xe_mmio_probe_early" },
 		{ "xe_pcode_probe_early" },
@@ -405,7 +408,7 @@ igt_main
 		{ "xe_tile_init_early" },
 		{ "xe_uc_fw_init" },
 		{ "xe_wa_init" },
-		{ "xe_wopcm_init" },
+		{ "xe_wopcm_init", 0, true },
 		{ }
 	};
 	const struct section vm_create_fail_functions[] = {
@@ -449,6 +452,7 @@ igt_main
 		igt_device_get_pci_slot_name(fd, pci_slot);
 		setup_injection_fault();
 		igt_install_exit_handler(cleanup_injection_fault);
+		is_vf_device = intel_is_vf_device(fd);
 	}
 
 	for (const struct section *s = vm_create_fail_functions; s->name; s++)
@@ -480,8 +484,15 @@ igt_main
 	}
 
 	for (const struct section *s = probe_fail_functions; s->name; s++)
-		igt_subtest_f("inject-fault-probe-function-%s", s->name)
-			igt_assert_eq(INJECT_ERRNO, inject_fault_probe(fd, pci_slot, s->name));
+		igt_subtest_f("inject-fault-probe-function-%s", s->name) {
+			bool should_pass = s->pf_only && is_vf_device;
+			int err;
+
+			err = inject_fault_probe(fd, pci_slot, s->name);
+
+			igt_assert_eq(should_pass ? 0 : INJECT_ERRNO, err);
+			igt_kmod_unbind("xe", pci_slot);
+		}
 
 	igt_fixture {
 		close(sysfs);
-- 
2.31.1


  parent reply	other threads:[~2025-04-17 13:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-17 13:13 [PATCH i-g-t 0/2] xe_fault_injection: Improve probe fault injection handling Marcin Bernatowicz
2025-04-17 13:13 ` [PATCH i-g-t 1/2] tests/intel/xe_fault_injection: Return probe result from inject_fault_probe Marcin Bernatowicz
2025-04-17 13:13 ` Marcin Bernatowicz [this message]
2025-04-17 14:51 ` ✗ Xe.CI.BAT: failure for xe_fault_injection: Improve probe fault injection handling Patchwork
2025-04-25 10:05   ` Bernatowicz, Marcin
2025-04-17 14:58 ` ✓ i915.CI.BAT: success " Patchwork
2025-04-18  2:57 ` ✗ i915.CI.Full: failure " Patchwork
2025-04-18  7:08 ` ✗ Xe.CI.Full: " Patchwork
2025-04-25 10:07   ` Bernatowicz, Marcin

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=20250417131312.1016503-3-marcin.bernatowicz@linux.intel.com \
    --to=marcin.bernatowicz@linux.intel.com \
    --cc=francois.dugast@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=satyanarayana.k.v.p@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