[v2,2/6] drm/i915/guc: Bypass fw loading gracefully if GuC is not supported

Submitted by yu.dai@intel.com on Feb. 8, 2016, 11:02 p.m.

Details

Message ID 1454972573-16290-3-git-send-email-yu.dai@intel.com
State New
Headers show
Series "Add HuC loading and authentication support" ( rev: 1 ) in Intel GFX

Not browsing as part of any series.

Commit Message

yu.dai@intel.com Feb. 8, 2016, 11:02 p.m.
From: Alex Dai <yu.dai@intel.com>

This is to rework previous patch:

commit 9f9e539f90bcecfdc7b3679d337b7a62d4313205
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Fri Oct 23 11:10:59 2015 +0200

    drm/i915: Shut up GuC errors when it's disabled

There is the case where GuC loading is needed even GuC submission
is disabled. For example, HuC loading and authentication require
GuC to be loaded regardless. In this patch, driver will try to load
the firmware only when it explicitly asks for that by specifying fw
name and version. All other cases are considered as UC_FIRMWARE_NONE
and the loading is bypassed silently.

Signed-off-by: Alex Dai <yu.dai@intel.com>
---
 drivers/gpu/drm/i915/intel_guc_loader.c | 32 +++++++++++---------------------
 1 file changed, 11 insertions(+), 21 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c b/drivers/gpu/drm/i915/intel_guc_loader.c
index 318b5fd..482a5e4 100644
--- a/drivers/gpu/drm/i915/intel_guc_loader.c
+++ b/drivers/gpu/drm/i915/intel_guc_loader.c
@@ -597,39 +597,29 @@  void intel_guc_ucode_init(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_uc_fw *guc_fw = &dev_priv->guc.guc_fw;
-	const char *fw_path;
+	const char *fw_path = NULL;
+
+	guc_fw->uc_dev = dev;
+	guc_fw->uc_fw_path = NULL;
+	guc_fw->fetch_status = UC_FIRMWARE_NONE;
+	guc_fw->load_status = UC_FIRMWARE_NONE;
 
 	if (!HAS_GUC_SCHED(dev))
 		i915.enable_guc_submission = false;
 
-	if (!HAS_GUC_UCODE(dev)) {
-		fw_path = NULL;
-	} else if (IS_SKYLAKE(dev)) {
+	if (!HAS_GUC_UCODE(dev))
+		return;
+
+	if (IS_SKYLAKE(dev)) {
 		fw_path = I915_SKL_GUC_UCODE;
 		guc_fw->major_ver_wanted = 4;
 		guc_fw->minor_ver_wanted = 3;
-	} else {
-		i915.enable_guc_submission = false;
-		fw_path = "";	/* unknown device */
 	}
 
-	if (!i915.enable_guc_submission)
-		return;
-
-	guc_fw->uc_dev = dev;
-	guc_fw->uc_fw_path = fw_path;
-	guc_fw->fetch_status = UC_FIRMWARE_NONE;
-	guc_fw->load_status = UC_FIRMWARE_NONE;
-
 	if (fw_path == NULL)
 		return;
 
-	if (*fw_path == '\0') {
-		DRM_ERROR("No GuC firmware known for this platform\n");
-		guc_fw->fetch_status = UC_FIRMWARE_FAIL;
-		return;
-	}
-
+	guc_fw->uc_fw_path = fw_path;
 	guc_fw->fetch_status = UC_FIRMWARE_PENDING;
 	DRM_DEBUG_DRIVER("GuC firmware pending, path %s\n", fw_path);
 	intel_uc_fw_fetch(dev, guc_fw);