All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 resend 0/5] drm/i915/uc: Misc cleanups
@ 2017-03-30 11:21 Michal Wajdeczko
  2017-03-30 11:21 ` [PATCH v2 resend 1/5] drm/i915/uc: Move intel_uc_fw_status_repr() to intel_uc.h Michal Wajdeczko
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Michal Wajdeczko @ 2017-03-30 11:21 UTC (permalink / raw)
  To: intel-gfx

This is yet another spin of uc/guc/huc code cleanup.

Michal Wajdeczko (5):
  drm/i915/uc: Move intel_uc_fw_status_repr() to intel_uc.h
  drm/i915/uc: Add intel_uc_fw_type_repr()
  drm/i915/uc: Add intel_uc_fw_fini()
  drm/i915/huc: Remove unused intel_huc_fini()
  drm/i915/uc: Move fw path check to fetch_uc_fw()

 drivers/gpu/drm/i915/intel_guc_loader.c | 16 ------------
 drivers/gpu/drm/i915/intel_huc.c        | 18 -------------
 drivers/gpu/drm/i915/intel_uc.c         | 46 +++++++++++++++++----------------
 drivers/gpu/drm/i915/intel_uc.h         | 35 +++++++++++++++++++++++--
 4 files changed, 57 insertions(+), 58 deletions(-)

-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH v2 resend 1/5] drm/i915/uc: Move intel_uc_fw_status_repr() to intel_uc.h
  2017-03-30 11:21 [PATCH v2 resend 0/5] drm/i915/uc: Misc cleanups Michal Wajdeczko
@ 2017-03-30 11:21 ` Michal Wajdeczko
  2017-03-30 11:21 ` [PATCH v2 resend 2/5] drm/i915/uc: Add intel_uc_fw_type_repr() Michal Wajdeczko
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Michal Wajdeczko @ 2017-03-30 11:21 UTC (permalink / raw)
  To: intel-gfx

The file fits better. Also use "<invalid>" for invalid case.

v2: move directly to .h (Joonas)

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_guc_loader.c | 16 ----------------
 drivers/gpu/drm/i915/intel_uc.h         | 20 +++++++++++++++++++-
 2 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c b/drivers/gpu/drm/i915/intel_guc_loader.c
index 7d92321..8a1a023 100644
--- a/drivers/gpu/drm/i915/intel_guc_loader.c
+++ b/drivers/gpu/drm/i915/intel_guc_loader.c
@@ -73,22 +73,6 @@ MODULE_FIRMWARE(I915_BXT_GUC_UCODE);
 #define I915_KBL_GUC_UCODE GUC_FW_PATH(kbl, KBL_FW_MAJOR, KBL_FW_MINOR)
 MODULE_FIRMWARE(I915_KBL_GUC_UCODE);
 
-/* User-friendly representation of an enum */
-const char *intel_uc_fw_status_repr(enum intel_uc_fw_status status)
-{
-	switch (status) {
-	case INTEL_UC_FIRMWARE_FAIL:
-		return "FAIL";
-	case INTEL_UC_FIRMWARE_NONE:
-		return "NONE";
-	case INTEL_UC_FIRMWARE_PENDING:
-		return "PENDING";
-	case INTEL_UC_FIRMWARE_SUCCESS:
-		return "SUCCESS";
-	default:
-		return "UNKNOWN!";
-	}
-};
 
 static u32 get_gttype(struct drm_i915_private *dev_priv)
 {
diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
index 087192d..f524387 100644
--- a/drivers/gpu/drm/i915/intel_uc.h
+++ b/drivers/gpu/drm/i915/intel_uc.h
@@ -101,6 +101,25 @@ enum intel_uc_fw_status {
 	INTEL_UC_FIRMWARE_SUCCESS
 };
 
+/* User-friendly representation of an enum */
+static inline
+const char *intel_uc_fw_status_repr(enum intel_uc_fw_status status)
+{
+	switch (status) {
+	case INTEL_UC_FIRMWARE_FAIL:
+		return "FAIL";
+	case INTEL_UC_FIRMWARE_NONE:
+		return "NONE";
+	case INTEL_UC_FIRMWARE_PENDING:
+		return "PENDING";
+	case INTEL_UC_FIRMWARE_SUCCESS:
+		return "SUCCESS";
+	default:
+		MISSING_CASE(status);
+		return "<invalid>";
+	}
+}
+
 enum intel_uc_fw_type {
 	INTEL_UC_FW_TYPE_GUC,
 	INTEL_UC_FW_TYPE_HUC
@@ -207,7 +226,6 @@ static inline int intel_guc_send(struct intel_guc *guc, const u32 *action, u32 l
 /* intel_guc_loader.c */
 int intel_guc_select_fw(struct intel_guc *guc);
 int intel_guc_init_hw(struct intel_guc *guc);
-const char *intel_uc_fw_status_repr(enum intel_uc_fw_status status);
 int intel_guc_suspend(struct drm_i915_private *dev_priv);
 int intel_guc_resume(struct drm_i915_private *dev_priv);
 u32 intel_guc_wopcm_size(struct drm_i915_private *dev_priv);
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH v2 resend 2/5] drm/i915/uc: Add intel_uc_fw_type_repr()
  2017-03-30 11:21 [PATCH v2 resend 0/5] drm/i915/uc: Misc cleanups Michal Wajdeczko
  2017-03-30 11:21 ` [PATCH v2 resend 1/5] drm/i915/uc: Move intel_uc_fw_status_repr() to intel_uc.h Michal Wajdeczko
@ 2017-03-30 11:21 ` Michal Wajdeczko
  2017-03-30 11:27   ` Chris Wilson
  2017-03-30 11:21 ` [PATCH v2 resend 3/5] drm/i915/uc: Add intel_uc_fw_fini() Michal Wajdeczko
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 10+ messages in thread
From: Michal Wajdeczko @ 2017-03-30 11:21 UTC (permalink / raw)
  To: intel-gfx

Some of the DRM_NOTE messages are just using "uC" without specifying
which uc they are related to. We can be more user friendly.

v2: moved to the header (Joonas)

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_uc.c |  6 ++++--
 drivers/gpu/drm/i915/intel_uc.h | 14 ++++++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c
index c767dc3..e259cae 100644
--- a/drivers/gpu/drm/i915/intel_uc.c
+++ b/drivers/gpu/drm/i915/intel_uc.c
@@ -182,10 +182,12 @@ static void fetch_uc_fw(struct drm_i915_private *dev_priv,
 	}
 
 	if (uc_fw->major_ver_wanted == 0 && uc_fw->minor_ver_wanted == 0) {
-		DRM_NOTE("Skipping uC firmware version check\n");
+		DRM_NOTE("Skipping %s firmware version check\n",
+			 intel_uc_fw_type_repr(uc_fw->type));
 	} else if (uc_fw->major_ver_found != uc_fw->major_ver_wanted ||
 		   uc_fw->minor_ver_found < uc_fw->minor_ver_wanted) {
-		DRM_NOTE("uC firmware version %d.%d, required %d.%d\n",
+		DRM_NOTE("%s firmware version %d.%d, required %d.%d\n",
+			 intel_uc_fw_type_repr(uc_fw->type),
 			 uc_fw->major_ver_found, uc_fw->minor_ver_found,
 			 uc_fw->major_ver_wanted, uc_fw->minor_ver_wanted);
 		err = -ENOEXEC;
diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
index f524387..7139e31 100644
--- a/drivers/gpu/drm/i915/intel_uc.h
+++ b/drivers/gpu/drm/i915/intel_uc.h
@@ -125,6 +125,20 @@ enum intel_uc_fw_type {
 	INTEL_UC_FW_TYPE_HUC
 };
 
+/* User-friendly representation of an enum */
+static inline const char *intel_uc_fw_type_repr(enum intel_uc_fw_type type)
+{
+	switch (type) {
+	case INTEL_UC_FW_TYPE_GUC:
+		return "GuC";
+	case INTEL_UC_FW_TYPE_HUC:
+		return "HuC";
+	default:
+		MISSING_CASE(type);
+		return "<invalid>";
+	}
+}
+
 /*
  * This structure encapsulates all the data needed during the process
  * of fetching, caching, and loading the firmware image into the GuC.
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH v2 resend 3/5] drm/i915/uc: Add intel_uc_fw_fini()
  2017-03-30 11:21 [PATCH v2 resend 0/5] drm/i915/uc: Misc cleanups Michal Wajdeczko
  2017-03-30 11:21 ` [PATCH v2 resend 1/5] drm/i915/uc: Move intel_uc_fw_status_repr() to intel_uc.h Michal Wajdeczko
  2017-03-30 11:21 ` [PATCH v2 resend 2/5] drm/i915/uc: Add intel_uc_fw_type_repr() Michal Wajdeczko
@ 2017-03-30 11:21 ` Michal Wajdeczko
  2017-03-30 11:21 ` [PATCH v2 resend 4/5] drm/i915/huc: Remove unused intel_huc_fini() Michal Wajdeczko
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Michal Wajdeczko @ 2017-03-30 11:21 UTC (permalink / raw)
  To: intel-gfx

Cleanups of uc firmware structs from GuC and Huc are the same for both.
Move common code to the helper function to avoid duplication.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_uc.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c
index e259cae..4ab24a1 100644
--- a/drivers/gpu/drm/i915/intel_uc.c
+++ b/drivers/gpu/drm/i915/intel_uc.c
@@ -26,6 +26,19 @@
 #include "intel_uc.h"
 #include <linux/firmware.h>
 
+/* Cleans up uC firmware by releasing the firmware GEM obj.
+ */
+static void __intel_uc_fw_fini(struct intel_uc_fw *uc_fw)
+{
+	struct drm_i915_gem_object *obj;
+
+	obj = fetch_and_zero(&uc_fw->obj);
+	if (obj)
+		i915_gem_object_put(obj);
+
+	uc_fw->fetch_status = INTEL_UC_FIRMWARE_NONE;
+}
+
 /* Reset GuC providing us with fresh state for both GuC and HuC.
  */
 static int __intel_uc_reset_hw(struct drm_i915_private *dev_priv)
@@ -235,21 +248,8 @@ void intel_uc_init_fw(struct drm_i915_private *dev_priv)
 
 void intel_uc_fini_fw(struct drm_i915_private *dev_priv)
 {
-	struct intel_uc_fw *guc_fw = &dev_priv->guc.fw;
-	struct intel_uc_fw *huc_fw = &dev_priv->huc.fw;
-	struct drm_i915_gem_object *obj;
-
-	obj = fetch_and_zero(&guc_fw->obj);
-	if (obj)
-		i915_gem_object_put(obj);
-
-	guc_fw->fetch_status = INTEL_UC_FIRMWARE_NONE;
-
-	obj = fetch_and_zero(&huc_fw->obj);
-	if (obj)
-		i915_gem_object_put(obj);
-
-	huc_fw->fetch_status = INTEL_UC_FIRMWARE_NONE;
+	__intel_uc_fw_fini(&dev_priv->guc.fw);
+	__intel_uc_fw_fini(&dev_priv->huc.fw);
 }
 
 int intel_uc_init_hw(struct drm_i915_private *dev_priv)
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH v2 resend 4/5] drm/i915/huc: Remove unused intel_huc_fini()
  2017-03-30 11:21 [PATCH v2 resend 0/5] drm/i915/uc: Misc cleanups Michal Wajdeczko
                   ` (2 preceding siblings ...)
  2017-03-30 11:21 ` [PATCH v2 resend 3/5] drm/i915/uc: Add intel_uc_fw_fini() Michal Wajdeczko
@ 2017-03-30 11:21 ` Michal Wajdeczko
  2017-03-30 11:21 ` [PATCH v2 resend 5/5] drm/i915/uc: Move fw path check to fetch_uc_fw() Michal Wajdeczko
  2017-03-30 13:31 ` ✓ Fi.CI.BAT: success for drm/i915/uc: Misc cleanups Patchwork
  5 siblings, 0 replies; 10+ messages in thread
From: Michal Wajdeczko @ 2017-03-30 11:21 UTC (permalink / raw)
  To: intel-gfx

This function is no longer used. Its functionality is covered
by intel_uc_fini_fw().

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 drivers/gpu/drm/i915/intel_huc.c | 18 ------------------
 drivers/gpu/drm/i915/intel_uc.h  |  1 -
 2 files changed, 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_huc.c b/drivers/gpu/drm/i915/intel_huc.c
index 7af900b..9ee8196 100644
--- a/drivers/gpu/drm/i915/intel_huc.c
+++ b/drivers/gpu/drm/i915/intel_huc.c
@@ -251,24 +251,6 @@ int intel_huc_init_hw(struct intel_huc *huc)
 }
 
 /**
- * intel_huc_fini() - clean up resources allocated for HuC
- * @dev_priv: the drm_i915_private device
- *
- * Cleans up by releasing the huc firmware GEM obj.
- */
-void intel_huc_fini(struct drm_i915_private *dev_priv)
-{
-	struct intel_uc_fw *huc_fw = &dev_priv->huc.fw;
-	struct drm_i915_gem_object *obj;
-
-	obj = fetch_and_zero(&huc_fw->obj);
-	if (obj)
-		i915_gem_object_put(obj);
-
-	huc_fw->fetch_status = INTEL_UC_FIRMWARE_NONE;
-}
-
-/**
  * intel_guc_auth_huc() - authenticate ucode
  * @dev_priv: the drm_i915_device
  *
diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
index 7139e31..d2dcde7 100644
--- a/drivers/gpu/drm/i915/intel_uc.h
+++ b/drivers/gpu/drm/i915/intel_uc.h
@@ -270,7 +270,6 @@ static inline u32 guc_ggtt_offset(struct i915_vma *vma)
 
 /* intel_huc.c */
 void intel_huc_select_fw(struct intel_huc *huc);
-void intel_huc_fini(struct drm_i915_private  *dev_priv);
 int intel_huc_init_hw(struct intel_huc *huc);
 void intel_guc_auth_huc(struct drm_i915_private *dev_priv);
 
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH v2 resend 5/5] drm/i915/uc: Move fw path check to fetch_uc_fw()
  2017-03-30 11:21 [PATCH v2 resend 0/5] drm/i915/uc: Misc cleanups Michal Wajdeczko
                   ` (3 preceding siblings ...)
  2017-03-30 11:21 ` [PATCH v2 resend 4/5] drm/i915/huc: Remove unused intel_huc_fini() Michal Wajdeczko
@ 2017-03-30 11:21 ` Michal Wajdeczko
  2017-03-30 13:31 ` ✓ Fi.CI.BAT: success for drm/i915/uc: Misc cleanups Patchwork
  5 siblings, 0 replies; 10+ messages in thread
From: Michal Wajdeczko @ 2017-03-30 11:21 UTC (permalink / raw)
  To: intel-gfx

There is no reason to separately check for valid fw path before
we try to fetch it. Let the fetch function take care of this.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 drivers/gpu/drm/i915/intel_uc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c
index 4ab24a1..4dfde2c 100644
--- a/drivers/gpu/drm/i915/intel_uc.c
+++ b/drivers/gpu/drm/i915/intel_uc.c
@@ -112,6 +112,9 @@ static void fetch_uc_fw(struct drm_i915_private *dev_priv,
 	size_t size;
 	int err;
 
+	if (!uc_fw->path)
+		return;
+
 	uc_fw->fetch_status = INTEL_UC_FIRMWARE_PENDING;
 
 	DRM_DEBUG_DRIVER("before requesting firmware: uC fw fetch status %s\n",
@@ -239,11 +242,8 @@ static void fetch_uc_fw(struct drm_i915_private *dev_priv,
 
 void intel_uc_init_fw(struct drm_i915_private *dev_priv)
 {
-	if (dev_priv->huc.fw.path)
-		fetch_uc_fw(dev_priv, &dev_priv->huc.fw);
-
-	if (dev_priv->guc.fw.path)
-		fetch_uc_fw(dev_priv, &dev_priv->guc.fw);
+	fetch_uc_fw(dev_priv, &dev_priv->huc.fw);
+	fetch_uc_fw(dev_priv, &dev_priv->guc.fw);
 }
 
 void intel_uc_fini_fw(struct drm_i915_private *dev_priv)
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH v2 resend 2/5] drm/i915/uc: Add intel_uc_fw_type_repr()
  2017-03-30 11:21 ` [PATCH v2 resend 2/5] drm/i915/uc: Add intel_uc_fw_type_repr() Michal Wajdeczko
@ 2017-03-30 11:27   ` Chris Wilson
  2017-03-30 11:35     ` Michal Wajdeczko
  0 siblings, 1 reply; 10+ messages in thread
From: Chris Wilson @ 2017-03-30 11:27 UTC (permalink / raw)
  To: Michal Wajdeczko; +Cc: intel-gfx

On Thu, Mar 30, 2017 at 11:21:12AM +0000, Michal Wajdeczko wrote:
> Some of the DRM_NOTE messages are just using "uC" without specifying
> which uc they are related to. We can be more user friendly.
> 
> v2: moved to the header (Joonas)
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_uc.c |  6 ++++--
>  drivers/gpu/drm/i915/intel_uc.h | 14 ++++++++++++++
>  2 files changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c
> index c767dc3..e259cae 100644
> --- a/drivers/gpu/drm/i915/intel_uc.c
> +++ b/drivers/gpu/drm/i915/intel_uc.c
> @@ -182,10 +182,12 @@ static void fetch_uc_fw(struct drm_i915_private *dev_priv,
>  	}
>  
>  	if (uc_fw->major_ver_wanted == 0 && uc_fw->minor_ver_wanted == 0) {
> -		DRM_NOTE("Skipping uC firmware version check\n");
> +		DRM_NOTE("Skipping %s firmware version check\n",
> +			 intel_uc_fw_type_repr(uc_fw->type));
>  	} else if (uc_fw->major_ver_found != uc_fw->major_ver_wanted ||
>  		   uc_fw->minor_ver_found < uc_fw->minor_ver_wanted) {
> -		DRM_NOTE("uC firmware version %d.%d, required %d.%d\n",
> +		DRM_NOTE("%s firmware version %d.%d, required %d.%d\n",
> +			 intel_uc_fw_type_repr(uc_fw->type),
>  			 uc_fw->major_ver_found, uc_fw->minor_ver_found,
>  			 uc_fw->major_ver_wanted, uc_fw->minor_ver_wanted);
>  		err = -ENOEXEC;
> diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
> index f524387..7139e31 100644
> --- a/drivers/gpu/drm/i915/intel_uc.h
> +++ b/drivers/gpu/drm/i915/intel_uc.h
> @@ -125,6 +125,20 @@ enum intel_uc_fw_type {
>  	INTEL_UC_FW_TYPE_HUC
>  };
>  
> +/* User-friendly representation of an enum */
> +static inline const char *intel_uc_fw_type_repr(enum intel_uc_fw_type type)
> +{
> +	switch (type) {
> +	case INTEL_UC_FW_TYPE_GUC:
> +		return "GuC";
> +	case INTEL_UC_FW_TYPE_HUC:
> +		return "HuC";
> +	default:
> +		MISSING_CASE(type);
> +		return "<invalid>";
> +	}

Do we want to write these (when we have a clear enum type):

switch (type) {
case INTEL_UC_FW_TYPE_GUC: return "GuC";
case INTEL_UC_FW_TYPE_HUC: return "HuC";
}

MISSING_CASE(type);
return "uC";

The hope being that the compiler will give us a warning before we
encounter the runtime WARN.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH v2 resend 2/5] drm/i915/uc: Add intel_uc_fw_type_repr()
  2017-03-30 11:27   ` Chris Wilson
@ 2017-03-30 11:35     ` Michal Wajdeczko
  0 siblings, 0 replies; 10+ messages in thread
From: Michal Wajdeczko @ 2017-03-30 11:35 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Thu, Mar 30, 2017 at 12:27:45PM +0100, Chris Wilson wrote:
> On Thu, Mar 30, 2017 at 11:21:12AM +0000, Michal Wajdeczko wrote:
> > Some of the DRM_NOTE messages are just using "uC" without specifying
> > which uc they are related to. We can be more user friendly.
> > 
> > v2: moved to the header (Joonas)
> > 
> > Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> > Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_uc.c |  6 ++++--
> >  drivers/gpu/drm/i915/intel_uc.h | 14 ++++++++++++++
> >  2 files changed, 18 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c
> > index c767dc3..e259cae 100644
> > --- a/drivers/gpu/drm/i915/intel_uc.c
> > +++ b/drivers/gpu/drm/i915/intel_uc.c
> > @@ -182,10 +182,12 @@ static void fetch_uc_fw(struct drm_i915_private *dev_priv,
> >  	}
> >  
> >  	if (uc_fw->major_ver_wanted == 0 && uc_fw->minor_ver_wanted == 0) {
> > -		DRM_NOTE("Skipping uC firmware version check\n");
> > +		DRM_NOTE("Skipping %s firmware version check\n",
> > +			 intel_uc_fw_type_repr(uc_fw->type));
> >  	} else if (uc_fw->major_ver_found != uc_fw->major_ver_wanted ||
> >  		   uc_fw->minor_ver_found < uc_fw->minor_ver_wanted) {
> > -		DRM_NOTE("uC firmware version %d.%d, required %d.%d\n",
> > +		DRM_NOTE("%s firmware version %d.%d, required %d.%d\n",
> > +			 intel_uc_fw_type_repr(uc_fw->type),
> >  			 uc_fw->major_ver_found, uc_fw->minor_ver_found,
> >  			 uc_fw->major_ver_wanted, uc_fw->minor_ver_wanted);
> >  		err = -ENOEXEC;
> > diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
> > index f524387..7139e31 100644
> > --- a/drivers/gpu/drm/i915/intel_uc.h
> > +++ b/drivers/gpu/drm/i915/intel_uc.h
> > @@ -125,6 +125,20 @@ enum intel_uc_fw_type {
> >  	INTEL_UC_FW_TYPE_HUC
> >  };
> >  
> > +/* User-friendly representation of an enum */
> > +static inline const char *intel_uc_fw_type_repr(enum intel_uc_fw_type type)
> > +{
> > +	switch (type) {
> > +	case INTEL_UC_FW_TYPE_GUC:
> > +		return "GuC";
> > +	case INTEL_UC_FW_TYPE_HUC:
> > +		return "HuC";
> > +	default:
> > +		MISSING_CASE(type);
> > +		return "<invalid>";
> > +	}
> 
> Do we want to write these (when we have a clear enum type):
> 
> switch (type) {
> case INTEL_UC_FW_TYPE_GUC: return "GuC";
> case INTEL_UC_FW_TYPE_HUC: return "HuC";
> }
> 
> MISSING_CASE(type);
> return "uC";
> 
> The hope being that the compiler will give us a warning before we
> encounter the runtime WARN.

I was already proposing this option to rely on compiler, but there
was a single nack from Anusha, now overbid ;)

-Michal

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✓ Fi.CI.BAT: success for drm/i915/uc: Misc cleanups
  2017-03-30 11:21 [PATCH v2 resend 0/5] drm/i915/uc: Misc cleanups Michal Wajdeczko
                   ` (4 preceding siblings ...)
  2017-03-30 11:21 ` [PATCH v2 resend 5/5] drm/i915/uc: Move fw path check to fetch_uc_fw() Michal Wajdeczko
@ 2017-03-30 13:31 ` Patchwork
  2017-03-31  7:41   ` Joonas Lahtinen
  5 siblings, 1 reply; 10+ messages in thread
From: Patchwork @ 2017-03-30 13:31 UTC (permalink / raw)
  To: Michal Wajdeczko; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/uc: Misc cleanups
URL   : https://patchwork.freedesktop.org/series/22194/
State : success

== Summary ==

Series 22194v1 drm/i915/uc: Misc cleanups
https://patchwork.freedesktop.org/api/1.0/series/22194/revisions/1/mbox/

Test gem_exec_flush:
        Subgroup basic-batch-kernel-default-uc:
                fail       -> PASS       (fi-snb-2600) fdo#100007
Test gem_exec_suspend:
        Subgroup basic-s4-devices:
                pass       -> DMESG-WARN (fi-kbl-7560u) fdo#100125
Test kms_cursor_legacy:
        Subgroup basic-flip-before-cursor-varying-size:
                pass       -> DMESG-WARN (fi-byt-n2820) fdo#100415

fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125
fdo#100415 https://bugs.freedesktop.org/show_bug.cgi?id=100415

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time: 429s
fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time: 430s
fi-bsw-n3050     total:278  pass:239  dwarn:0   dfail:0   fail:0   skip:39  time: 570s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time: 513s
fi-bxt-t5700     total:278  pass:258  dwarn:0   dfail:0   fail:0   skip:20  time: 560s
fi-byt-j1900     total:278  pass:251  dwarn:0   dfail:0   fail:0   skip:27  time: 487s
fi-byt-n2820     total:278  pass:246  dwarn:1   dfail:0   fail:0   skip:31  time: 487s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time: 405s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time: 402s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time: 418s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 488s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 462s
fi-kbl-7500u     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 450s
fi-kbl-7560u     total:278  pass:267  dwarn:1   dfail:0   fail:0   skip:10  time: 563s
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: 569s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time: 459s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time: 492s
fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time: 431s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time: 528s
fi-snb-2600      total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  time: 414s

71dab8f683b2d609926524f9a6a60b00e4bfa543 drm-tip: 2017y-03m-30d-11h-44m-46s UTC integration manifest
477339e drm/i915/uc: Move fw path check to fetch_uc_fw()
fc83f6f drm/i915/huc: Remove unused intel_huc_fini()
105b67d drm/i915/uc: Add intel_uc_fw_fini()
6da3ed4 drm/i915/uc: Add intel_uc_fw_type_repr()
fce14b3 drm/i915/uc: Move intel_uc_fw_status_repr() to intel_uc.h

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4360/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: ✓ Fi.CI.BAT: success for drm/i915/uc: Misc cleanups
  2017-03-30 13:31 ` ✓ Fi.CI.BAT: success for drm/i915/uc: Misc cleanups Patchwork
@ 2017-03-31  7:41   ` Joonas Lahtinen
  0 siblings, 0 replies; 10+ messages in thread
From: Joonas Lahtinen @ 2017-03-31  7:41 UTC (permalink / raw)
  To: intel-gfx, Michal Wajdeczko

Merging this series, thanks for the patches and reviews.

On to, 2017-03-30 at 13:31 +0000, Patchwork wrote:
> == Series Details ==
> 
> Series: drm/i915/uc: Misc cleanups
> URL   : https://patchwork.freedesktop.org/series/22194/
> State : success
> 
> == Summary ==
> 
> Series 22194v1 drm/i915/uc: Misc cleanups
> https://patchwork.freedesktop.org/api/1.0/series/22194/revisions/1/mbox/
> 
> Test gem_exec_flush:
>         Subgroup basic-batch-kernel-default-uc:
>                 fail       -> PASS       (fi-snb-2600) fdo#100007
> Test gem_exec_suspend:
>         Subgroup basic-s4-devices:
>                 pass       -> DMESG-WARN (fi-kbl-7560u) fdo#100125
> Test kms_cursor_legacy:
>         Subgroup basic-flip-before-cursor-varying-size:
>                 pass       -> DMESG-WARN (fi-byt-n2820) fdo#100415
> 
> fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
> fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125
> fdo#100415 https://bugs.freedesktop.org/show_bug.cgi?id=100415
> 
> fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time: 429s
> fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time: 430s
> fi-bsw-n3050     total:278  pass:239  dwarn:0   dfail:0   fail:0   skip:39  time: 570s
> fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time: 513s
> fi-bxt-t5700     total:278  pass:258  dwarn:0   dfail:0   fail:0   skip:20  time: 560s
> fi-byt-j1900     total:278  pass:251  dwarn:0   dfail:0   fail:0   skip:27  time: 487s
> fi-byt-n2820     total:278  pass:246  dwarn:1   dfail:0   fail:0   skip:31  time: 487s
> fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time: 405s
> fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time: 402s
> fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time: 418s
> fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 488s
> fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 462s
> fi-kbl-7500u     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 450s
> fi-kbl-7560u     total:278  pass:267  dwarn:1   dfail:0   fail:0   skip:10  time: 563s
> 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: 569s
> fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time: 459s
> fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time: 492s
> fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time: 431s
> fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time: 528s
> fi-snb-2600      total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  time: 414s
> 
> 71dab8f683b2d609926524f9a6a60b00e4bfa543 drm-tip: 2017y-03m-30d-11h-44m-46s UTC integration manifest
> 477339e drm/i915/uc: Move fw path check to fetch_uc_fw()
> fc83f6f drm/i915/huc: Remove unused intel_huc_fini()
> 105b67d drm/i915/uc: Add intel_uc_fw_fini()
> 6da3ed4 drm/i915/uc: Add intel_uc_fw_type_repr()
> fce14b3 drm/i915/uc: Move intel_uc_fw_status_repr() to intel_uc.h
> 
> == Logs ==
> 
> For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4360/
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2017-03-31  7:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-30 11:21 [PATCH v2 resend 0/5] drm/i915/uc: Misc cleanups Michal Wajdeczko
2017-03-30 11:21 ` [PATCH v2 resend 1/5] drm/i915/uc: Move intel_uc_fw_status_repr() to intel_uc.h Michal Wajdeczko
2017-03-30 11:21 ` [PATCH v2 resend 2/5] drm/i915/uc: Add intel_uc_fw_type_repr() Michal Wajdeczko
2017-03-30 11:27   ` Chris Wilson
2017-03-30 11:35     ` Michal Wajdeczko
2017-03-30 11:21 ` [PATCH v2 resend 3/5] drm/i915/uc: Add intel_uc_fw_fini() Michal Wajdeczko
2017-03-30 11:21 ` [PATCH v2 resend 4/5] drm/i915/huc: Remove unused intel_huc_fini() Michal Wajdeczko
2017-03-30 11:21 ` [PATCH v2 resend 5/5] drm/i915/uc: Move fw path check to fetch_uc_fw() Michal Wajdeczko
2017-03-30 13:31 ` ✓ Fi.CI.BAT: success for drm/i915/uc: Misc cleanups Patchwork
2017-03-31  7:41   ` Joonas Lahtinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.