drm/i915/userptr: Probe existence of backing struct pages upon creation
[linux-2.6-microblaze.git] / include / uapi / drm / i915_drm.h
index 7f13d24..bde5860 100644 (file)
@@ -683,6 +683,9 @@ typedef struct drm_i915_irq_wait {
  */
 #define I915_PARAM_HAS_EXEC_TIMELINE_FENCES 55
 
+/* Query if the kernel supports the I915_USERPTR_PROBE flag. */
+#define I915_PARAM_HAS_USERPTR_PROBE 56
+
 /* Must be kept compact -- no holes and well documented */
 
 typedef struct drm_i915_getparam {
@@ -2231,12 +2234,29 @@ struct drm_i915_gem_userptr {
         * through the GTT. If the HW can't support readonly access, an error is
         * returned.
         *
+        * I915_USERPTR_PROBE:
+        *
+        * Probe the provided @user_ptr range and validate that the @user_ptr is
+        * indeed pointing to normal memory and that the range is also valid.
+        * For example if some garbage address is given to the kernel, then this
+        * should complain.
+        *
+        * Returns -EFAULT if the probe failed.
+        *
+        * Note that this doesn't populate the backing pages, and also doesn't
+        * guarantee that the object will remain valid when the object is
+        * eventually used.
+        *
+        * The kernel supports this feature if I915_PARAM_HAS_USERPTR_PROBE
+        * returns a non-zero value.
+        *
         * I915_USERPTR_UNSYNCHRONIZED:
         *
         * NOT USED. Setting this flag will result in an error.
         */
        __u32 flags;
 #define I915_USERPTR_READ_ONLY 0x1
+#define I915_USERPTR_PROBE 0x2
 #define I915_USERPTR_UNSYNCHRONIZED 0x80000000
        /**
         * @handle: Returned handle for the object.