From patchwork Fri Aug 6 08:15:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 493694 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3DF4C432BE for ; Fri, 6 Aug 2021 08:17:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C3DAF61209 for ; Fri, 6 Aug 2021 08:17:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239712AbhHFIR4 (ORCPT ); Fri, 6 Aug 2021 04:17:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:46622 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243950AbhHFIQW (ORCPT ); Fri, 6 Aug 2021 04:16:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E8E5261131; Fri, 6 Aug 2021 08:16:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1628237766; bh=PJ6/zxTC8Mn7GwXEaqQrv+z0feG7G9QlJpaZhGP4T6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eC3I84weJaKG63tZoVzo0WAtJhc9p+NcS1+37DWGgan3rbEiJ0kZxlPvK3YPCzmrv ixXMi7UBj96Q+9mJQQ1ipJXWt8ex5oXkQOB67/T0xNfnsgCfytQCCToBySlTyjfKhB NGmb8yn84k8wBYRhFNgGnNP3tuxTfq3d/XpoFhx4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Boyd , Chris Wilson , Nathan Chancellor , Nick Desaulniers , Jani Nikula Subject: [PATCH 4.19 12/16] drm/i915: Ensure intel_engine_init_execlist() builds with Clang Date: Fri, 6 Aug 2021 10:15:03 +0200 Message-Id: <20210806081111.537230464@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210806081111.144943357@linuxfoundation.org> References: <20210806081111.144943357@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jani Nikula 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 Cc: Stephen Boyd Cc: Chris Wilson Tested-by: Nathan Chancellor Tested-by: Stephen Boyd Reviewed-by: Chris Wilson Reviewed-by: Nick Desaulniers Signed-off-by: Jani Nikula Link: https://patchwork.freedesktop.org/patch/msgid/20181016122938.18757-2-jani.nikula@intel.com Signed-off-by: Greg Kroah-Hartman --- 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;