@@ -26,5 +26,7 @@ int drm_gem_ttm_bo_device_init(struct drm_device *dev,
struct ttm_bo_device *bdev,
struct ttm_bo_driver *driver,
bool need_dma32);
+int drm_gem_ttm_mmap(struct drm_gem_object *gem,
+ struct vm_area_struct *vma);
#endif
@@ -34,3 +34,14 @@ int drm_gem_ttm_bo_device_init(struct drm_device *dev,
need_dma32);
}
EXPORT_SYMBOL(drm_gem_ttm_bo_device_init);
+
+int drm_gem_ttm_mmap(struct drm_gem_object *gem,
+ struct vm_area_struct *vma)
+{
+ struct ttm_buffer_object *bo = drm_gem_ttm_of_gem(gem);
+
+ ttm_bo_get(bo);
+ ttm_bo_mmap_vma_setup(bo, vma);
+ return 0;
+}
+EXPORT_SYMBOL(drm_gem_ttm_mmap);
Add helper function to mmap ttm bo's via drm_gem_object_funcs->mmap(). Note that with this code path access verification is done by drm_gem_mmap() and ttm_bo_driver.verify_access() is not used. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- include/drm/drm_gem_ttm_helper.h | 2 ++ drivers/gpu/drm/drm_gem_ttm_helper.c | 11 +++++++++++ 2 files changed, 13 insertions(+)