All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 6/9] drm/i915/uc: Move xfer rsa logic to common function
Date: Tue, 23 Jul 2019 09:34:39 +0100	[thread overview]
Message-ID: <156387087900.31349.14939161702333243015@skylake-alporthouse-com> (raw)
In-Reply-To: <20190722232048.9970-7-daniele.ceraolospurio@intel.com>

Quoting Daniele Ceraolo Spurio (2019-07-23 00:20:45)
> The way we copy the RSA is the same for GuC and HuC, so we can move the
> logic in a common function. this will also make any update needed for
> local memory easier.
> 
> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> ---
>  drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c | 5 +----
>  drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c | 9 +++------
>  drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c  | 9 +++++++++
>  drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h  | 1 +
>  4 files changed, 14 insertions(+), 10 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 86df5147fc0a..8439a1fcfaae 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c
> @@ -106,13 +106,10 @@ static void guc_prepare_xfer(struct intel_guc *guc)
>  static void guc_xfer_rsa(struct intel_guc *guc)
>  {
>         struct intel_uncore *uncore = guc_to_gt(guc)->uncore;
> -       struct intel_uc_fw *fw = &guc->fw;
> -       struct sg_table *pages = fw->obj->mm.pages;
>         u32 rsa[UOS_RSA_SCRATCH_COUNT];
>         int i;
>  
> -       sg_pcopy_to_buffer(pages->sgl, pages->nents,
> -                          rsa, sizeof(rsa), fw->rsa_offset);
> +       intel_uc_fw_copy_rsa(&guc->fw, rsa, sizeof(rsa));

Return num_bytes copied?
GEM_BUG_ON(i < sizeof(rsa)) ?

>  
>         for (i = 0; i < UOS_RSA_SCRATCH_COUNT; i++)
>                 intel_uncore_write(uncore, UOS_RSA_SCRATCH(i), rsa[i]);
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c b/drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c
> index 263977294ef0..f200f6d49e60 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_huc_fw.c
> @@ -64,17 +64,14 @@ void intel_huc_fw_init_early(struct intel_huc *huc)
>  
>  static void huc_xfer_rsa(struct intel_huc *huc)
>  {
> -       struct intel_uc_fw *fw = &huc->fw;
> -       struct sg_table *pages = fw->obj->mm.pages;
> -
>         /*
>          * HuC firmware image is outside GuC accessible range.
>          * Copy the RSA signature out of the image into
>          * the perma-pinned region set aside for it
>          */
> -       sg_pcopy_to_buffer(pages->sgl, pages->nents,
> -                          huc->rsa_data_vaddr, fw->rsa_size,
> -                          fw->rsa_offset);
> +       GEM_BUG_ON(huc->fw.rsa_size > huc->rsa_data->size);
> +       intel_uc_fw_copy_rsa(&huc->fw, huc->rsa_data_vaddr,
> +                            huc->rsa_data->size);
>  }
>  
>  static int huc_xfer_ucode(struct intel_huc *huc)
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
> index 91b1d9663481..3bf68285493b 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
> @@ -365,6 +365,15 @@ void intel_uc_fw_cleanup_fetch(struct intel_uc_fw *uc_fw)
>         uc_fw->status = INTEL_UC_FIRMWARE_SELECTION_DONE;
>  }
>  
> +void intel_uc_fw_copy_rsa(struct intel_uc_fw *uc_fw, void *dst, u32 max_len)
> +{
> +       struct sg_table *pages = uc_fw->obj->mm.pages;
> +       u32 size = min_t(u32, uc_fw->rsa_size, max_len);
> +
> +       sg_pcopy_to_buffer(pages->sgl, pages->nents,
> +                          dst, size, uc_fw->rsa_offset);

return sg_pcopy_to_buffer(pages->sgl, pages->nents,
			  dst, size, uc_fw->rsa_offset);

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-07-23  8:34 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-22 23:20 [PATCH 0/9] uC fw path unification + misc clean-up Daniele Ceraolo Spurio
2019-07-22 23:20 ` [PATCH 1/9] drm/i915/uc: Gt-fy uc reset Daniele Ceraolo Spurio
2019-07-23  7:47   ` Chris Wilson
2019-07-22 23:20 ` [PATCH 2/9] drm/i915/uc: Unify uC platform check Daniele Ceraolo Spurio
2019-07-23  8:21   ` Chris Wilson
2019-07-23 11:19   ` Michal Wajdeczko
2019-07-23 14:52     ` Daniele Ceraolo Spurio
2019-07-23 21:15       ` Daniele Ceraolo Spurio
2019-07-22 23:20 ` [PATCH 3/9] drm/i915/uc: Unify uC FW selection Daniele Ceraolo Spurio
2019-07-23  8:26   ` Chris Wilson
2019-07-23 13:22   ` Michal Wajdeczko
2019-07-23 15:01     ` Daniele Ceraolo Spurio
2019-07-22 23:20 ` [PATCH 4/9] drm/i915/uc: Sanitize uC when GT is sanitized Daniele Ceraolo Spurio
2019-07-23  8:00   ` Chris Wilson
2019-07-22 23:20 ` [PATCH 5/9] drm/i915/uc: Unify uc_fw status tracking Daniele Ceraolo Spurio
2019-07-23  8:28   ` Chris Wilson
2019-07-23 14:20   ` Michal Wajdeczko
2019-07-22 23:20 ` [PATCH 6/9] drm/i915/uc: Move xfer rsa logic to common function Daniele Ceraolo Spurio
2019-07-23  8:34   ` Chris Wilson [this message]
2019-07-22 23:20 ` [PATCH 7/9] drm/i915/huc: Copy huc rsa only once Daniele Ceraolo Spurio
2019-07-23  8:37   ` Chris Wilson
2019-07-22 23:20 ` [PATCH 8/9] drm/i915/uc: Plumb the gt through fw_upload Daniele Ceraolo Spurio
2019-07-23  8:39   ` Chris Wilson
2019-07-22 23:20 ` [PATCH 9/9] drm/i915/uc: Unify uC firmware upload Daniele Ceraolo Spurio
2019-07-23  8:45   ` Chris Wilson
2019-07-23  0:14 ` ✗ Fi.CI.CHECKPATCH: warning for uC fw path unification + misc clean-up Patchwork
2019-07-23  0:19 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-07-23  1:08 ` ✓ Fi.CI.BAT: success " Patchwork
2019-07-23  4:54 ` ✓ Fi.CI.IGT: " Patchwork
2019-07-23  8:01 ` [PATCH 0/9] " Chris Wilson

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=156387087900.31349.14939161702333243015@skylake-alporthouse-com \
    --to=chris@chris-wilson.co.uk \
    --cc=daniele.ceraolospurio@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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.