diff mbox series

[4/4] drm/i915/uc: Don't fail on HuC early init errors

Message ID 20190804195052.31140-5-michal.wajdeczko@intel.com (mailing list archive)
State New, archived
Headers show
Series Don't fail on HuC early init errors | expand

Commit Message

Michal Wajdeczko Aug. 4, 2019, 7:50 p.m. UTC
Since commit 301efe96f777 ("drm/i915/uc: Don't fail on HuC
firmware failure") we can continue driver load after error
during HuC firmware load or authentication, but we could
still fail on any error during early HuC initialization.
Change that by ignoring HuC related errors until hardware
initialization phase where we can decide about next steps.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/gt/uc/intel_huc.c | 7 ++++++-
 drivers/gpu/drm/i915/gt/uc/intel_uc.c  | 8 ++++----
 2 files changed, 10 insertions(+), 5 deletions(-)

Comments

Chris Wilson Aug. 5, 2019, 5:24 p.m. UTC | #1
Quoting Michal Wajdeczko (2019-08-04 20:50:52)
> Since commit 301efe96f777 ("drm/i915/uc: Don't fail on HuC
> firmware failure") we can continue driver load after error
> during HuC firmware load or authentication, but we could
> still fail on any error during early HuC initialization.
> Change that by ignoring HuC related errors until hardware
> initialization phase where we can decide about next steps.
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>

So we just leave the HuC uninitialised and HUC_STATUS should then report
no authentication. (We do scrub that at some point just in case the
million resets did not?)

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
Michal Wajdeczko Aug. 5, 2019, 5:53 p.m. UTC | #2
On Mon, 05 Aug 2019 19:24:57 +0200, Chris Wilson  
<chris@chris-wilson.co.uk> wrote:

> So we just leave the HuC uninitialised and HUC_STATUS should then report
> no authentication. (We do scrub that at some point just in case the
> million resets did not?)

Bspec says that it's RO from the host and it will be 0 out of reset
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_huc.c b/drivers/gpu/drm/i915/gt/uc/intel_huc.c
index 66b2d5fdb317..faaf8ad5ba89 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_huc.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_huc.c
@@ -52,6 +52,11 @@  static int intel_huc_rsa_data_create(struct intel_huc *huc)
 	struct i915_vma *vma;
 	size_t copied;
 	void *vaddr;
+	int err;
+
+	err = i915_inject_load_error(gt->i915, -ENXIO);
+	if (err)
+		return err;
 
 	/*
 	 * HuC firmware will sit above GUC_GGTT_TOP and will not map
@@ -115,8 +120,8 @@  int intel_huc_init(struct intel_huc *huc)
 
 void intel_huc_fini(struct intel_huc *huc)
 {
-	intel_uc_fw_fini(&huc->fw);
 	intel_huc_rsa_data_destroy(huc);
+	intel_uc_fw_fini(&huc->fw);
 }
 
 /**
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc.c b/drivers/gpu/drm/i915/gt/uc/intel_uc.c
index 1ddd252419ec..e87b7904ab7a 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_uc.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_uc.c
@@ -316,14 +316,14 @@  int intel_uc_init(struct intel_uc *uc)
 	if (intel_uc_supports_huc(uc)) {
 		ret = intel_huc_init(huc);
 		if (ret)
-			goto err_guc;
+			goto out_huc;
 	}
 
 	return 0;
 
-err_guc:
-	intel_guc_fini(guc);
-	return ret;
+out_huc:
+	intel_uc_fw_cleanup_fetch(&huc->fw);
+	return 0;
 }
 
 void intel_uc_fini(struct intel_uc *uc)