Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] lib/igt_kmod: Unload/Reload the mei Modules Before Unloading/Reloading the i915/xe Driver
@ 2024-08-15 13:04 Bommu Krishnaiah
  2024-08-15 13:46 ` ✓ CI.xeBAT: success for " Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Bommu Krishnaiah @ 2024-08-15 13:04 UTC (permalink / raw)
  To: igt-dev; +Cc: Bommu Krishnaiah, Kamil Konieczny, Daniele Ceraolo Spurio

To ensure stability and proper module management, this update introduces
changes to the handling of MEI modules when loading or unloading
the Intel i915 or Xe drivers.

Key Changes:
- Unload Order: The `mei_gsc_proxy` module is now unloaded before `mei_gsc`,
preventing potential failures during the unloading process.
- Platform-Specific Handling: On platforms where the MEI hardware is integrated
with the graphics device (e.g., DG2/BMG), the MEI modules depend on the i915/Xe driver.
Conversely, on newer platforms like CLS, where MEI hardware is separate,
this dependency does not exist. This update ensures that MEI modules are
unloaded/reloaded in the correct order based on platform-specific dependencies.

These changes address the need for a more robust handling of MEI modules across
different hardware platforms, ensuring that the i915/Xe driver can be
cleanly unloaded and reloaded without issues.

Signed-off-by: Bommu Krishnaiah <krishnaiah.bommu@intel.com>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
---
 lib/igt_kmod.c | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
index 464c0dcf4..6ee2b7afe 100644
--- a/lib/igt_kmod.c
+++ b/lib/igt_kmod.c
@@ -480,9 +480,29 @@ igt_intel_driver_load(const char *opts, const char *driver)
 {
 	int ret;
 
+	const char *mei[] = {
+		/* mei_gsc uses an i915 aux dev and the other mei mods depend on it */
+		"mei_pxp",
+		"mei_hdcp",
+		"mei_gsc_proxy",
+		"mei_gsc",
+		NULL,
+	};
+
 	if (opts)
 		igt_info("Reloading %s with %s\n\n", driver, opts);
 
+	for (const char **m = mei; *m; m++) {
+		if (igt_kmod_is_loaded(*m))
+			continue;
+
+		ret = igt_kmod_load(*m, NULL);
+		if (ret) {
+			igt_debug("Could not load %s\n", *m);
+			return ret;
+		}
+	}
+
 	ret = igt_kmod_load(driver, opts);
 	if (ret) {
 		igt_debug("Could not load %s\n", driver);
@@ -620,9 +640,14 @@ int __igt_intel_driver_unload(char **who, const char *driver)
 	const char *aux[] = {
 		/* gen5: ips uses symbol_get() so only a soft module dependency */
 		"intel_ips",
+		NULL,
+	};
+
+	const char *mei[] = {
 		/* mei_gsc uses an i915 aux dev and the other mei mods depend on it */
 		"mei_pxp",
 		"mei_hdcp",
+		"mei_gsc_proxy",
 		"mei_gsc",
 		NULL,
 	};
@@ -647,6 +672,19 @@ int __igt_intel_driver_unload(char **who, const char *driver)
 		}
 	}
 
+	for (const char **m = mei; *m; m++) {
+		if (!igt_kmod_is_loaded(*m))
+			continue;
+
+		ret = igt_kmod_unload(*m);
+		if (ret) {
+			if (who)
+				*who = strdup_realloc(*who, *m);
+
+			return ret;
+		}
+	}
+
 	if (igt_kmod_is_loaded(driver)) {
 		ret = igt_kmod_unload(driver);
 		if (ret) {
-- 
2.25.1


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

end of thread, other threads:[~2024-08-20  5:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-15 13:04 [PATCH i-g-t] lib/igt_kmod: Unload/Reload the mei Modules Before Unloading/Reloading the i915/xe Driver Bommu Krishnaiah
2024-08-15 13:46 ` ✓ CI.xeBAT: success for " Patchwork
2024-08-15 13:59 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-08-15 14:52 ` ✗ CI.xeFULL: " Patchwork
2024-08-15 15:20 ` [PATCH i-g-t] " Lucas De Marchi
2024-08-15 16:57   ` Daniele Ceraolo Spurio
2024-08-15 17:25     ` Lucas De Marchi
2024-08-20  5:37       ` Bommu, Krishnaiah

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox