Quoting Tvrtko Ursulin (2017-10-31 10:23:25) > From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> > > We have to reject unknown flags for uAPI considerations, and also > because the curent implementation limits their i915 storage space > to two bits. > > v2: (Chris Wilson) > * Fix fail in ABI check. > * Added unknown flags and BUILD_BUG_ON. > > v3: > * Use ARCH_KMALLOC_MINALIGN instead of alignof. (Chris Wilson) > > Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> > Fixes: cf6e7bac6357 ("drm/i915: Add support for drm syncobjs") > Cc: Jason Ekstrand <jason@xxxxxxxxxxxxxx> > Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> > Cc: Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx> > Cc: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx> > Cc: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx> > Cc: David Airlie <airlied@xxxxxxxx> > Cc: intel-gfx@xxxxxxxxxxxxxxxxxxxxx > Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx > --- > drivers/gpu/drm/i915/i915_gem_execbuffer.c | 8 ++++++++ > include/uapi/drm/i915_drm.h | 1 + > 2 files changed, 9 insertions(+) > > diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c > index 3d7190764f10..a53be7d01055 100644 > --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c > +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c > @@ -2100,6 +2100,11 @@ get_fence_array(struct drm_i915_gem_execbuffer2 *args, > goto err; > } > > + if (fence.flags & __I915_EXEC_FENCE_UNKNOWN_FLAGS) { > + err = -EINVAL; > + goto err; > + } > + > syncobj = drm_syncobj_find(file, fence.handle); > if (!syncobj) { > DRM_DEBUG("Invalid syncobj handle provided\n"); > @@ -2107,6 +2112,9 @@ get_fence_array(struct drm_i915_gem_execbuffer2 *args, > goto err; > } > > + BUILD_BUG_ON(~(ARCH_KMALLOC_MINALIGN - 1) & > + ~__I915_EXEC_FENCE_UNKNOWN_FLAGS); > + > fences[n] = ptr_pack_bits(syncobj, fence.flags, 2); Was pondering how to tie the .n=2 into the BUILD_BUG_ON, but that doesn't limit the improvement and fixes in this patch, so Reviewed-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> -Chris _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel