diff mbox

drm/i915/huc: Simplify intel_huc_init_hw()

Message ID 20170331115709.181940-1-michal.wajdeczko@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michal Wajdeczko March 31, 2017, 11:57 a.m. UTC
On last guc/huc cleanup series we've simplified guc init hw
function but missed the one for the huc. While here, change
its signature as we don't care about huc loading status.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/intel_huc.c | 48 +++++++---------------------------------
 drivers/gpu/drm/i915/intel_uc.h  |  2 +-
 2 files changed, 9 insertions(+), 41 deletions(-)

Comments

Srivatsa, Anusha April 3, 2017, 6:51 p.m. UTC | #1
I like the changes, definitely simplifies things.

>-----Original Message-----
>From: Wajdeczko, Michal
>Sent: Friday, March 31, 2017 4:57 AM
>To: intel-gfx@lists.freedesktop.org
>Cc: Wajdeczko, Michal <Michal.Wajdeczko@intel.com>; Srivatsa, Anusha
><anusha.srivatsa@intel.com>; Hiler, Arkadiusz <arkadiusz.hiler@intel.com>;
>Ursulin, Tvrtko <tvrtko.ursulin@intel.com>
>Subject: [PATCH] drm/i915/huc: Simplify intel_huc_init_hw()
>
>On last guc/huc cleanup series we've simplified guc init hw function but missed
>the one for the huc. While here, change its signature as we don't care about huc
>loading status.
>
>Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
>Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
>Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
>Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Reviewed-by: Anusha Srivatsa <anusha.srivatsa@intel.com>

> drivers/gpu/drm/i915/intel_huc.c | 48 +++++++---------------------------------
> drivers/gpu/drm/i915/intel_uc.h  |  2 +-
> 2 files changed, 9 insertions(+), 41 deletions(-)
>
>diff --git a/drivers/gpu/drm/i915/intel_huc.c b/drivers/gpu/drm/i915/intel_huc.c
>index 9ee8196..385cacb 100644
>--- a/drivers/gpu/drm/i915/intel_huc.c
>+++ b/drivers/gpu/drm/i915/intel_huc.c
>@@ -186,68 +186,36 @@ void intel_huc_select_fw(struct intel_huc *huc)
>  * earlier call to intel_huc_init(), so here we need only check that
>  * is succeeded, and then transfer the image to the h/w.
>  *
>- * Return:	non-zero code on error
>  */
>-int intel_huc_init_hw(struct intel_huc *huc)
>+void intel_huc_init_hw(struct intel_huc *huc)
> {
> 	struct drm_i915_private *dev_priv = huc_to_i915(huc);
> 	int err;
>
>-	if (huc->fw.fetch_status == INTEL_UC_FIRMWARE_NONE)
>-		return 0;
>-
> 	DRM_DEBUG_DRIVER("%s fw status: fetch %s, load %s\n",
> 		huc->fw.path,
> 		intel_uc_fw_status_repr(huc->fw.fetch_status),
> 		intel_uc_fw_status_repr(huc->fw.load_status));
>
>-	if (huc->fw.fetch_status == INTEL_UC_FIRMWARE_SUCCESS &&
>-	    huc->fw.load_status == INTEL_UC_FIRMWARE_FAIL)
>-		return -ENOEXEC;
>+	if (huc->fw.fetch_status != INTEL_UC_FIRMWARE_SUCCESS)
>+		return;
>
> 	huc->fw.load_status = INTEL_UC_FIRMWARE_PENDING;
>
>-	switch (huc->fw.fetch_status) {
>-	case INTEL_UC_FIRMWARE_FAIL:
>-		/* something went wrong :( */
>-		err = -EIO;
>-		goto fail;
>-
>-	case INTEL_UC_FIRMWARE_NONE:
>-	case INTEL_UC_FIRMWARE_PENDING:
>-	default:
>-		/* "can't happen" */
>-		WARN_ONCE(1, "HuC fw %s invalid fetch_status %s [%d]\n",
>-			huc->fw.path,
>-			intel_uc_fw_status_repr(huc->fw.fetch_status),
>-			huc->fw.fetch_status);
>-		err = -ENXIO;
>-		goto fail;
>-
>-	case INTEL_UC_FIRMWARE_SUCCESS:
>-		break;
>-	}
>-
> 	err = huc_ucode_xfer(dev_priv);
>-	if (err)
>-		goto fail;
>
>-	huc->fw.load_status = INTEL_UC_FIRMWARE_SUCCESS;
>+	huc->fw.load_status = err ?
>+		INTEL_UC_FIRMWARE_FAIL : INTEL_UC_FIRMWARE_SUCCESS;
>
> 	DRM_DEBUG_DRIVER("%s fw status: fetch %s, load %s\n",
> 		huc->fw.path,
> 		intel_uc_fw_status_repr(huc->fw.fetch_status),
> 		intel_uc_fw_status_repr(huc->fw.load_status));
>
>-	return 0;
>-
>-fail:
>-	if (huc->fw.load_status == INTEL_UC_FIRMWARE_PENDING)
>-		huc->fw.load_status = INTEL_UC_FIRMWARE_FAIL;
>-
>-	DRM_ERROR("Failed to complete HuC uCode load with ret %d\n", err);
>+	if (huc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
>+		DRM_ERROR("Failed to complete HuC uCode load with ret
>%d\n", err);
>
>-	return err;
>+	return;
> }
>
> /**
>diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
>index 4b7f73a..2f0229d 100644
>--- a/drivers/gpu/drm/i915/intel_uc.h
>+++ b/drivers/gpu/drm/i915/intel_uc.h
>@@ -266,7 +266,7 @@ static inline u32 guc_ggtt_offset(struct i915_vma *vma)
>
> /* intel_huc.c */
> void intel_huc_select_fw(struct intel_huc *huc); -int intel_huc_init_hw(struct
>intel_huc *huc);
>+void intel_huc_init_hw(struct intel_huc *huc);
> void intel_guc_auth_huc(struct drm_i915_private *dev_priv);
>
> #endif
>--
>2.7.4
Tvrtko Ursulin April 4, 2017, 1:25 p.m. UTC | #2
On 31/03/2017 13:58, Patchwork wrote:
> == Series Details ==
>
> Series: drm/i915/huc: Simplify intel_huc_init_hw()
> URL   : https://patchwork.freedesktop.org/series/22280/
> State : success
>
> == Summary ==
>
> Series 22280v1 drm/i915/huc: Simplify intel_huc_init_hw()
> https://patchwork.freedesktop.org/api/1.0/series/22280/revisions/1/mbox/
>
> Test gem_exec_flush:
>         Subgroup basic-batch-kernel-default-uc:
>                 pass       -> FAIL       (fi-snb-2600) fdo#100007
>
> fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
>
> fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time: 427s
> fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time: 425s
> fi-bsw-n3050     total:278  pass:239  dwarn:0   dfail:0   fail:0   skip:39  time: 574s
> fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time: 514s
> fi-bxt-t5700     total:278  pass:258  dwarn:0   dfail:0   fail:0   skip:20  time: 597s
> fi-byt-j1900     total:278  pass:251  dwarn:0   dfail:0   fail:0   skip:27  time: 479s
> fi-byt-n2820     total:278  pass:247  dwarn:0   dfail:0   fail:0   skip:31  time: 488s
> fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time: 412s
> fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time: 412s
> fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time: 424s
> fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 495s
> fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 471s
> fi-kbl-7500u     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 453s
> fi-kbl-7560u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time: 570s
> fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time: 449s
> fi-skl-6700hq    total:278  pass:261  dwarn:0   dfail:0   fail:0   skip:17  time: 576s
> fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time: 461s
> fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time: 491s
> fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time: 430s
> fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time: 537s
> fi-snb-2600      total:278  pass:248  dwarn:0   dfail:0   fail:1   skip:29  time: 408s
>
> d083fa23d514574a26bfcf91aa5e1de4e6262cd9 drm-tip: 2017y-03m-31d-11h-25m-25s UTC integration manifest
> 9673e6f7 drm/i915/huc: Simplify intel_huc_init_hw()

Pushed, thanks for the patch and review!

Regards,

Tvrtko
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_huc.c b/drivers/gpu/drm/i915/intel_huc.c
index 9ee8196..385cacb 100644
--- a/drivers/gpu/drm/i915/intel_huc.c
+++ b/drivers/gpu/drm/i915/intel_huc.c
@@ -186,68 +186,36 @@  void intel_huc_select_fw(struct intel_huc *huc)
  * earlier call to intel_huc_init(), so here we need only check that
  * is succeeded, and then transfer the image to the h/w.
  *
- * Return:	non-zero code on error
  */
-int intel_huc_init_hw(struct intel_huc *huc)
+void intel_huc_init_hw(struct intel_huc *huc)
 {
 	struct drm_i915_private *dev_priv = huc_to_i915(huc);
 	int err;
 
-	if (huc->fw.fetch_status == INTEL_UC_FIRMWARE_NONE)
-		return 0;
-
 	DRM_DEBUG_DRIVER("%s fw status: fetch %s, load %s\n",
 		huc->fw.path,
 		intel_uc_fw_status_repr(huc->fw.fetch_status),
 		intel_uc_fw_status_repr(huc->fw.load_status));
 
-	if (huc->fw.fetch_status == INTEL_UC_FIRMWARE_SUCCESS &&
-	    huc->fw.load_status == INTEL_UC_FIRMWARE_FAIL)
-		return -ENOEXEC;
+	if (huc->fw.fetch_status != INTEL_UC_FIRMWARE_SUCCESS)
+		return;
 
 	huc->fw.load_status = INTEL_UC_FIRMWARE_PENDING;
 
-	switch (huc->fw.fetch_status) {
-	case INTEL_UC_FIRMWARE_FAIL:
-		/* something went wrong :( */
-		err = -EIO;
-		goto fail;
-
-	case INTEL_UC_FIRMWARE_NONE:
-	case INTEL_UC_FIRMWARE_PENDING:
-	default:
-		/* "can't happen" */
-		WARN_ONCE(1, "HuC fw %s invalid fetch_status %s [%d]\n",
-			huc->fw.path,
-			intel_uc_fw_status_repr(huc->fw.fetch_status),
-			huc->fw.fetch_status);
-		err = -ENXIO;
-		goto fail;
-
-	case INTEL_UC_FIRMWARE_SUCCESS:
-		break;
-	}
-
 	err = huc_ucode_xfer(dev_priv);
-	if (err)
-		goto fail;
 
-	huc->fw.load_status = INTEL_UC_FIRMWARE_SUCCESS;
+	huc->fw.load_status = err ?
+		INTEL_UC_FIRMWARE_FAIL : INTEL_UC_FIRMWARE_SUCCESS;
 
 	DRM_DEBUG_DRIVER("%s fw status: fetch %s, load %s\n",
 		huc->fw.path,
 		intel_uc_fw_status_repr(huc->fw.fetch_status),
 		intel_uc_fw_status_repr(huc->fw.load_status));
 
-	return 0;
-
-fail:
-	if (huc->fw.load_status == INTEL_UC_FIRMWARE_PENDING)
-		huc->fw.load_status = INTEL_UC_FIRMWARE_FAIL;
-
-	DRM_ERROR("Failed to complete HuC uCode load with ret %d\n", err);
+	if (huc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
+		DRM_ERROR("Failed to complete HuC uCode load with ret %d\n", err);
 
-	return err;
+	return;
 }
 
 /**
diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
index 4b7f73a..2f0229d 100644
--- a/drivers/gpu/drm/i915/intel_uc.h
+++ b/drivers/gpu/drm/i915/intel_uc.h
@@ -266,7 +266,7 @@  static inline u32 guc_ggtt_offset(struct i915_vma *vma)
 
 /* intel_huc.c */
 void intel_huc_select_fw(struct intel_huc *huc);
-int intel_huc_init_hw(struct intel_huc *huc);
+void intel_huc_init_hw(struct intel_huc *huc);
 void intel_guc_auth_huc(struct drm_i915_private *dev_priv);
 
 #endif