public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Sagar Arun Kamble <sagar.a.kamble@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v3 07/14] drm/i915/guc: Move firmware size check out of generic code
Date: Fri, 13 Oct 2017 12:19:22 +0530	[thread overview]
Message-ID: <3c66fa7f-9308-7672-df3c-ba263a5c1507@intel.com> (raw)
In-Reply-To: <20171012225447.256-8-michal.wajdeczko@intel.com>



On 10/13/2017 4:24 AM, Michal Wajdeczko wrote:
> Checking GuC firmware size can be done in GuC specific code
> right before DMA copy as it is unlikely to fail anyway.
>
> v2: rebased
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Reviewed-by: Sagar Arun Kamble <sagar.a.kamble@intel.com> #1
> ---
>   drivers/gpu/drm/i915/intel_guc_fw.c | 7 ++++++-
>   drivers/gpu/drm/i915/intel_uc_fw.c  | 8 --------
>   2 files changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_guc_fw.c b/drivers/gpu/drm/i915/intel_guc_fw.c
> index 71dacc3..020ce26 100644
> --- a/drivers/gpu/drm/i915/intel_guc_fw.c
> +++ b/drivers/gpu/drm/i915/intel_guc_fw.c
> @@ -133,6 +133,7 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv,
>   	unsigned long offset;
>   	struct sg_table *sg = vma->pages;
>   	u32 status, rsa[UOS_RSA_SCRATCH_MAX_COUNT];
> +	u32 size = guc_fw->header_size + guc_fw->ucode_size;
>   	int i, ret = 0;
>   
>   	/* where RSA signature starts */
> @@ -145,7 +146,11 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv,
>   
>   	/* The header plus uCode will be copied to WOPCM via DMA, excluding any
>   	 * other components */
> -	I915_WRITE(DMA_COPY_SIZE, guc_fw->header_size + guc_fw->ucode_size);
> +	if (size > intel_guc_wopcm_size(dev_priv)) {
This size check better be done before RSA copy. With that:
Reviewed-by: Sagar Arun Kamble <sagar.a.kamble@intel.com>
> +		DRM_ERROR("Firmware is too large to fit in WOPCM\n");
> +		return -EFBIG;
> +	}
> +	I915_WRITE(DMA_COPY_SIZE, size);
>   
>   	/* Set the source address for the new blob */
>   	offset = guc_ggtt_offset(vma) + guc_fw->header_offset;
> diff --git a/drivers/gpu/drm/i915/intel_uc_fw.c b/drivers/gpu/drm/i915/intel_uc_fw.c
> index 766b1cb..482115b 100644
> --- a/drivers/gpu/drm/i915/intel_uc_fw.c
> +++ b/drivers/gpu/drm/i915/intel_uc_fw.c
> @@ -108,14 +108,6 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv,
>   	 */
>   	switch (uc_fw->type) {
>   	case INTEL_UC_FW_TYPE_GUC:
> -		/* Header and uCode will be loaded to WOPCM. Size of the two. */
> -		size = uc_fw->header_size + uc_fw->ucode_size;
> -
> -		/* Top 32k of WOPCM is reserved (8K stack + 24k RC6 context). */
> -		if (size > intel_guc_wopcm_size(dev_priv)) {
> -			DRM_ERROR("Firmware is too large to fit in WOPCM\n");
> -			goto fail;
> -		}
>   		uc_fw->major_ver_found = css->guc.sw_version >> 16;
>   		uc_fw->minor_ver_found = css->guc.sw_version & 0xFFFF;
>   		break;

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

  reply	other threads:[~2017-10-13  6:49 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-12 22:54 [PATCH v3 00/14] Firmware code reorg Michal Wajdeczko
2017-10-12 22:54 ` [PATCH v3 01/14] drm/i915: Move intel_guc_wopcm_size to intel_guc.c Michal Wajdeczko
2017-10-12 22:54 ` [PATCH v3 02/14] drm/i915/guc: Move GuC boot param initialization out of xfer Michal Wajdeczko
2017-10-13  5:13   ` Sagar Arun Kamble
2017-10-13  5:15     ` Sagar Arun Kamble
2017-10-12 22:54 ` [PATCH v3 03/14] drm/i915/guc: Small fixups post code move Michal Wajdeczko
2017-10-12 22:54 ` [PATCH v3 04/14] drm/i915/guc: Move doc near related definitions Michal Wajdeczko
2017-10-13  5:53   ` Sagar Arun Kamble
2017-10-12 22:54 ` [PATCH v3 05/14] drm/i915/guc: Rename intel_guc_loader.c to intel_guc_fw.c Michal Wajdeczko
2017-10-12 22:54 ` [PATCH v3 06/14] drm/i915/guc: Reorder functions in intel_guc_fw.c Michal Wajdeczko
2017-10-12 22:54 ` [PATCH v3 07/14] drm/i915/guc: Move firmware size check out of generic code Michal Wajdeczko
2017-10-13  6:49   ` Sagar Arun Kamble [this message]
2017-10-13  9:54     ` Michal Wajdeczko
2017-10-12 22:54 ` [PATCH v3 08/14] drm/i915/guc: Pick better place for Guc final status message Michal Wajdeczko
2017-10-13  6:54   ` Sagar Arun Kamble
2017-10-13  9:58     ` Michal Wajdeczko
2017-10-13 10:14     ` Michal Wajdeczko
2017-10-13 10:17       ` Sagar Arun Kamble
2017-10-12 22:54 ` [PATCH v3 09/14] drm/i915/uc: Improve debug messages in firmware fetch Michal Wajdeczko
2017-10-12 22:54 ` [PATCH v3 10/14] drm/i915/uc: Add message with firmware url Michal Wajdeczko
2017-10-12 23:20   ` Chris Wilson
2017-10-13  6:47     ` Michal Wajdeczko
2017-10-12 22:54 ` [PATCH v3 11/14] drm/i915/uc: Unify firmware loading Michal Wajdeczko
2017-10-12 22:54 ` [PATCH v3 12/14] drm/i915/guc: Update Guc messages on load failure Michal Wajdeczko
2017-10-12 22:54 ` [PATCH v3 13/14] drm/i915/huc: Move fw select function Michal Wajdeczko
2017-10-12 22:54 ` [PATCH v3 14/14] HAX enable GuC submission for CI Michal Wajdeczko
2017-10-12 23:27 ` ✗ Fi.CI.BAT: failure for Firmware code reorg (rev2) Patchwork

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=3c66fa7f-9308-7672-df3c-ba263a5c1507@intel.com \
    --to=sagar.a.kamble@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=michal.wajdeczko@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox