Skip to content

Commit 981460d

Browse files
lucasdemarchiThomas Hellström
authored andcommitted
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: 44e6949 ("drm/xe/display: Implement display support") Signed-off-by: Lucas De Marchi <[email protected]> Reviewed-by: Matt Roper <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 406663f) Signed-off-by: Thomas Hellström <[email protected]>
1 parent 52e8948 commit 981460d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,10 @@ static inline int i915_gem_object_read_from_page(struct xe_bo *bo,
3535
u32 ofs, u64 *ptr, u32 size)
3636
{
3737
struct ttm_bo_kmap_obj map;
38-
void *virtual;
38+
void *src;
3939
bool is_iomem;
4040
int ret;
4141

42-
XE_WARN_ON(size != 8);
43-
4442
ret = xe_bo_lock(bo, true);
4543
if (ret)
4644
return ret;
@@ -50,11 +48,12 @@ static inline int i915_gem_object_read_from_page(struct xe_bo *bo,
5048
goto out_unlock;
5149

5250
ofs &= ~PAGE_MASK;
53-
virtual = ttm_kmap_obj_virtual(&map, &is_iomem);
51+
src = ttm_kmap_obj_virtual(&map, &is_iomem);
52+
src += ofs;
5453
if (is_iomem)
55-
*ptr = readq((void __iomem *)(virtual + ofs));
54+
memcpy_fromio(ptr, (void __iomem *)src, size);
5655
else
57-
*ptr = *(u64 *)(virtual + ofs);
56+
memcpy(ptr, src, size);
5857

5958
ttm_bo_kunmap(&map);
6059
out_unlock:

0 commit comments

Comments
 (0)