@@ -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_bo_driver_verify_access(struct ttm_buffer_object *bo,
+ struct file *filp);
#endif
@@ -34,3 +34,25 @@ int drm_gem_ttm_bo_device_init(struct drm_device *dev,
need_dma32);
}
EXPORT_SYMBOL(drm_gem_ttm_bo_device_init);
+
+/**
+ * drm_gem_ttm_bo_driver_verify_access() - \
+ Implements &struct ttm_bo_driver.verify_access
+ * @bo: TTM buffer object.
+ * @filp: File pointer.
+ *
+ * This function assumes filp->private_data refers to the
+ * corresponding &struct drm_file.
+ *
+ * Returns:
+ * 0 on success, or
+ * a negative errno code otherwise.
+ */
+int drm_gem_ttm_bo_driver_verify_access(struct ttm_buffer_object *bo,
+ struct file *filp)
+{
+ struct drm_file *ptr = filp->private_data;
+
+ return drm_vma_node_verify_access(&bo->base.vma_node, ptr);
+}
+EXPORT_SYMBOL(drm_gem_ttm_bo_driver_verify_access);
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- include/drm/drm_gem_ttm_helper.h | 2 ++ drivers/gpu/drm/drm_gem_ttm_helper.c | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+)