On Thu, Oct 24, 2019 at 02:18:59PM -0500, Rob Herring wrote: > Commit c40069cb7bd6 ("drm: add mmap() to drm_gem_object_funcs") > introduced a GEM object mmap() hook which is expected to subtract the > fake offset from vm_pgoff. However, for mmap() on dmabufs, there is not > a fake offset. > > To fix this, let's always call mmap() object callback with an offset of 0, > and leave it up to drm_gem_mmap_obj() to remove the fake offset. > > TTM still needs the fake offset, so we have to add it back until that's > fixed. Fixing ttm looks easy, there are not many calls to drm_vma_node_start() the ttm code. Can look into this when I'm back from kvm forum @ lyon. > int ttm_bo_mmap_obj(struct vm_area_struct *vma, struct ttm_buffer_object *bo) > { > ttm_bo_get(bo); > + > + /* > + * FIXME: &drm_gem_object_funcs.mmap is called with the fake offset > + * removed. Add it back here until the rest of TTM works without it. > + */ > + vma->vm_pgoff += drm_vma_node_start(&bo->base.vma_node); > + > ttm_bo_mmap_vma_setup(bo, vma); > return 0; > } Yes, that should keep ttm happy for now. Survived a quick smoke test with qemu and bochs. Acked-by: Gerd Hoffmann <kraxel@xxxxxxxxxx> cheers, Gerd _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel