Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F984C6379F for ; Fri, 17 Feb 2023 16:17:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230495AbjBQQRT (ORCPT ); Fri, 17 Feb 2023 11:17:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229700AbjBQQRR (ORCPT ); Fri, 17 Feb 2023 11:17:17 -0500 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BC195FC54 for ; Fri, 17 Feb 2023 08:16:45 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 576075C004F; Fri, 17 Feb 2023 11:15:33 -0500 (EST) Received: from imap51 ([10.202.2.101]) by compute6.internal (MEProxy); Fri, 17 Feb 2023 11:15:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; t=1676650533; x=1676736933; bh=tleUz3zIP8 QkFyed9TDh0JqE4e6vPHKfXik/Tpa7P2A=; b=Iwad271NcLWSK/mSbAeplkyueM AIRurVdo4aMWp4R3HsReutyJ+uhd/1LoUeBfcNSPfpmuDjOcNlrMdXrhduE//szT LtGXHiTQw41sazpZc4vW3YJ/q3isQ9S480h/vEMoYlXHEbJ46S4rnnRDalHYhAAh pTFa51xkyt2FeAVVTT/BfMBCdRMKVppXjqnWcLbO7yvThZXLd7WnJEz/VBtgotUr tBIWwy6fr0G/eluf5oHK5vRAJf+ibwl25xf7veLOYLVjnMm1m980ZfSFLwXoR5Ad cK6HQXlw61Q4XeLPgkAhKQTomPEvSqWBMuf8wgwI1F3NqKIQmEGTPyTy2Hcg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1676650533; x=1676736933; bh=tleUz3zIP8QkFyed9TDh0JqE4e6v PHKfXik/Tpa7P2A=; b=hbIbBfXPNzBtvk5bc5ylnttncvE8EukoQnTmWDr5tLSB VE49C6JVVQ16V3ExFn+CcSEmN8WO3idKgvF0txCBn/U6E+PASSfgyWZ2BoaIGipe Yadf3L5T8Yo/HW0HCFXW8vBoF6ZIY7bHJzrLbn+DFaV83TFujI6vp9FTPTUiXptK xG2rxdquimRGSy8nN3O14nClHJOi3NSnjWYdBKUU2+JZWEgzVoLNr6q6dLuAQ/I4 Epdbb1JWRhgr2TU+IQKhdoCH/mOFLsQW9Rl9rRXA7K3/84/e3r6rRcXcoXS3o6Of EQ+3MFNm7XP1Xyqvk/cMqhXOyOfGjvaU9g5O32EYWw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudeiledgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepffehueegteeihfegtefhjefgtdeugfegjeelheejueethfefgeeghfektdek teffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id E246DB60086; Fri, 17 Feb 2023 11:15:32 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-156-g081acc5ed5-fm-20230206.001-g081acc5e Mime-Version: 1.0 Message-Id: In-Reply-To: References: <20230217124724.1324126-1-arnd@kernel.org> Date: Fri, 17 Feb 2023 17:15:14 +0100 From: "Arnd Bergmann" To: "Andrzej Hajda" , "Arnd Bergmann" , "Jani Nikula" , "Joonas Lahtinen" , "Rodrigo Vivi" , "Tvrtko Ursulin" , "Dave Airlie" , "Daniel Vetter" , "Matthew Brost" , "John Harrison" , "Michal Wajdeczko" Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [Intel-gfx] [PATCH] drm/i915/guc: avoid FIELD_PREP warning Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 17, 2023, at 16:38, Andrzej Hajda wrote: > On 17.02.2023 13:46, Arnd Bergmann wrote: >> From: Arnd Bergmann >> >> With gcc-7 and earlier, there are lots of warnings like >> >> In file included from :0:0: >> In function '__guc_context_policy_add_priority.isra.66', >> inlined from '__guc_context_set_prio.isra.67' at drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:3292:3, >> inlined from 'guc_context_set_prio' at drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:3320:2: >> include/linux/compiler_types.h:399:38: error: call to '__compiletime_assert_631' declared with attribute error: FIELD_PREP: mask is not constant >> _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) >> ^ >> ... >> drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:2422:3: note: in expansion of macro 'FIELD_PREP' >> FIELD_PREP(GUC_KLV_0_KEY, GUC_CONTEXT_POLICIES_KLV_ID_##id) | \ >> ^~~~~~~~~~ >> >> Make sure that GUC_KLV_0_KEY is an unsigned value to avoid the warning. > > Does it mean __builtin_constant_p in gcc7 returns 0 on signed constants? > I guess there should be more similar errors. No, it's not as simple as that, I'm not really sure what the underlying problem is with the compiler, and this is the only file that triggered this particular warning. There are other cases where old compilers had the reverse problem, where they sometimes report a variable to be __builtin_constant_p()==true if there is a branch that assigns a constant to it. I think here it happens because GUC_KLV_0_KEY and GUC_KLV_n_VALUE are negative. Arnd