[PATCH v3 6/8] drm/ttm: add drm_gem_ttm_bo_driver_verify_access()
Gerd Hoffmann
kraxel at redhat.com
Thu Aug 8 09:37:00 UTC 2019
Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
---
include/drm/drm_gem_ttm_helper.h | 2 ++
drivers/gpu/drm/drm_gem_ttm_helper.c | 22 ++++++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/include/drm/drm_gem_ttm_helper.h b/include/drm/drm_gem_ttm_helper.h
index 43c9db3583cc..78e4d8930fec 100644
--- a/include/drm/drm_gem_ttm_helper.h
+++ b/include/drm/drm_gem_ttm_helper.h
@@ -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
diff --git a/drivers/gpu/drm/drm_gem_ttm_helper.c b/drivers/gpu/drm/drm_gem_ttm_helper.c
index 0c57e9fd50b9..159768c7ec63 100644
--- a/drivers/gpu/drm/drm_gem_ttm_helper.c
+++ b/drivers/gpu/drm/drm_gem_ttm_helper.c
@@ -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);
--
2.18.1
More information about the dri-devel
mailing list