All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michal Wajdeczko" <michal.wajdeczko@intel.com>
To: intel-gfx@lists.freedesktop.org, Jackie Li <yaodong.li@intel.com>
Subject: Re: [PATCH v11 4/6] drm/i915: Add HuC firmware size related restriction for Gen9 and CNL A0
Date: Thu, 01 Mar 2018 14:14:28 +0100	[thread overview]
Message-ID: <op.ze68eepuxaggs7@mwajdecz-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <1519866100-19989-4-git-send-email-yaodong.li@intel.com>

On Thu, 01 Mar 2018 02:01:38 +0100, Jackie Li <yaodong.li@intel.com> wrote:

> On CNL A0 and Gen9, there's a hardware restriction that requires the
> available GuC WOPCM size to be larger than or equal to HuC firmware size.
>
> This patch adds new verification code to ensure the available GuC WOPCM
> size to be larger than or equal to HuC firmware size on both Gen9 and CNL
> A0.
>
> v6:
>  - Extended HuC FW size check against GuC WOPCM size to all
>    Gen9 and CNL A0 platforms
>
> v7:
>  - Fixed patch format issues
>
> v8:
>  - Renamed variables and functions to avoid ambiguity (Joonas)
>  - Updated commit message and comments to be more comprehensive (Sagar)
>
> v9:
>  - Moved code that is not related to restriction check into a separate
>    patch and updated the commit message accordingly (Sagar/Michal)
>  - Avoided to call uc_get_fw_size for better layer isolation (Michal)
>
> v10:
>  - Shorten function names and reorganized size_check code to have clear
>    isolation (Joonas)
>  - Removed unnecessary comments (Joonas)
>
> v11:
>  - Fixed logic error in size check (Michal)
>
> BSpec: 10875
>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com>
> Cc: John Spotswood <john.a.spotswood@intel.com>
> Cc: Jeff McGee <jeff.mcgee@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Reviewed-by: Sagar Arun Kamble <sagar.a.kamble@intel.com> (v8)
> Signed-off-by: Jackie Li <yaodong.li@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_wopcm.c | 28 +++++++++++++++++++++++++---
>  1 file changed, 25 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_wopcm.c  
> b/drivers/gpu/drm/i915/intel_wopcm.c
> index bb78043..b30d7ff 100644
> --- a/drivers/gpu/drm/i915/intel_wopcm.c
> +++ b/drivers/gpu/drm/i915/intel_wopcm.c
> @@ -107,8 +107,26 @@ static inline int gen9_check_dword_gap(u32  
> guc_wopcm_base, u32 guc_wopcm_size)
>  	return 0;
>  }
> +static inline int gen9_check_huc_fw_fits(u32 guc_wopcm_size, u32  
> huc_fw_size)
> +{
> +	/*
> +	 * On Gen9 & CNL A0, hardware requires the total available GuC WOPCM
> +	 * size to be larger than or equal to HuC firmware size. Otherwise,
> +	 * firmware uploading would fail.
> +	 */
> +	if (huc_fw_size > guc_wopcm_size - GUC_WOPCM_RESERVED) {
> +		DRM_ERROR("HuC fw(%uKiB) won't fit in GuC WOPCM(%uKiB).\n",
> +			  huc_fw_size / 1024,
> +			  (guc_wopcm_size - GUC_WOPCM_RESERVED) / 1024);

bikeshed: in earlier patches in similar error messages, you used
"HuC FW (%KiB)" and didn't provide available space. Maybe simplest
way to unify and minimize the code is to add one "failed" tag in
wopcm_init function where you can print all values used for partitioning:

failed:
	DRM_ERROR("Failed to partition %uKiB WOPCM (%d)\n", wopcm->size/1024,  
err);
	DRM_ERROR("HuC FW size=%uKiB\n", ...);
	DRM_ERROR("GuC FW size=%uKiB\n", ...);
	return err;

> +		return -E2BIG;
> +	}
> +
> +	return 0;
> +}
> +
>  static inline int check_hw_restriction(struct drm_i915_private *i915,
> -				       u32 guc_wopcm_base, u32 guc_wopcm_size)
> +				       u32 guc_wopcm_base, u32 guc_wopcm_size,
> +				       u32 huc_fw_size)
>  {
>  	int err = 0;
> @@ -117,7 +135,10 @@ static inline int check_hw_restriction(struct  
> drm_i915_private *i915,
>  	if (err)
>  		return err;
> -	return 0;
> +	if (IS_GEN9(i915) || IS_CNL_REVID(i915, CNL_REVID_A0, CNL_REVID_A0))
> +		err = gen9_check_huc_fw_fits(guc_wopcm_size, huc_fw_size);
> +
> +	return err;
>  }
> /**
> @@ -186,7 +207,8 @@ int intel_wopcm_init(struct intel_wopcm *wopcm)
>  		return -E2BIG;
>  	}
> -	err = check_hw_restriction(i915, guc_wopcm_base, guc_wopcm_size);
> +	err = check_hw_restriction(i915, guc_wopcm_base, guc_wopcm_size,
> +				   huc_fw_size);
>  	if (err) {
>  		DRM_ERROR("Failed to meet HW restriction.\n");
>  		return err;

but bikeshed is not critical, so

Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-03-01 13:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-01  1:01 [PATCH v11 1/6] drm/i915/guc: Rename guc_ggtt_offset to intel_guc_ggtt_offset Jackie Li
2018-03-01  1:01 ` [PATCH v11 2/6] drm/i915: Implement dynamic GuC WOPCM offset and size calculation Jackie Li
2018-03-01 12:56   ` Michal Wajdeczko
2018-03-01 18:27     ` Yaodong Li
2018-03-01  1:01 ` [PATCH v11 3/6] drm/i915: Add support to return CNL specific reserved WOPCM size Jackie Li
2018-03-01 12:58   ` Michal Wajdeczko
2018-03-01  1:01 ` [PATCH v11 4/6] drm/i915: Add HuC firmware size related restriction for Gen9 and CNL A0 Jackie Li
2018-03-01 13:14   ` Michal Wajdeczko [this message]
2018-03-01 18:32     ` Yaodong Li
2018-03-01  1:01 ` [PATCH v11 5/6] drm/i915/guc: Check the locking status of GuC WOPCM registers Jackie Li
2018-03-01 10:49   ` Chris Wilson
2018-03-01 13:37   ` Michal Wajdeczko
2018-03-01 18:50     ` Yaodong Li
2018-03-01  1:01 ` [PATCH v11 6/6] HAX Enable GuC Submission for CI Jackie Li
2018-03-01  1:30 ` ✗ Fi.CI.BAT: failure for series starting with [v11,1/6] drm/i915/guc: Rename guc_ggtt_offset to intel_guc_ggtt_offset Patchwork
2018-03-01 11:09 ` [PATCH v11 1/6] " Michal Wajdeczko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=op.ze68eepuxaggs7@mwajdecz-mobl1.ger.corp.intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=yaodong.li@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.