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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,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 2A19BC2BB85 for ; Tue, 14 Apr 2020 05:32:31 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 E5113206E9 for ; Tue, 14 Apr 2020 05:32:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tbE55AaX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E5113206E9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=bHejWfr2AwJ8i9q0thGo/7YOIVsVisi7nxF93+M9fnY=; b=tbE55AaXnwV5xsidq7ItgzoNi1 2kjavRjGIeVRR45AJ4tLmAUYMogsHnllJCUaEKO9W08NrgFmYbJmHAsPPHrlwdfPbBOVuYwLFqbFw NSVKikiTJL8NoWseMqzkabAcCQXijhBPd/8+MbOTIi2DsvGQkM6s5vIXgKytDDvuBesSZDyoMNBc4 5LI5UtoluueDry+Wm+WDJb+hMAOJjyXDK/nEXhwhOclnQf9Ysmi/r+n6ENpsUXqCl3dvXgr5u+5UK 2I47aqdp9oFPhzjwew7BMUAZ+MxprhR1XruRo0RnvwBYBulOm49uZEGnWWaxDXM3RNSBi+8kNUDub 887glu7Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jOEBS-0001ZX-H2; Tue, 14 Apr 2020 05:32:30 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jOEBC-0001Mf-Vk for linux-arm-kernel@lists.infradead.org; Tue, 14 Apr 2020 05:32:16 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2A8B131B; Mon, 13 Apr 2020 22:32:13 -0700 (PDT) Received: from a075553-lin.blr.arm.com (a075553-lin.blr.arm.com [10.162.17.24]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0D8C73F68F; Mon, 13 Apr 2020 22:36:24 -0700 (PDT) From: Amit Daniel Kachhap To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 1/4] arm64: cpufeature: Extract meta-capability scope from list Date: Tue, 14 Apr 2020 11:01:51 +0530 Message-Id: <1586842314-19527-2-git-send-email-amit.kachhap@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1586842314-19527-1-git-send-email-amit.kachhap@arm.com> References: <1586842314-19527-1-git-send-email-amit.kachhap@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200413_223215_116319_4EBB8163 X-CRM114-Status: GOOD ( 14.44 ) 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 , Kees Cook , Suzuki K Poulose , Catalin Marinas , Kristina Martsenko , Mark Brown , James Morse , Amit Daniel Kachhap , Vincenzo Frascino , Will Deacon , Dave Martin MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org This fixes the earlier commit 3ff047f6971d3c ("arm64: cpufeature: Fix meta-capability cpufeature check"). This patch was added to fix the dependency of individual meta-cpucaps checks on the array entry order. This dependency was specifically added for cpufeature of system scope. However this dependency can occur for cpufeature of boot scope such as ARM64_HAS_ADDRESS_AUTH so this patch renames the helper function __system_matches_cap to __cpufeature_matches_cap and invokes the match handler with the scope fetched from the cpufeatures array list. Fixes: 3ff047f6971d3c ("arm64: cpufeature: Fix meta-capability cpufeature check") Signed-off-by: Amit Daniel Kachhap --- arch/arm64/kernel/cpufeature.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 9fac745aa7bb..08795025409c 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -116,7 +116,7 @@ cpufeature_pan_not_uao(const struct arm64_cpu_capabilities *entry, int __unused) static void cpu_enable_cnp(struct arm64_cpu_capabilities const *cap); -static bool __system_matches_cap(unsigned int n); +static bool __cpufeature_matches_cap(unsigned int n); /* * NOTE: Any changes to the visibility of features should be kept in @@ -1373,15 +1373,15 @@ static void cpu_clear_disr(const struct arm64_cpu_capabilities *__unused) static bool has_address_auth(const struct arm64_cpu_capabilities *entry, int __unused) { - return __system_matches_cap(ARM64_HAS_ADDRESS_AUTH_ARCH) || - __system_matches_cap(ARM64_HAS_ADDRESS_AUTH_IMP_DEF); + return __cpufeature_matches_cap(ARM64_HAS_ADDRESS_AUTH_ARCH) || + __cpufeature_matches_cap(ARM64_HAS_ADDRESS_AUTH_IMP_DEF); } 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); + return __cpufeature_matches_cap(ARM64_HAS_GENERIC_AUTH_ARCH) || + __cpufeature_matches_cap(ARM64_HAS_GENERIC_AUTH_IMP_DEF); } #endif /* CONFIG_ARM64_PTR_AUTH */ @@ -2251,16 +2251,16 @@ bool this_cpu_has_cap(unsigned int n) /* * 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. + * - The cpu_hwcaps may not have been set. * In all other cases cpus_have_{const_}cap() should be used. */ -static bool __system_matches_cap(unsigned int n) +static bool __cpufeature_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 cap->matches(cap, cpucap_default_scope(cap)); } return false; } @@ -2337,7 +2337,7 @@ void __init setup_cpu_features(void) static bool __maybe_unused cpufeature_pan_not_uao(const struct arm64_cpu_capabilities *entry, int __unused) { - return (__system_matches_cap(ARM64_HAS_PAN) && !__system_matches_cap(ARM64_HAS_UAO)); + return (__cpufeature_matches_cap(ARM64_HAS_PAN) && !__cpufeature_matches_cap(ARM64_HAS_UAO)); } static void __maybe_unused cpu_enable_cnp(struct arm64_cpu_capabilities const *cap) -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel