diff mbox series

[2/4] drm/i915/guc: Improved reporting when GuC fails to load

Message ID 20200921175428.2914478-3-John.C.Harrison@Intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/guc: Update to GuC v49 | expand

Commit Message

John Harrison Sept. 21, 2020, 5:54 p.m. UTC
From: John Harrison <John.C.Harrison@Intel.com>

Rather than just saying 'GuC failed to load: -110', actually print out
the GuC status register and break it down into the individual fields.

Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
---
 drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c | 27 ++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

Comments

Daniele Ceraolo Spurio Sept. 22, 2020, 12:33 a.m. UTC | #1
On 9/21/2020 10:54 AM, John.C.Harrison@Intel.com wrote:
> From: John Harrison <John.C.Harrison@Intel.com>
>
> Rather than just saying 'GuC failed to load: -110', actually print out
> the GuC status register and break it down into the individual fields.
>
> Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
> ---
>   drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c | 27 ++++++++++++++++++-----
>   1 file changed, 22 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c
> index d4a87f4c9421..eac84baf34e6 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c
> @@ -74,8 +74,9 @@ static inline bool guc_ready(struct intel_uncore *uncore, u32 *status)
>   		((val & GS_MIA_CORE_STATE) && (uk_val == GS_UKERNEL_LAPIC_DONE));
>   }
>   
> -static int guc_wait_ucode(struct intel_uncore *uncore)
> +static int guc_wait_ucode(struct intel_gt *gt)

No need to pass the GT here, you already have i915 in the uncore 
structure and you don't seem to be using the GT for anything else.

>   {
> +	struct intel_uncore *uncore = gt->uncore;
>   	u32 status;
>   	int ret;
>   
> @@ -91,16 +92,32 @@ static int guc_wait_ucode(struct intel_uncore *uncore)
>   	DRM_DEBUG_DRIVER("GuC status %#x\n", status);
>   
>   	if ((status & GS_BOOTROM_MASK) == GS_BOOTROM_RSA_FAILED) {
> -		DRM_ERROR("GuC firmware signature verification failed\n");
> +		drm_err(&gt->i915->drm, "GuC firmware signature verification failed\n");
>   		ret = -ENOEXEC;
> +		goto out;
>   	}
>   
>   	if ((status & GS_UKERNEL_MASK) == GS_UKERNEL_EXCEPTION) {
> -		DRM_ERROR("GuC firmware exception. EIP: %#x\n",
> -			  intel_uncore_read(uncore, SOFT_SCRATCH(13)));
> +		drm_err(&gt->i915->drm, "GuC firmware exception. EIP: %#x\n",
> +			intel_uncore_read(uncore, SOFT_SCRATCH(13)));
>   		ret = -ENXIO;
> +		goto out;
>   	}
>   
> +	if (ret) {
> +		drm_err(&gt->i915->drm, "GuC load failed: status: Reset = %d, "
> +			"BootROM = 0x%02X, UKernel = 0x%02X, "
> +			"MIA = 0x%02X, Auth = 0x%02X\n",
> +			(status >> GS_RESET_SHIFT) & 1,
> +			(status & GS_BOOTROM_MASK) >> GS_BOOTROM_SHIFT,

Could use the REG_FIELD_GET macro here and below to simplify the code

> +			(status & GS_UKERNEL_MASK) >> GS_UKERNEL_SHIFT,
> +			(status & GS_MIA_MASK) >> GS_MIA_SHIFT,
> +			(status & GS_AUTH_STATUS_MASK) >> GS_AUTH_STATUS_SHIFT);

IMO it'd be worth printing the status breakdown for all failures cases, 
even the 2 above, but not a blocker.

With the function parameter flipped back to uncore, this is:

Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

Daniele

> +	}
> +
> +out:
> +	if (ret)
> +		drm_err(&gt->i915->drm, "GuC load failed: status = 0x%08X\n", status);
>   	return ret;
>   }
>   
> @@ -139,7 +156,7 @@ int intel_guc_fw_upload(struct intel_guc *guc)
>   	if (ret)
>   		goto out;
>   
> -	ret = guc_wait_ucode(uncore);
> +	ret = guc_wait_ucode(gt);
>   	if (ret)
>   		goto out;
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c
index d4a87f4c9421..eac84baf34e6 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c
@@ -74,8 +74,9 @@  static inline bool guc_ready(struct intel_uncore *uncore, u32 *status)
 		((val & GS_MIA_CORE_STATE) && (uk_val == GS_UKERNEL_LAPIC_DONE));
 }
 
-static int guc_wait_ucode(struct intel_uncore *uncore)
+static int guc_wait_ucode(struct intel_gt *gt)
 {
+	struct intel_uncore *uncore = gt->uncore;
 	u32 status;
 	int ret;
 
@@ -91,16 +92,32 @@  static int guc_wait_ucode(struct intel_uncore *uncore)
 	DRM_DEBUG_DRIVER("GuC status %#x\n", status);
 
 	if ((status & GS_BOOTROM_MASK) == GS_BOOTROM_RSA_FAILED) {
-		DRM_ERROR("GuC firmware signature verification failed\n");
+		drm_err(&gt->i915->drm, "GuC firmware signature verification failed\n");
 		ret = -ENOEXEC;
+		goto out;
 	}
 
 	if ((status & GS_UKERNEL_MASK) == GS_UKERNEL_EXCEPTION) {
-		DRM_ERROR("GuC firmware exception. EIP: %#x\n",
-			  intel_uncore_read(uncore, SOFT_SCRATCH(13)));
+		drm_err(&gt->i915->drm, "GuC firmware exception. EIP: %#x\n",
+			intel_uncore_read(uncore, SOFT_SCRATCH(13)));
 		ret = -ENXIO;
+		goto out;
 	}
 
+	if (ret) {
+		drm_err(&gt->i915->drm, "GuC load failed: status: Reset = %d, "
+			"BootROM = 0x%02X, UKernel = 0x%02X, "
+			"MIA = 0x%02X, Auth = 0x%02X\n",
+			(status >> GS_RESET_SHIFT) & 1,
+			(status & GS_BOOTROM_MASK) >> GS_BOOTROM_SHIFT,
+			(status & GS_UKERNEL_MASK) >> GS_UKERNEL_SHIFT,
+			(status & GS_MIA_MASK) >> GS_MIA_SHIFT,
+			(status & GS_AUTH_STATUS_MASK) >> GS_AUTH_STATUS_SHIFT);
+	}
+
+out:
+	if (ret)
+		drm_err(&gt->i915->drm, "GuC load failed: status = 0x%08X\n", status);
 	return ret;
 }
 
@@ -139,7 +156,7 @@  int intel_guc_fw_upload(struct intel_guc *guc)
 	if (ret)
 		goto out;
 
-	ret = guc_wait_ucode(uncore);
+	ret = guc_wait_ucode(gt);
 	if (ret)
 		goto out;