Commit 981460d8 authored by Lucas De Marchi's avatar Lucas De Marchi Committed by Thomas Hellström

drm/xe/display: Avoid calling readq()

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: 44e69495 ("drm/xe/display: Implement display support")
Signed-off-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240119001612.2991381-4-lucas.demarchi@intel.com
(cherry picked from commit 406663f7)
Signed-off-by: default avatarThomas Hellström <thomas.hellstrom@linux.intel.com>
parent 52e8948c
...@@ -35,12 +35,10 @@ static inline int i915_gem_object_read_from_page(struct xe_bo *bo, ...@@ -35,12 +35,10 @@ static inline int i915_gem_object_read_from_page(struct xe_bo *bo,
u32 ofs, u64 *ptr, u32 size) u32 ofs, u64 *ptr, u32 size)
{ {
struct ttm_bo_kmap_obj map; struct ttm_bo_kmap_obj map;
void *virtual; void *src;
bool is_iomem; bool is_iomem;
int ret; int ret;
XE_WARN_ON(size != 8);
ret = xe_bo_lock(bo, true); ret = xe_bo_lock(bo, true);
if (ret) if (ret)
return ret; return ret;
...@@ -50,11 +48,12 @@ static inline int i915_gem_object_read_from_page(struct xe_bo *bo, ...@@ -50,11 +48,12 @@ static inline int i915_gem_object_read_from_page(struct xe_bo *bo,
goto out_unlock; goto out_unlock;
ofs &= ~PAGE_MASK; ofs &= ~PAGE_MASK;
virtual = ttm_kmap_obj_virtual(&map, &is_iomem); src = ttm_kmap_obj_virtual(&map, &is_iomem);
src += ofs;
if (is_iomem) if (is_iomem)
*ptr = readq((void __iomem *)(virtual + ofs)); memcpy_fromio(ptr, (void __iomem *)src, size);
else else
*ptr = *(u64 *)(virtual + ofs); memcpy(ptr, src, size);
ttm_bo_kunmap(&map); ttm_bo_kunmap(&map);
out_unlock: out_unlock:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment