All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t v2 0/3] xe/xe_module_load: add a test to load/unload Xe driver
@ 2023-03-22 12:32 Mauro Carvalho Chehab
  2023-03-22 12:32 ` [igt-dev] [PATCH i-g-t v2 1/3] intel-ci: update blacklists to work with the " Mauro Carvalho Chehab
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2023-03-22 12:32 UTC (permalink / raw)
  To: igt-dev

From: Mauro Carvalho Chehab <mchehab@kernel.org>

It is interesting to let IGT to unload/reload the Xe driver,
as it can help CI to track track troubles.

Add support for it.

Test documentation:

	==================
	igt@xe_module_load
	==================
	
	:Category: Sofware building block
	:File: tests/xe/xe_module_load.c
	:Sub-category: driver
	:Summary: Tests the xe module loading
	:Test category: functionality test
	
	igt@xe_module_load@force-load
	=============================
	
	:Description: Load the Xe driver passing ``force_probe=*`` parameter
	:Run type: BAT
	
	
	igt@xe_module_load@load
	=======================
	
	:Description: Load the Xe driver
	:Run type: FULL
	
	
	igt@xe_module_load@unload
	=========================
	
	:Description: Unload the Xe driver
	:Run type: FULL
	
	
	igt@xe_module_load@reload
	=========================
	
	:Description: Reload the Xe driver
	:Run type: FULL
	
	
	igt@xe_module_load@reload-no-display
	====================================
	
	:Description: Reload the Xe driver passing ``enable_display=0`` parameter
	:Run type: FULL
	
	
	igt@xe_module_load@many-reload
	==============================
	
	:Description: Reload the Xe driver many times
	:Run type: FULL

---

v2:

- added a patch (already submitted) to shut-up i915 trybot to
  try to run those tests when i915 driver is loaded;
- removed duplication of the unwanted drivers array and declare
  it as const with const strings;
- reordered includes and removed a duplication;
- did some cosmetic changes.

Mauro Carvalho Chehab (3):
  intel-ci: update blacklists to work with the Xe driver
  lib/igt_kmod: add support for Xe driver
  xe/xe_module_load: add a test to load/unload Xe driver

 lib/igt_kmod.c                           |  34 ++---
 lib/igt_kmod.h                           |  32 ++++-
 tests/intel-ci/blacklist.txt             | 130 +------------------
 tests/intel-ci/i915-blacklist.txt        | 133 +++++++++++++++++++
 tests/intel-ci/xe-blacklist.txt          |  21 +++
 tests/intel-ci/xe-fast-feedback.testlist |   3 +
 tests/meson.build                        |   1 +
 tests/xe/xe_module_load.c                | 158 +++++++++++++++++++++++
 8 files changed, 363 insertions(+), 149 deletions(-)
 mode change 100644 => 120000 tests/intel-ci/blacklist.txt
 create mode 100644 tests/intel-ci/i915-blacklist.txt
 create mode 100644 tests/intel-ci/xe-blacklist.txt
 create mode 100644 tests/xe/xe_module_load.c

-- 
2.39.2

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [igt-dev] [PATCH i-g-t v2 1/3] intel-ci: update blacklists to work with the Xe driver
  2023-03-22 12:32 [igt-dev] [PATCH i-g-t v2 0/3] xe/xe_module_load: add a test to load/unload Xe driver Mauro Carvalho Chehab
@ 2023-03-22 12:32 ` Mauro Carvalho Chehab
  2023-03-22 12:33 ` [igt-dev] [PATCH i-g-t v2 2/3] lib/igt_kmod: add support for " Mauro Carvalho Chehab
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2023-03-22 12:32 UTC (permalink / raw)
  To: igt-dev

From: Mauro Carvalho Chehab <mchehab@kernel.org>

It doesn't make sense to run i915 tests with Xe driver and
vice-versa. Update testlists to make it clear.

In order to avoid disrupts at exiting intel-ci tests, keep a
symlink:
	i915-blacklist.txt -> blacklist.txt

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
 tests/intel-ci/blacklist.txt      | 130 +----------------------------
 tests/intel-ci/i915-blacklist.txt | 133 ++++++++++++++++++++++++++++++
 tests/intel-ci/xe-blacklist.txt   |  21 +++++
 3 files changed, 155 insertions(+), 129 deletions(-)
 mode change 100644 => 120000 tests/intel-ci/blacklist.txt
 create mode 100644 tests/intel-ci/i915-blacklist.txt
 create mode 100644 tests/intel-ci/xe-blacklist.txt

diff --git a/tests/intel-ci/blacklist.txt b/tests/intel-ci/blacklist.txt
deleted file mode 100644
index 6e5cc43667cf..000000000000
--- a/tests/intel-ci/blacklist.txt
+++ /dev/null
@@ -1,129 +0,0 @@
-igt@meta_test(@.*)?
-###############################################
-# Handle module reloads with great care!
-#
-# Reloading a module is more likely to leave
-# the machine in an unexpected state than other
-# self-contained tests, leading to random
-# failures in tests run afterwards.
-###############################################
-#igt@i915_module_load(@.*)? # danger, danger; hope for taints!
-igt@i915_pm_rpm@module-reload
-igt@i915_pm_rpm@gem-execbuf-stress-extra-wait
-###############################################
-# GEM
-###############################################
-igt@gem_busy@hang.*
-igt@gem_close_race@(?!.*basic).*
-igt@gem_concurrent_blit(@.*)?
-igt@gem_ctx_create@(?!.*basic).*
-igt@gem_ctx_exec@(?!.*basic).*
-igt@gem_ctx_shared@*exhaust*
-igt@gem_ctx_switch(@.*)?
-igt@gem_evict_alignment(@.*)?
-igt@gem_evict_everything(@.*)?
-igt@gem_exec_big@(?!.*single).*
-igt@gem_exec_capture@many-(?!4K-).*
-igt@gem_exec_fair@(?!.*basic).*
-igt@gem_exec_fence@.*hang.*
-igt@gem_exec_flush@(?!.*basic).*
-igt@gem_exec_latency(@.*)?
-igt@gem_exec_lut_handle(@.*)?
-igt@gem_exec_nop@(?!.*basic).*
-igt@gem_exec_reloc@(?!.*basic).*
-igt@gem_exec_suspend@(?!.*basic).*
-igt@gem_exec_whisper@(?!basic).*
-igt@gem_fd_exhaustion(@.*)?
-igt@gem_fence_upload(@.*)?
-igt@gem_gtt_hog(@.*)?
-igt@gem_gtt_speed(@.*)?
-igt@gem_lut_handle(@.*)?
-igt@gem_mmap_gtt@.*(huge|swap|clflush|forked).*
-igt@gem_mmap@.*(swap|huge).*
-igt@gem_pread_after_blit(@.*)?
-igt@gem_pwrite@(?!.*basic).*
-igt@gem_read_read_speed(@.*)?
-igt@gem_render_linear_blits@(?!.*basic).*
-igt@gem_render_tiled_blits@(?!.*basic).*
-igt@gem_reset_stats(@.*)?
-igt@gem_ringfill@(?!.*basic).*
-igt@gem_shrink@(?!reclaim$).*
-igt@gem_softpin@.*(hang|S4).*
-igt@gem_streaming_writes(@.*)?
-igt@gem_sync@(?!.*basic).*
-igt@gem_tiled_swapping@(?!non-threaded).*
-igt@gem_userptr_blits@(major|minor|forked|mlocked|swapping).*
-igt@gem_wait@hang.*
-igt@gem_watchdog@far-fence
-igt@sysfs_heartbeat_interval@(long|off)
-igt@sysfs_preempt_timeout@off
-igt@sysfs_timeslice_duration@off
-###############################################
-# GEM: Not worth fixing
-###############################################
-igt@gen7_exec_parse@.*lri.*
-igt@gem_exec_alignment@pi-shared
-###############################################
-# There are no DRRS capable displays in CI lab
-###############################################
-igt@kms_frontbuffer_tracking@.*drrs.*
-###############################################
-# Tends to generate invalid configurations
-# using CCS planes or configurations that
-# exceed HW capabilities resulting in sporadic
-# failure with -EINVAL.
-#
-# Maintaining extra constraints for Intel's HW
-# is too costly in comparison to the value
-# provided.
-###############################################
-igt@kms_chamelium_frames@hdmi-.*-planes-random
-###############################################
-# Broadcom
-###############################################
-igt@vc4_.*
-igt@v3d_.*
-###############################################
-# AMD
-###############################################
-igt@amdgpu/.*
-###############################################
-# Panfrost
-###############################################
-igt@panfrost_.*
-###############################################
-# Qualcomm
-###############################################
-igt@msm_.*
-###############################################
-# Hibernate: not configured correctly on CI
-###############################################
-igt@.*@.*-hibernate
-igt@gem_softpin@noreloc-s4
-igt@gem_workarounds@hibernate-.*
-igt@gem_exec_suspend@basic-s4$
-igt@gem_ctx_isolation@.*-s4
-###############################################
-# Out-of-memory: spammy and often broken
-###############################################
-igt@i915_suspend@shrink
-###############################################
-# pipe-e, pipe-f no current HW support
-###############################################
-igt@.*@.*pipe-e($|-.*)
-igt@.*@.*pipe-f($|-.*)
-
-###############################################
-# Temporary workarounds for CI-impacting bugs
-###############################################
-
-# Currently fails and leaves the machine in a very bad state, and
-# causes coverage loss for other tests. IOMMU related.
-# https://gitlab.freedesktop.org/drm/intel/-/issues/2644
-igt@core_hotunplug@.*(hot|plug).*
-
-# hangs several gens of hosts, and has no immediate fix
-igt@device_reset@reset-bound
-
-# not working for i915
-igt@kms_bw@.*
diff --git a/tests/intel-ci/blacklist.txt b/tests/intel-ci/blacklist.txt
new file mode 120000
index 000000000000..e48e29e27f4e
--- /dev/null
+++ b/tests/intel-ci/blacklist.txt
@@ -0,0 +1 @@
+i915-blacklist.txt
\ No newline at end of file
diff --git a/tests/intel-ci/i915-blacklist.txt b/tests/intel-ci/i915-blacklist.txt
new file mode 100644
index 000000000000..389a2acb7f44
--- /dev/null
+++ b/tests/intel-ci/i915-blacklist.txt
@@ -0,0 +1,133 @@
+igt@meta_test(@.*)?
+###############################################
+# Handle module reloads with great care!
+#
+# Reloading a module is more likely to leave
+# the machine in an unexpected state than other
+# self-contained tests, leading to random
+# failures in tests run afterwards.
+###############################################
+#igt@i915_module_load(@.*)? # danger, danger; hope for taints!
+igt@i915_pm_rpm@module-reload
+igt@i915_pm_rpm@gem-execbuf-stress-extra-wait
+###############################################
+# GEM
+###############################################
+igt@gem_busy@hang.*
+igt@gem_close_race@(?!.*basic).*
+igt@gem_concurrent_blit(@.*)?
+igt@gem_ctx_create@(?!.*basic).*
+igt@gem_ctx_exec@(?!.*basic).*
+igt@gem_ctx_shared@*exhaust*
+igt@gem_ctx_switch(@.*)?
+igt@gem_evict_alignment(@.*)?
+igt@gem_evict_everything(@.*)?
+igt@gem_exec_big@(?!.*single).*
+igt@gem_exec_capture@many-(?!4K-).*
+igt@gem_exec_fair@(?!.*basic).*
+igt@gem_exec_fence@.*hang.*
+igt@gem_exec_flush@(?!.*basic).*
+igt@gem_exec_latency(@.*)?
+igt@gem_exec_lut_handle(@.*)?
+igt@gem_exec_nop@(?!.*basic).*
+igt@gem_exec_reloc@(?!.*basic).*
+igt@gem_exec_suspend@(?!.*basic).*
+igt@gem_exec_whisper@(?!basic).*
+igt@gem_fd_exhaustion(@.*)?
+igt@gem_fence_upload(@.*)?
+igt@gem_gtt_hog(@.*)?
+igt@gem_gtt_speed(@.*)?
+igt@gem_lut_handle(@.*)?
+igt@gem_mmap_gtt@.*(huge|swap|clflush|forked).*
+igt@gem_mmap@.*(swap|huge).*
+igt@gem_pread_after_blit(@.*)?
+igt@gem_pwrite@(?!.*basic).*
+igt@gem_read_read_speed(@.*)?
+igt@gem_render_linear_blits@(?!.*basic).*
+igt@gem_render_tiled_blits@(?!.*basic).*
+igt@gem_reset_stats(@.*)?
+igt@gem_ringfill@(?!.*basic).*
+igt@gem_shrink@(?!reclaim$).*
+igt@gem_softpin@.*(hang|S4).*
+igt@gem_streaming_writes(@.*)?
+igt@gem_sync@(?!.*basic).*
+igt@gem_tiled_swapping@(?!non-threaded).*
+igt@gem_userptr_blits@(major|minor|forked|mlocked|swapping).*
+igt@gem_wait@hang.*
+igt@gem_watchdog@far-fence
+igt@sysfs_heartbeat_interval@(long|off)
+igt@sysfs_preempt_timeout@off
+igt@sysfs_timeslice_duration@off
+###############################################
+# GEM: Not worth fixing
+###############################################
+igt@gen7_exec_parse@.*lri.*
+igt@gem_exec_alignment@pi-shared
+###############################################
+# There are no DRRS capable displays in CI lab
+###############################################
+igt@kms_frontbuffer_tracking@.*drrs.*
+###############################################
+# Tends to generate invalid configurations
+# using CCS planes or configurations that
+# exceed HW capabilities resulting in sporadic
+# failure with -EINVAL.
+#
+# Maintaining extra constraints for Intel's HW
+# is too costly in comparison to the value
+# provided.
+###############################################
+igt@kms_chamelium_frames@hdmi-.*-planes-random
+###############################################
+# Broadcom
+###############################################
+igt@vc4_.*
+igt@v3d_.*
+###############################################
+# Intel Xe
+###############################################
+igt@xe/.*
+###############################################
+# AMD
+###############################################
+igt@amdgpu/.*
+###############################################
+# Panfrost
+###############################################
+igt@panfrost_.*
+###############################################
+# Qualcomm
+###############################################
+igt@msm_.*
+###############################################
+# Hibernate: not configured correctly on CI
+###############################################
+igt@.*@.*-hibernate
+igt@gem_softpin@noreloc-s4
+igt@gem_workarounds@hibernate-.*
+igt@gem_exec_suspend@basic-s4$
+igt@gem_ctx_isolation@.*-s4
+###############################################
+# Out-of-memory: spammy and often broken
+###############################################
+igt@i915_suspend@shrink
+###############################################
+# pipe-e, pipe-f no current HW support
+###############################################
+igt@.*@.*pipe-e($|-.*)
+igt@.*@.*pipe-f($|-.*)
+
+###############################################
+# Temporary workarounds for CI-impacting bugs
+###############################################
+
+# Currently fails and leaves the machine in a very bad state, and
+# causes coverage loss for other tests. IOMMU related.
+# https://gitlab.freedesktop.org/drm/intel/-/issues/2644
+igt@core_hotunplug@.*(hot|plug).*
+
+# hangs several gens of hosts, and has no immediate fix
+igt@device_reset@reset-bound
+
+# not working for i915
+igt@kms_bw@.*
diff --git a/tests/intel-ci/xe-blacklist.txt b/tests/intel-ci/xe-blacklist.txt
new file mode 100644
index 000000000000..986e91a67069
--- /dev/null
+++ b/tests/intel-ci/xe-blacklist.txt
@@ -0,0 +1,21 @@
+###############################################
+# Broadcom
+###############################################
+igt@vc4_.*
+igt@v3d_.*
+###############################################
+# Intel i915
+###############################################
+igt@i915/.*
+###############################################
+# AMD
+###############################################
+igt@amdgpu/.*
+###############################################
+# Panfrost
+###############################################
+igt@panfrost_.*
+###############################################
+# Qualcomm
+###############################################
+igt@msm_.*
-- 
2.39.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [igt-dev] [PATCH i-g-t v2 2/3] lib/igt_kmod: add support for Xe driver
  2023-03-22 12:32 [igt-dev] [PATCH i-g-t v2 0/3] xe/xe_module_load: add a test to load/unload Xe driver Mauro Carvalho Chehab
  2023-03-22 12:32 ` [igt-dev] [PATCH i-g-t v2 1/3] intel-ci: update blacklists to work with the " Mauro Carvalho Chehab
@ 2023-03-22 12:33 ` Mauro Carvalho Chehab
  2023-03-22 12:33 ` [igt-dev] [PATCH i-g-t v2 3/3] xe/xe_module_load: add a test to load/unload " Mauro Carvalho Chehab
  2023-03-22 13:18 ` [igt-dev] ✗ Fi.CI.BUILD: failure for " Patchwork
  3 siblings, 0 replies; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2023-03-22 12:33 UTC (permalink / raw)
  To: igt-dev

From: Mauro Carvalho Chehab <mchehab@kernel.org>

Change the kmod logic to also work with the Xe driver.

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
 lib/igt_kmod.c | 34 +++++++++++++++++-----------------
 lib/igt_kmod.h | 32 +++++++++++++++++++++++++++++---
 2 files changed, 46 insertions(+), 20 deletions(-)

diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
index 6d6ecf0187ed..ccf0063ca1b1 100644
--- a/lib/igt_kmod.c
+++ b/lib/igt_kmod.c
@@ -404,23 +404,23 @@ static void *strdup_realloc(char *origptr, const char *strdata)
 }
 
 /**
- * igt_i915_driver_load:
- * @opts: options to pass to i915 driver
+ * igt_intel_driver_load:
+ * @opts: options to pass to Intel driver
  *
- * Loads the i915 driver and its dependencies.
+ * Loads an Intel driver and its dependencies.
  *
  */
 int
-igt_i915_driver_load(const char *opts)
+igt_intel_driver_load(const char *opts, const char *driver)
 {
 	int ret;
 
 	if (opts)
-		igt_info("Reloading i915 with %s\n\n", opts);
+		igt_info("Reloading %s with %s\n\n", driver, opts);
 
-	ret = igt_kmod_load("i915", opts);
+	ret = igt_kmod_load(driver, opts);
 	if (ret) {
-		igt_debug("Could not load i915\n");
+		igt_debug("Could not load %s\n", driver);
 		return ret;
 	}
 
@@ -496,7 +496,7 @@ int igt_audio_driver_unload(char **who)
 	return igt_always_unload_audio_driver(who);
 }
 
-int __igt_i915_driver_unload(char **who)
+int __igt_intel_driver_unload(char **who, const char *driver)
 {
 	int ret;
 
@@ -530,11 +530,11 @@ int __igt_i915_driver_unload(char **who)
 		}
 	}
 
-	if (igt_kmod_is_loaded("i915")) {
-		ret = igt_kmod_unload("i915", 0);
+	if (igt_kmod_is_loaded(driver)) {
+		ret = igt_kmod_unload(driver, 0);
 		if (ret) {
 			if (who)
-				*who = strdup_realloc(*who, "i915");
+				*who = strdup_realloc(*who, driver);
 
 			return ret;
 		}
@@ -544,18 +544,18 @@ int __igt_i915_driver_unload(char **who)
 }
 
 /**
- * igt_i915_driver_unload:
+ * igt_intel_driver_unload:
  *
- * Unloads the i915 driver and its dependencies.
+ * Unloads an Intel driver and its dependencies.
  *
  */
 int
-igt_i915_driver_unload(void)
+igt_intel_driver_unload(const char *driver)
 {
 	char *who = NULL;
 	int ret;
 
-	ret = __igt_i915_driver_unload(&who);
+	ret = __igt_intel_driver_unload(&who, driver);
 	if (ret) {
 		igt_warn("Could not unload %s\n", who);
 		igt_kmod_list_loaded();
@@ -572,8 +572,8 @@ igt_i915_driver_unload(void)
 	igt_kmod_unload("drm_kms_helper", 0);
 	igt_kmod_unload("drm", 0);
 
-	if (igt_kmod_is_loaded("i915")) {
-		igt_warn("i915.ko still loaded!\n");
+	if (igt_kmod_is_loaded("driver")) {
+		igt_warn("%s.ko still loaded!\n", driver);
 		return -EBUSY;
 	}
 
diff --git a/lib/igt_kmod.h b/lib/igt_kmod.h
index f98dd29fb175..d05af4a69410 100644
--- a/lib/igt_kmod.h
+++ b/lib/igt_kmod.h
@@ -38,9 +38,35 @@ int igt_kmod_unload(const char *mod_name, unsigned int flags);
 
 int igt_audio_driver_unload(char **whom);
 
-int igt_i915_driver_load(const char *opts);
-int igt_i915_driver_unload(void);
-int __igt_i915_driver_unload(char **whom);
+int igt_intel_driver_load(const char *opts, const char *driver);
+int igt_intel_driver_unload(const char *driver);
+int __igt_intel_driver_unload(char **who, const char *driver);
+
+static inline int igt_i915_driver_load(const char *opts)
+{
+	return igt_intel_driver_load(opts, "i915");
+}
+
+static inline int igt_i915_driver_unload(void)
+{
+	return igt_intel_driver_unload("i915");
+}
+
+static inline int __igt_i915_driver_unload(char **whom)
+{
+	return __igt_intel_driver_unload(whom, "i915");
+};
+
+static inline int igt_xe_driver_load(const char *opts)
+{
+	return igt_intel_driver_load(opts, "xe");
+}
+
+
+static inline int igt_xe_driver_unload(void)
+{
+	return igt_intel_driver_unload("xe");
+}
 
 int igt_amdgpu_driver_load(const char *opts);
 int igt_amdgpu_driver_unload(void);
-- 
2.39.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [igt-dev] [PATCH i-g-t v2 3/3] xe/xe_module_load: add a test to load/unload Xe driver
  2023-03-22 12:32 [igt-dev] [PATCH i-g-t v2 0/3] xe/xe_module_load: add a test to load/unload Xe driver Mauro Carvalho Chehab
  2023-03-22 12:32 ` [igt-dev] [PATCH i-g-t v2 1/3] intel-ci: update blacklists to work with the " Mauro Carvalho Chehab
  2023-03-22 12:33 ` [igt-dev] [PATCH i-g-t v2 2/3] lib/igt_kmod: add support for " Mauro Carvalho Chehab
@ 2023-03-22 12:33 ` Mauro Carvalho Chehab
  2023-03-22 13:18 ` [igt-dev] ✗ Fi.CI.BUILD: failure for " Patchwork
  3 siblings, 0 replies; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2023-03-22 12:33 UTC (permalink / raw)
  To: igt-dev

From: Mauro Carvalho Chehab <mchehab@kernel.org>

This is helpful to allow IGT to check if there are issues
during module load/unload.

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
 tests/intel-ci/xe-fast-feedback.testlist |   3 +
 tests/meson.build                        |   1 +
 tests/xe/xe_module_load.c                | 158 +++++++++++++++++++++++
 3 files changed, 162 insertions(+)
 create mode 100644 tests/xe/xe_module_load.c

diff --git a/tests/intel-ci/xe-fast-feedback.testlist b/tests/intel-ci/xe-fast-feedback.testlist
index 6525b1676b6f..3140d648833a 100644
--- a/tests/intel-ci/xe-fast-feedback.testlist
+++ b/tests/intel-ci/xe-fast-feedback.testlist
@@ -1,3 +1,6 @@
+# Should be the first test
+igt@xe_module_load@force-load
+
 igt@xe_compute@compute-square
 igt@xe_debugfs@base
 igt@xe_debugfs@gt
diff --git a/tests/meson.build b/tests/meson.build
index 632e36e059d8..f9fef103a736 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -256,6 +256,7 @@ xe_progs = [
 	'xe_huc_copy',
 	'xe_mmap',
 	'xe_mmio',
+	'xe_module_load',
 	'xe_pm',
 	'xe_prime_self_import',
 	'xe_query',
diff --git a/tests/xe/xe_module_load.c b/tests/xe/xe_module_load.c
new file mode 100644
index 000000000000..9a38d70858d1
--- /dev/null
+++ b/tests/xe/xe_module_load.c
@@ -0,0 +1,158 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+/**
+ * TEST: Tests the xe module loading
+ * Category: Sofware building block
+ * Sub-category: driver
+ * Test category: functionality test
+ */
+
+#include <dirent.h>
+#include <fcntl.h>
+#include <libgen.h>
+#include <signal.h>
+
+#ifdef __linux__
+#include <linux/limits.h>
+#endif
+
+#include <sys/ioctl.h>
+#include <sys/utsname.h>
+
+#include "igt.h"
+
+#include "igt_aux.h"
+#include "igt_core.h"
+#include "igt_debugfs.h"
+#include "igt_kmod.h"
+#include "igt_sysfs.h"
+
+#define BAR_SIZE_SHIFT 20
+#define MIN_BAR_SIZE 256
+
+static void hda_dynamic_debug(bool enable)
+{
+	FILE *fp;
+	static const char snd_hda_intel_on[] = "module snd_hda_intel +pf";
+	static const char snd_hda_core_on[] = "module snd_hda_core +pf";
+
+	static const char snd_hda_intel_off[] = "module snd_hda_core =_";
+	static const char snd_hda_core_off[] = "module snd_hda_intel =_";
+
+	fp = fopen("/sys/kernel/debug/dynamic_debug/control", "w");
+	if (!fp) {
+		igt_debug("hda dynamic debug not available\n");
+		return;
+	}
+
+	if (enable) {
+		fwrite(snd_hda_intel_on, 1, sizeof(snd_hda_intel_on), fp);
+		fwrite(snd_hda_core_on, 1, sizeof(snd_hda_core_on), fp);
+	} else {
+		fwrite(snd_hda_intel_off, 1, sizeof(snd_hda_intel_off), fp);
+		fwrite(snd_hda_core_off, 1, sizeof(snd_hda_core_off), fp);
+	}
+
+	fclose(fp);
+}
+
+static void load_and_check_xe(const char *opts)
+{
+	int error;
+	int drm_fd;
+
+	hda_dynamic_debug(true);
+	error = igt_xe_driver_load(opts);
+	hda_dynamic_debug(false);
+
+	igt_assert_eq(error, 0);
+
+	/* driver is ready, check if it's bound */
+	drm_fd = __drm_open_driver(DRIVER_XE);
+	igt_fail_on_f(drm_fd < 0, "Cannot open the xe DRM driver after modprobing xe.\n");
+}
+
+static const char * const unwanted_drivers[] = {
+	"xe",
+	"i915",
+	NULL
+};
+
+/**
+ * SUBTEST: force-load
+ * Description: Load the Xe driver passing ``force_probe=*`` parameter
+ * Run type: BAT
+ *
+ * SUBTEST: load
+ * Description: Load the Xe driver
+ * Run type: FULL
+ *
+ * SUBTEST: unload
+ * Description: Unload the Xe driver
+ * Run type: FULL
+ *
+ * SUBTEST: reload
+ * Description: Reload the Xe driver
+ * Run type: FULL
+ *
+ * SUBTEST: reload-no-display
+ * Description: Reload the Xe driver passing ``enable_display=0`` parameter
+ * Run type: FULL
+ *
+ * SUBTEST: many-reload
+ * Description: Reload the Xe driver many times
+ * Run type: FULL
+ */
+igt_main
+{
+	igt_describe("Check if xe and friends are not yet loaded, then load them.");
+	igt_subtest("load") {
+		for (int i = 0; unwanted_drivers[i] != NULL; i++) {
+			igt_skip_on_f(igt_kmod_is_loaded(unwanted_drivers[i]),
+				      "%s is already loaded\n", unwanted_drivers[i]);
+		}
+
+		load_and_check_xe(NULL);
+	}
+
+	igt_subtest("unload") {
+		igt_xe_driver_unload();
+	}
+
+	igt_subtest("force-load") {
+		for (int i = 0; unwanted_drivers[i] != NULL; i++) {
+			igt_skip_on_f(igt_kmod_is_loaded(unwanted_drivers[i]),
+				      "%s is already loaded\n", unwanted_drivers[i]);
+		}
+
+		load_and_check_xe("force_probe=*");
+	}
+
+	igt_subtest("reload-no-display") {
+		igt_xe_driver_unload();
+		load_and_check_xe("enable_display=0");
+	}
+
+	igt_subtest("many-reload") {
+		int i;
+
+		for (i = 0; i < 10; i++) {
+			igt_debug("reload cycle: %d\n", i);
+			igt_xe_driver_unload();
+			load_and_check_xe(NULL);
+			sleep(1);
+		}
+	}
+
+	igt_subtest("reload") {
+		igt_xe_driver_unload();
+		load_and_check_xe(NULL);
+
+		/* only default modparams, can leave module loaded */
+	}
+
+	/* Subtests should unload the module themselves if they use modparams */
+}
-- 
2.39.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [igt-dev] ✗ Fi.CI.BUILD: failure for xe/xe_module_load: add a test to load/unload Xe driver
  2023-03-22 12:32 [igt-dev] [PATCH i-g-t v2 0/3] xe/xe_module_load: add a test to load/unload Xe driver Mauro Carvalho Chehab
                   ` (2 preceding siblings ...)
  2023-03-22 12:33 ` [igt-dev] [PATCH i-g-t v2 3/3] xe/xe_module_load: add a test to load/unload " Mauro Carvalho Chehab
@ 2023-03-22 13:18 ` Patchwork
  3 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2023-03-22 13:18 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: igt-dev

== Series Details ==

Series: xe/xe_module_load: add a test to load/unload Xe driver
URL   : https://patchwork.freedesktop.org/series/115511/
State : failure

== Summary ==

Applying: intel-ci: update blacklists to work with the Xe driver
Applying: lib/igt_kmod: add support for Xe driver
Applying: xe/xe_module_load: add a test to load/unload Xe driver
Using index info to reconstruct a base tree...
M	tests/meson.build
Falling back to patching base and 3-way merge...
Auto-merging tests/meson.build
CONFLICT (content): Merge conflict in tests/meson.build
Patch failed at 0003 xe/xe_module_load: add a test to load/unload Xe driver
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-22 13:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22 12:32 [igt-dev] [PATCH i-g-t v2 0/3] xe/xe_module_load: add a test to load/unload Xe driver Mauro Carvalho Chehab
2023-03-22 12:32 ` [igt-dev] [PATCH i-g-t v2 1/3] intel-ci: update blacklists to work with the " Mauro Carvalho Chehab
2023-03-22 12:33 ` [igt-dev] [PATCH i-g-t v2 2/3] lib/igt_kmod: add support for " Mauro Carvalho Chehab
2023-03-22 12:33 ` [igt-dev] [PATCH i-g-t v2 3/3] xe/xe_module_load: add a test to load/unload " Mauro Carvalho Chehab
2023-03-22 13:18 ` [igt-dev] ✗ Fi.CI.BUILD: failure for " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.