diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-08-10 01:29:08 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-08-11 08:15:02 -0400 |
commit | ad19f10bc2a5964f1564639e60953de76b7e50f6 (patch) | |
tree | ad8abe76913882f6b6b46d4e36153425ddd6db81 /drivers/gpu/drm/i915/i915_gem_execbuffer.c | |
parent | da51a1e7e398129d9fddd4b26b8469145dd4fd08 (diff) |
drm/i915: Pre-validate the NEED_GTTS flag for execbuffer
We have an implementation requirement that precludes the user from
requesting a ggtt entry when the device is operating in ppgtt mode. Move
the current check from inside the execbuffer object collation to the
prevalidation phase.
v2: Roll both invalid flags checks into one
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem_execbuffer.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_execbuffer.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index e1eac15b2583..446f4b6fbefe 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | |||
@@ -130,12 +130,6 @@ eb_lookup_vmas(struct eb_vmas *eb, | |||
130 | while (!list_empty(&objects)) { | 130 | while (!list_empty(&objects)) { |
131 | struct i915_vma *vma; | 131 | struct i915_vma *vma; |
132 | 132 | ||
133 | if (exec[i].flags & EXEC_OBJECT_NEEDS_GTT && | ||
134 | USES_FULL_PPGTT(vm->dev)) { | ||
135 | ret = -EINVAL; | ||
136 | goto err; | ||
137 | } | ||
138 | |||
139 | obj = list_first_entry(&objects, | 133 | obj = list_first_entry(&objects, |
140 | struct drm_i915_gem_object, | 134 | struct drm_i915_gem_object, |
141 | obj_exec_link); | 135 | obj_exec_link); |
@@ -877,18 +871,24 @@ i915_gem_check_execbuffer(struct drm_i915_gem_execbuffer2 *exec) | |||
877 | } | 871 | } |
878 | 872 | ||
879 | static int | 873 | static int |
880 | validate_exec_list(struct drm_i915_gem_exec_object2 *exec, | 874 | validate_exec_list(struct drm_device *dev, |
875 | struct drm_i915_gem_exec_object2 *exec, | ||
881 | int count) | 876 | int count) |
882 | { | 877 | { |
883 | int i; | ||
884 | unsigned relocs_total = 0; | 878 | unsigned relocs_total = 0; |
885 | unsigned relocs_max = UINT_MAX / sizeof(struct drm_i915_gem_relocation_entry); | 879 | unsigned relocs_max = UINT_MAX / sizeof(struct drm_i915_gem_relocation_entry); |
880 | unsigned invalid_flags; | ||
881 | int i; | ||
882 | |||
883 | invalid_flags = __EXEC_OBJECT_UNKNOWN_FLAGS; | ||
884 | if (USES_FULL_PPGTT(dev)) | ||
885 | invalid_flags |= EXEC_OBJECT_NEEDS_GTT; | ||
886 | 886 | ||
887 | for (i = 0; i < count; i++) { | 887 | for (i = 0; i < count; i++) { |
888 | char __user *ptr = to_user_ptr(exec[i].relocs_ptr); | 888 | char __user *ptr = to_user_ptr(exec[i].relocs_ptr); |
889 | int length; /* limited by fault_in_pages_readable() */ | 889 | int length; /* limited by fault_in_pages_readable() */ |
890 | 890 | ||
891 | if (exec[i].flags & __EXEC_OBJECT_UNKNOWN_FLAGS) | 891 | if (exec[i].flags & invalid_flags) |
892 | return -EINVAL; | 892 | return -EINVAL; |
893 | 893 | ||
894 | /* First check for malicious input causing overflow in | 894 | /* First check for malicious input causing overflow in |
@@ -1250,7 +1250,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, | |||
1250 | if (!i915_gem_check_execbuffer(args)) | 1250 | if (!i915_gem_check_execbuffer(args)) |
1251 | return -EINVAL; | 1251 | return -EINVAL; |
1252 | 1252 | ||
1253 | ret = validate_exec_list(exec, args->buffer_count); | 1253 | ret = validate_exec_list(dev, exec, args->buffer_count); |
1254 | if (ret) | 1254 | if (ret) |
1255 | return ret; | 1255 | return ret; |
1256 | 1256 | ||