[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210806081111.537230464@linuxfoundation.org>
Date: Fri, 6 Aug 2021 10:15:03 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Stephen Boyd <swboyd@...omium.org>,
Chris Wilson <chris@...is-wilson.co.uk>,
Nathan Chancellor <natechancellor@...il.com>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Jani Nikula <jani.nikula@...el.com>
Subject: [PATCH 4.19 12/16] drm/i915: Ensure intel_engine_init_execlist() builds with Clang
From: Jani Nikula <jani.nikula@...el.com>
commit 410ed5731a6566498a3aa904420aa2e49ba0ba90 upstream.
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)
Reported-by: Stephen Boyd <swboyd@...omium.org>
Cc: Stephen Boyd <swboyd@...omium.org>
Cc: Chris Wilson <chris@...is-wilson.co.uk>
Tested-by: Nathan Chancellor <natechancellor@...il.com>
Tested-by: Stephen Boyd <swboyd@...omium.org>
Reviewed-by: Chris Wilson <chris@...is-wilson.co.uk>
Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>
Signed-off-by: Jani Nikula <jani.nikula@...el.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181016122938.18757-2-jani.nikula@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/gpu/drm/i915/intel_engine_cs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/gpu/drm/i915/intel_engine_cs.c
+++ b/drivers/gpu/drm/i915/intel_engine_cs.c
@@ -463,7 +463,7 @@ static void intel_engine_init_execlist(s
struct intel_engine_execlists * const execlists = &engine->execlists;
execlists->port_mask = 1;
- BUILD_BUG_ON_NOT_POWER_OF_2(execlists_num_ports(execlists));
+ GEM_BUG_ON(!is_power_of_2(execlists_num_ports(execlists)));
GEM_BUG_ON(execlists_num_ports(execlists) > EXECLIST_MAX_PORTS);
execlists->queue_priority = INT_MIN;
Powered by blists - more mailing lists