All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Roper <matthew.d.roper@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v3 3/5] drm/xe/display: Avoid calling readq()
Date: Thu, 18 Jan 2024 16:25:13 -0800	[thread overview]
Message-ID: <20240119002513.GY45138@mdroper-desk1.amr.corp.intel.com> (raw)
In-Reply-To: <20240119001612.2991381-4-lucas.demarchi@intel.com>

On Thu, Jan 18, 2024 at 04:16:10PM -0800, Lucas De Marchi wrote:
> readq() is not available in 32bits and i915_gem_object_read_from_page()
> is supposed to allow reading arbitrary sizes determined by the `size`
> argument. Currently the only caller only passes a size == 8 so the second
> problem is not that big. Migrate to calling memcpy()/memcpy_fromio() to allow
> possible changes in the display side and to fix the build on 32b architectures.
> 
> v2: Use memcpy/memcpy_fromio directly rather than using iosys-map with
>     the same size == 8 bytes restriction (Matt Roper)
> 
> Fixes: 44e694958b95 ("drm/xe/display: Implement display support")
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>

Reviewed-by: Matt Roper <matthew.d.roper@intel.com>

> ---
>  .../drm/xe/compat-i915-headers/gem/i915_gem_object.h  | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h b/drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h
> index 5f19550cc845..68d9f6116bdf 100644
> --- a/drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h
> +++ b/drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h
> @@ -35,12 +35,10 @@ static inline int i915_gem_object_read_from_page(struct xe_bo *bo,
>  					  u32 ofs, u64 *ptr, u32 size)
>  {
>  	struct ttm_bo_kmap_obj map;
> -	void *virtual;
> +	void *src;
>  	bool is_iomem;
>  	int ret;
>  
> -	XE_WARN_ON(size != 8);
> -
>  	ret = xe_bo_lock(bo, true);
>  	if (ret)
>  		return ret;
> @@ -50,11 +48,12 @@ static inline int i915_gem_object_read_from_page(struct xe_bo *bo,
>  		goto out_unlock;
>  
>  	ofs &= ~PAGE_MASK;
> -	virtual = ttm_kmap_obj_virtual(&map, &is_iomem);
> +	src = ttm_kmap_obj_virtual(&map, &is_iomem);
> +	src += ofs;
>  	if (is_iomem)
> -		*ptr = readq((void __iomem *)(virtual + ofs));
> +		memcpy_fromio(ptr, (void __iomem *)src, size);
>  	else
> -		*ptr = *(u64 *)(virtual + ofs);
> +		memcpy(ptr, src, size);
>  
>  	ttm_bo_kunmap(&map);
>  out_unlock:
> -- 
> 2.40.1
> 

-- 
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation

  reply	other threads:[~2024-01-19  0:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-19  0:16 [PATCH v3 0/5] Fix 32bit build Lucas De Marchi
2024-01-19  0:16 ` [PATCH v3 1/5] drm/xe: Use _ULL for u64 division Lucas De Marchi
2024-01-19  0:16 ` [PATCH v3 2/5] drm/xe/mmio: Cast to u64 when printing Lucas De Marchi
2024-01-19  0:16 ` [PATCH v3 3/5] drm/xe/display: Avoid calling readq() Lucas De Marchi
2024-01-19  0:25   ` Matt Roper [this message]
2024-01-19  0:16 ` [PATCH v3 4/5] drm/xe: Fix cast on trace variable Lucas De Marchi
2024-01-19  0:16 ` [PATCH v3 5/5] drm/xe: Enable 32bits build Lucas De Marchi
2024-03-17 16:14   ` [v3,5/5] " Guenter Roeck
2024-03-18 13:28     ` Lucas De Marchi
2024-03-18 14:34       ` Guenter Roeck
2024-03-21 16:40       ` Guenter Roeck
2024-01-19  0:19 ` ✓ CI.Patch_applied: success for Fix 32bit build (rev2) Patchwork
2024-01-19  0:19 ` ✗ CI.checkpatch: warning " Patchwork
2024-01-19  0:20 ` ✓ CI.KUnit: success " Patchwork
2024-01-19  0:27 ` ✓ CI.Build: " Patchwork
2024-01-19  0:27 ` ✓ CI.Hooks: " Patchwork
2024-01-19  0:29 ` ✓ CI.checksparse: " Patchwork
2024-01-19  0:53 ` ✓ CI.BAT: " 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=20240119002513.GY45138@mdroper-desk1.amr.corp.intel.com \
    --to=matthew.d.roper@intel.com \
    --cc=intel-xe@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 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.