drm/i915: Ensure intel_engine_init_execlist() builds with Clang
authorJani Nikula <jani.nikula@intel.com>
Tue, 16 Oct 2018 12:29:38 +0000 (15:29 +0300)
committerJani Nikula <jani.nikula@intel.com>
Wed, 17 Oct 2018 06:56:56 +0000 (09:56 +0300)
commit410ed5731a6566498a3aa904420aa2e49ba0ba90
tree87086435afa0e4c0aed19ac6de52ea4bd9482957
parent7b3e51dd439bead71d9e4504d89a32a8496ac0aa
drm/i915: Ensure intel_engine_init_execlist() builds with Clang

Clang build with UBSAN enabled leads to the following build error:

drivers/gpu/drm/i915/intel_engine_cs.o: In function `intel_engine_init_execlist':
drivers/gpu/drm/i915/intel_engine_cs.c:411: undefined reference to `__compiletime_assert_411'

Again, for this to work the code would first need to be inlined and then
constant folded, which doesn't work for Clang because semantic analysis
happens before optimization/inlining.

Use GEM_BUG_ON() instead of BUILD_BUG_ON().

v2: Use is_power_of_2() from log2.h (Chris)

References: http://mid.mail-archive.com/20181015203410.155997-1-swboyd@chromium.org
Reported-by: Stephen Boyd <swboyd@chromium.org>
Cc: Stephen Boyd <swboyd@chromium.org>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>
Tested-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181016122938.18757-2-jani.nikula@intel.com
drivers/gpu/drm/i915/intel_engine_cs.c