Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Siva Mullati <siva.mullati@intel.com>
To: "Vivekanandan,
	Balasubramani" <balasubramani.vivekanandan@intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Cc: "De Marchi, Lucas" <lucas.demarchi@intel.com>
Subject: Re: [Intel-gfx] [PATCH] drm/i915/uc: use io memcpy functions for device memory copy
Date: Wed, 27 Apr 2022 19:59:22 +0530	[thread overview]
Message-ID: <9934f4de-9f25-2422-092c-e8e2fe1d796e@intel.com> (raw)
In-Reply-To: <20220406091809.746969-1-balasubramani.vivekanandan@intel.com>

LGTM

Acked-by: Siva Mullati <siva.mullati@intel.com>

On 06/04/22 14:48, Vivekanandan, Balasubramani wrote:
> When copying RSA use io memcpy functions if the destination address
> contains a GPU local memory address. Considering even the source
> address can be on local memory, a bounce buffer is used to copy from io
> to io.
> The intention of this patch is to make i915 portable outside x86 mainly
> on ARM64.
>
> Signed-off-by: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>
> ---
>  drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c | 23 +++++++++++++++++++++--
>  1 file changed, 21 insertions(+), 2 deletions(-)
>
> 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 bb864655c495..06d30670e15c 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
> @@ -589,7 +589,7 @@ static int uc_fw_rsa_data_create(struct intel_uc_fw *uc_fw)
>  	struct intel_gt *gt = __uc_fw_to_gt(uc_fw);
>  	struct i915_vma *vma;
>  	size_t copied;
> -	void *vaddr;
> +	void *vaddr, *bounce;
>  	int err;
>  
>  	err = i915_inject_probe_error(gt->i915, -ENXIO);
> @@ -621,7 +621,26 @@ static int uc_fw_rsa_data_create(struct intel_uc_fw *uc_fw)
>  		goto unpin_out;
>  	}
>  
> -	copied = intel_uc_fw_copy_rsa(uc_fw, vaddr, vma->size);
> +	if (i915_gem_object_is_lmem(vma->obj)) {
> +		/* When vma is allocated from the GPU local memmory, it means
> +		 * the destination address contains an io memory and we need to
> +		 * use memcpy function for io memory for copying, to ensure
> +		 * i915 portability outside x86. It is most likely the RSA will
> +		 * also be on local memory and so the source of copy will also
> +		 * be an io address. Since we cannot directly copy from io to
> +		 * io, we use a bounce buffer to copy.
> +		 */
> +		copied = 0;
> +		bounce = kmalloc(vma->size, GFP_KERNEL);
> +		if (likely(bounce)) {
> +			copied = intel_uc_fw_copy_rsa(uc_fw, bounce, vma->size);
> +			memcpy_toio((void __iomem *)vaddr, bounce, copied);
> +			kfree(bounce);
> +		}
> +	} else {
> +		copied = intel_uc_fw_copy_rsa(uc_fw, vaddr, vma->size);
> +	}
> +
>  	i915_gem_object_unpin_map(vma->obj);
>  
>  	if (copied < uc_fw->rsa_size) {

      parent reply	other threads:[~2022-04-27 14:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-06  9:18 [Intel-gfx] [PATCH] drm/i915/uc: use io memcpy functions for device memory copy Balasubramani Vivekanandan
2022-04-06 10:37 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2022-04-06 14:45 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-04-27 14:29 ` Siva Mullati [this message]

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=9934f4de-9f25-2422-092c-e8e2fe1d796e@intel.com \
    --to=siva.mullati@intel.com \
    --cc=balasubramani.vivekanandan@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=lucas.demarchi@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