From mboxrd@z Thu Jan 1 00:00:00 1970 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=-15.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 9CBCBC4361B for ; Tue, 8 Dec 2020 10:04:22 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 54F38217A0 for ; Tue, 8 Dec 2020 10:04:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 54F38217A0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=isBhu8hyDs9/IC1DKgNXlgSWK5WNm6+OOD0fmT0E/Tc=; b=CSwyI+/V20TYeRxkpNsk/20OI /weXENotrB0w0NWnOpyPBiRJUXlVzgVBq1o86nUbG49nWidYtvCNqZbE2m9cIJwHAVM0q2Xve6DZ3 HtvFjWskUXD9NkorZ8iMIvL1/UqEIBoo8axKgcBPThhhfAdhmTJoSf8I5hw2rfMCD4BaAjrbOzL+s cQzDkHNLEm6ju5Ks78SXMMubf4c0e7s8PXUCjMqchqecZMD4l6vC3c/NLXLoWF1lUMm30TKqjla0d /ms93giCKr457XBuUSoisplUvP26SNxvBD/Z2Yepdfg8HYA0uc5yJpgJO1CWEG7OY0l5NcBYJHDya r9TLd11jA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmZpx-0006ba-Hv; Tue, 08 Dec 2020 10:03:13 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmZpu-0006ao-NS for linux-arm-kernel@lists.infradead.org; Tue, 08 Dec 2020 10:03:11 +0000 Date: Tue, 8 Dec 2020 10:03:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1607421790; bh=0xQQE6XjV4D2s2XwuGXUxgmwbt+HO7/Bo5g2EAfvJhc=; h=From:To:Cc:Subject:References:In-Reply-To:From; b=gLkdnqotbxUGCJnIs8rXWRDojB3UO1OdbOg8uoeSNYQ6wrFTiVjGrYB3DNRW3qBwB g4yg1nllKXgsokAtcXcx3Z84TtAVl02ZAzQQqfJpVSCSJ+Uah4jZnfUieh351d9Qxm 835OL/F2h8T1RD2/SNTdZZQivSEaEK8GI5vSfTCHaijkyYKU2/lZ79B+Pds4ViBSsE awyEluZPJgHfjxEX40NTvAngQZvEw4O4B+pvGipg2M3h8leQMmmIOyumT5aiNZ9cZV CPL1Zog6my17zGr5y/T7p7v8lbiMm777Zb8dB2yzNwOwlzaOF+jqnJZXR9JzXFkTUX Qgl0E0ngiARbA== From: Will Deacon To: Catalin Marinas Subject: Re: [PATCH] arm64: cpufeature: fix unused function warning Message-ID: <20201208100304.GA5838@willie-the-truck> References: <20201203223217.1238899-1-arnd@kernel.org> <20201204095909.GC461@willie-the-truck> <20201207181931.GE1526@gaia> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201207181931.GE1526@gaia> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201208_050310_931857_554F5361 X-CRM114-Status: GOOD ( 26.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Arnd Bergmann , Arnd Bergmann , Anshuman Khandual , Suzuki K Poulose , linux-kernel@vger.kernel.org, Kristina Martsenko , Mark Brown , Amit Daniel Kachhap , Ionela Voinescu , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Dec 07, 2020 at 06:19:31PM +0000, Catalin Marinas wrote: > On Fri, Dec 04, 2020 at 09:59:10AM +0000, Will Deacon wrote: > > On Thu, Dec 03, 2020 at 11:32:11PM +0100, Arnd Bergmann wrote: > > > From: Arnd Bergmann > > > > > > The __system_matches_cap() function is now only used in an #ifdef > > > section: > > > > > > arch/arm64/kernel/cpufeature.c:2649:13: error: unused function '__system_matches_cap' [-Werror,-Wunused-function] > > > > > > Move it into that #ifdef section. > > > > > > Fixes: 7cf283c7bd62 ("arm64: uaccess: remove redundant PAN toggling") > > > Signed-off-by: Arnd Bergmann > > I already queued a fix from Mark: 701f49065e68 ("arm64: mark > __system_matches_cap as __maybe_unused"). > > > Acked-by: Will Deacon > > > > We can probably go further and remove the helper altogether as I don't > > think it really helps has_generic_auth(), but this should fix the warning. > > We could replace the ARM64_HAS_GENERIC_AUTH checks with a single helper > function that tests for ARM64_HAS_GENERIC_AUTH_ARCH or > ARM64_HAS_GENERIC_AUTH_IMP_DEF. Or you had a different idea? I was just thinking something like below, although it's a bit annoying that we can't use cpucap_multi_entry_cap_matches() here afaict. Will --->8 diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 39138f6d3ba2..32a138ce0a92 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -155,8 +155,6 @@ EXPORT_SYMBOL(cpu_hwcap_keys); static void cpu_enable_cnp(struct arm64_cpu_capabilities const *cap); -static bool __system_matches_cap(unsigned int n); - /* * NOTE: Any changes to the visibility of features should be kept in * sync with the documentation of the CPU feature register ABI. @@ -1652,8 +1650,13 @@ static bool has_address_auth_metacap(const struct arm64_cpu_capabilities *entry, static bool has_generic_auth(const struct arm64_cpu_capabilities *entry, int __unused) { - return __system_matches_cap(ARM64_HAS_GENERIC_AUTH_ARCH) || - __system_matches_cap(ARM64_HAS_GENERIC_AUTH_IMP_DEF); + const struct arm64_cpu_capabilities *cap_arch, *cap_impdef; + + cap_arch = cpu_hwcaps_ptrs[ARM64_HAS_GENERIC_AUTH_ARCH]; + cap_impdef = cpu_hwcaps_ptrs[ARM64_HAS_GENERIC_AUTH_IMP_DEF]; + + return cap_arch->matches(cap_arch, SCOPE_SYSTEM) || + cap_impdef->matches(cap_impdef, SCOPE_SYSTEM); } #endif /* CONFIG_ARM64_PTR_AUTH */ @@ -2637,23 +2640,6 @@ bool this_cpu_has_cap(unsigned int n) return false; } -/* - * This helper function is used in a narrow window when, - * - The system wide safe registers are set with all the SMP CPUs and, - * - The SYSTEM_FEATURE cpu_hwcaps may not have been set. - * In all other cases cpus_have_{const_}cap() should be used. - */ -static bool __maybe_unused __system_matches_cap(unsigned int n) -{ - if (n < ARM64_NCAPS) { - const struct arm64_cpu_capabilities *cap = cpu_hwcaps_ptrs[n]; - - if (cap) - return cap->matches(cap, SCOPE_SYSTEM); - } - return false; -} - void cpu_set_feature(unsigned int num) { WARN_ON(num >= MAX_CPU_FEATURES); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel