1 /* SPDX-License-Identifier: MIT */
3 * Copyright © 2022 Intel Corporation
6 #ifndef _I915_GEM_OBJECT_H_
7 #define _I915_GEM_OBJECT_H_
9 #include <linux/types.h>
13 #define i915_gem_object_is_shmem(obj) (0) /* We don't use shmem */
15 static inline dma_addr_t i915_gem_object_get_dma_address(const struct xe_bo *bo, pgoff_t n)
17 /* Should never be called */
22 static inline bool i915_gem_object_is_tiled(const struct xe_bo *bo)
24 /* legacy tiling is unused */
28 static inline bool i915_gem_object_is_userptr(const struct xe_bo *bo)
30 /* legacy tiling is unused */
34 static inline int i915_gem_object_read_from_page(struct xe_bo *bo,
35 u32 ofs, u64 *ptr, u32 size)
37 struct ttm_bo_kmap_obj map;
42 ret = xe_bo_lock(bo, true);
46 ret = ttm_bo_kmap(&bo->ttm, ofs >> PAGE_SHIFT, 1, &map);
51 src = ttm_kmap_obj_virtual(&map, &is_iomem);
54 memcpy_fromio(ptr, (void __iomem *)src, size);
56 memcpy(ptr, src, size);