diff mbox

[2/3] drm/i915: Include GuC fw version in error state

Message ID 20170224190530.31482-2-michel.thierry@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michel Thierry Feb. 24, 2017, 7:05 p.m. UTC
There was no way to check if the platform is running the latest
firmware.

v2: use HAS_GUC and intel_guc* (Michal)
    capture before reset (Chris)

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Signed-off-by: Michel Thierry <michel.thierry@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h       |  2 ++
 drivers/gpu/drm/i915/i915_gpu_error.c | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)

Comments

Michal Wajdeczko Feb. 24, 2017, 7:24 p.m. UTC | #1
On Fri, Feb 24, 2017 at 11:05:29AM -0800, Michel Thierry wrote:
> There was no way to check if the platform is running the latest
> firmware.
> 
> v2: use HAS_GUC and intel_guc* (Michal)
>     capture before reset (Chris)
> 
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> Signed-off-by: Michel Thierry <michel.thierry@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h       |  2 ++
>  drivers/gpu/drm/i915/i915_gpu_error.c | 17 +++++++++++++++++
>  2 files changed, 19 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 3b0cff05f5f7..a331c00523bc 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -956,6 +956,8 @@ struct i915_gpu_state {
>  	/* Firmware load state */
>  	u32 dmc_loaded;
>  	u32 dmc_version;
> +	u32 guc_loaded;

Btw, we can drop this u32 by assuming that non-zero version is same as "loaded"
as having fw version 0.0 loaded into Guc is unlikely ;)

> +	u32 guc_version;

Hmm, if we use 2x u16 here then we avoid manual bit operations on capture/print

But still

Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>

-Michal 


>  
>  	u32 nfence;
>  	u64 fence[I915_MAX_NUM_FENCES];
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> index ae6f0092b046..63f1b9606b57 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -629,6 +629,13 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
>  			   CSR_VERSION_MINOR(error->dmc_version));
>  	}
>  
> +	if (HAS_GUC(dev_priv)) {
> +		err_printf(m, "GuC loaded: %s\n", yesno(error->guc_loaded));
> +		err_printf(m, "GuC fw version: %d.%d\n",
> +			   error->guc_version >> 16,
> +			   error->guc_version & 0xffff);
> +	}
> +
>  	err_printf(m, "EIR: 0x%08x\n", error->eir);
>  	err_printf(m, "IER: 0x%08x\n", error->ier);
>  	for (i = 0; i < error->ngtier; i++)
> @@ -1592,6 +1599,16 @@ static void i915_capture_fw_state(struct drm_i915_private *dev_priv,
>  		error->dmc_loaded = (csr->dmc_payload != NULL);
>  		error->dmc_version = csr->version;
>  	}
> +
> +	if (HAS_GUC(dev_priv)) {
> +		struct intel_guc *guc = &dev_priv->guc;
> +
> +		error->guc_loaded =
> +			(guc->fw.load_status == INTEL_UC_FIRMWARE_SUCCESS);
> +		error->guc_version =
> +			(guc->fw.major_ver_found << 16 |
> +			 guc->fw.minor_ver_found);
> +	}
>  }
>  
>  static void i915_error_capture_msg(struct drm_i915_private *dev_priv,
> -- 
> 2.11.0
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 3b0cff05f5f7..a331c00523bc 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -956,6 +956,8 @@  struct i915_gpu_state {
 	/* Firmware load state */
 	u32 dmc_loaded;
 	u32 dmc_version;
+	u32 guc_loaded;
+	u32 guc_version;
 
 	u32 nfence;
 	u64 fence[I915_MAX_NUM_FENCES];
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index ae6f0092b046..63f1b9606b57 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -629,6 +629,13 @@  int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
 			   CSR_VERSION_MINOR(error->dmc_version));
 	}
 
+	if (HAS_GUC(dev_priv)) {
+		err_printf(m, "GuC loaded: %s\n", yesno(error->guc_loaded));
+		err_printf(m, "GuC fw version: %d.%d\n",
+			   error->guc_version >> 16,
+			   error->guc_version & 0xffff);
+	}
+
 	err_printf(m, "EIR: 0x%08x\n", error->eir);
 	err_printf(m, "IER: 0x%08x\n", error->ier);
 	for (i = 0; i < error->ngtier; i++)
@@ -1592,6 +1599,16 @@  static void i915_capture_fw_state(struct drm_i915_private *dev_priv,
 		error->dmc_loaded = (csr->dmc_payload != NULL);
 		error->dmc_version = csr->version;
 	}
+
+	if (HAS_GUC(dev_priv)) {
+		struct intel_guc *guc = &dev_priv->guc;
+
+		error->guc_loaded =
+			(guc->fw.load_status == INTEL_UC_FIRMWARE_SUCCESS);
+		error->guc_version =
+			(guc->fw.major_ver_found << 16 |
+			 guc->fw.minor_ver_found);
+	}
 }
 
 static void i915_error_capture_msg(struct drm_i915_private *dev_priv,