[Intel-gfx] [PATCH] drm/i915: Allow the user to override default firmware file names

Chris Wilson chris at chris-wilson.co.uk
Mon Feb 6 13:05:29 UTC 2017


Make the actual path we attempt to load for each of (DMC, GuC, HuC)
overidable by the user. This helps testing new firmware releases.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_params.c      | 12 ++++++++++++
 drivers/gpu/drm/i915/i915_params.h      |  3 +++
 drivers/gpu/drm/i915/intel_csr.c        |  9 ++++++++-
 drivers/gpu/drm/i915/intel_guc_loader.c |  4 ++++
 drivers/gpu/drm/i915/intel_huc.c        |  8 ++++++++
 5 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
index f1fa51190dc6..d7001c0effa5 100644
--- a/drivers/gpu/drm/i915/i915_params.c
+++ b/drivers/gpu/drm/i915/i915_params.c
@@ -243,3 +243,15 @@ MODULE_PARM_DESC(enable_dpcd_backlight,
 module_param_named(enable_gvt, i915.enable_gvt, bool, 0400);
 MODULE_PARM_DESC(enable_gvt,
 	"Enable support for Intel GVT-g graphics virtualization host support(default:false)");
+
+module_param_named(dmc_firmware, i915.dmc_firmware_path, charp, 0400);
+MODULE_PARM_DESC(dmc_firmare,
+	"Provide an alternate name for the DMC firmware file");
+
+module_param_named(guc_firmware, i915.guc_firmware_path, charp, 0400);
+MODULE_PARM_DESC(guc_firmare,
+	"Provide an alternate name for the GuC firmware file");
+
+module_param_named(huc_firmware, i915.huc_firmware_path, charp, 0400);
+MODULE_PARM_DESC(huc_firmare,
+	"Provide an alternate name for the HuC firmware file");
diff --git a/drivers/gpu/drm/i915/i915_params.h b/drivers/gpu/drm/i915/i915_params.h
index 55d47eea172e..d35d6ff600c1 100644
--- a/drivers/gpu/drm/i915/i915_params.h
+++ b/drivers/gpu/drm/i915/i915_params.h
@@ -28,6 +28,9 @@
 #include <linux/cache.h> /* for __read_mostly */
 
 #define I915_PARAMS_FOR_EACH(func) \
+	func(char *, dmc_firmware_path); \
+	func(char *, guc_firmware_path); \
+	func(char *, huc_firmware_path); \
 	func(int, modeset); \
 	func(int, panel_ignore_lid); \
 	func(int, semaphores); \
diff --git a/drivers/gpu/drm/i915/intel_csr.c b/drivers/gpu/drm/i915/intel_csr.c
index 9dcc434d3b74..49932f85a786 100644
--- a/drivers/gpu/drm/i915/intel_csr.c
+++ b/drivers/gpu/drm/i915/intel_csr.c
@@ -447,7 +447,14 @@ void intel_csr_ucode_init(struct drm_i915_private *dev_priv)
 		csr->fw_path = I915_CSR_SKL;
 	else if (IS_BROXTON(dev_priv))
 		csr->fw_path = I915_CSR_BXT;
-	else {
+	else
+		csr->fw_path = "";
+
+	/* Allow the user to override the default path via a module parameter */
+	if (csr->fw_path && i915.dmc_firmware_path)
+		csr->fw_path = i915.dmc_firmware_path;
+
+	if (!*csr->fw_path) {
 		DRM_ERROR("Unexpected: no known CSR firmware for platform\n");
 		return;
 	}
diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c b/drivers/gpu/drm/i915/intel_guc_loader.c
index 70637902c30d..e21b5c21d463 100644
--- a/drivers/gpu/drm/i915/intel_guc_loader.c
+++ b/drivers/gpu/drm/i915/intel_guc_loader.c
@@ -764,6 +764,10 @@ void intel_guc_init(struct drm_i915_private *dev_priv)
 		fw_path = "";	/* unknown device */
 	}
 
+	/* Allow the user to override the default path via a module parameter */
+	if (fw_path && i915.guc_firmware_path)
+		fw_path = i915.guc_firmware_path;
+
 	guc_fw->path = fw_path;
 	guc_fw->fetch_status = INTEL_UC_FIRMWARE_NONE;
 	guc_fw->load_status = INTEL_UC_FIRMWARE_NONE;
diff --git a/drivers/gpu/drm/i915/intel_huc.c b/drivers/gpu/drm/i915/intel_huc.c
index c28543d220a2..a1d748085ded 100644
--- a/drivers/gpu/drm/i915/intel_huc.c
+++ b/drivers/gpu/drm/i915/intel_huc.c
@@ -178,8 +178,16 @@ void intel_huc_init(struct drm_i915_private *dev_priv)
 		fw_path = I915_KBL_HUC_UCODE;
 		huc_fw->major_ver_wanted = KBL_HUC_FW_MAJOR;
 		huc_fw->minor_ver_wanted = KBL_HUC_FW_MINOR;
+	} else {
+		fw_path = "";
 	}
 
+	/* Allow the user to override the default path via a module parameter */
+	if (fw_path && i915.huc_firmware_path)
+		fw_path = i915.huc_firmware_path;
+	if (!*fw_path)
+		return;
+
 	huc_fw->path = fw_path;
 	huc_fw->fetch_status = INTEL_UC_FIRMWARE_PENDING;
 
-- 
2.11.0



More information about the Intel-gfx mailing list