The current implementation of i915 prime mmap only worked when initializing drm_i915_gem_object with shmem_region. When using LMEM, drm_i915_gem_object is initialized with ttm_system_region. In order to make prime mmap work even this case, when using LMEM (when using ttm in i915), dma_buf_ops.mmap callback calls drm_gem_prime_mmap(). drm_gem_prime_mmap() of drm core calls internally i915_gem_mmap() so that prime mmap can perform normally. The fake offset is processed inside drm_gem_prime_mmap(). Testcase: igt/prime_mmap This patch makes all of igt/prime_mmap tests success on gpus which use LMEM. And these series remove defining and using a duplicate function: i915_gem_unmap_dma_buf() After landing this patch. I'm going to send refactoring rfc patches that handles the drm_driver.gem_prime_mmap callback, drm_gem_object_funcs.mmap callback and drm_gem_object_funcs.vm_ops calllback. ref: https://01.org/linuxgraphics/gfx-docs/drm/gpu/todo.html?#clean-up-mmap-forwarding https://www.kernel.org/doc/html/latest/gpu/todo.html#struct-drm-gem-object-funcs Gwan-gyeong Mun (2): drm/i915/dmabuf: Update dma_buf_ops.unmap_dma_buf callback to use drm_gem_unmap_dma_buf() drm/i915/dmabuf: Fix prime_mmap to work when using LMEM drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) -- 2.34.1