From patchwork Thu Apr 11 06:48:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liao, Chang" X-Patchwork-Id: 13625480 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 2D625CD1292 for ; Thu, 11 Apr 2024 06:56:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iq8kpX23OwHlBfMrm7+pWJ8RAZ4DZr/0s6IzA/qE4Sk=; b=ICTB/9yoMRg6Hb 0sp0moIjtfIKXR79G1qacHE7XOz6L3h1lK0uMNjBsgGFFdD9PXRmgSWsR6Tdwv0519DK0SJ3RhIHR e7SYrrzKFsRgcVN3gulfgzDeSqzSKNFa/a0m/sfP8LfEPzkXERdu+P8ZryM5B4iUV4X37BljrW73A K5B/X1lKZP96jSRCdQRB+Pur7rdVzxU3pBGZQCWsE5NDRrY90i56NySIcPvBUWaNjY5gfU9BXpDcv zLdCzbboWeCGy85I3VD0LZVgELzuyjIfsstPzyAYEzochD1cQtImFqLfrMsoX/TIbEyXaHbowuP9K TTolsK7gePW3RrjbYtmA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruoLv-0000000Ah0t-3o38; Thu, 11 Apr 2024 06:56:07 +0000 Received: from szxga04-in.huawei.com ([45.249.212.190]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruoLH-0000000AgY3-0kKA for linux-arm-kernel@lists.infradead.org; Thu, 11 Apr 2024 06:55:31 +0000 Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4VFVl35Sj3z1yn1g; Thu, 11 Apr 2024 14:53:03 +0800 (CST) Received: from kwepemd200013.china.huawei.com (unknown [7.221.188.133]) by mail.maildlp.com (Postfix) with ESMTPS id 550DF14013B; Thu, 11 Apr 2024 14:55:20 +0800 (CST) Received: from huawei.com (10.67.174.28) by kwepemd200013.china.huawei.com (7.221.188.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Thu, 11 Apr 2024 14:55:18 +0800 From: Liao Chang To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: , , Subject: [PATCH v2 5/9] arm64/cpufeature: Use alternatives to check enabled ARM64_HAS_NMI feature Date: Thu, 11 Apr 2024 06:48:54 +0000 Message-ID: <20240411064858.3232574-6-liaochang1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240411064858.3232574-1-liaochang1@huawei.com> References: <20240411064858.3232574-1-liaochang1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.174.28] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemd200013.china.huawei.com (7.221.188.133) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240410_235527_954643_B6AB009A X-CRM114-Status: GOOD ( 12.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Due to the historical reasons, cpus_have_const_cap() is more complicated than it needs to be. When CONFIG_ARM64_NMI=y the ARM64_HAS_NMI cpucap is a strict boot cpu feature which is detected and patched early on the boot cpu, which means no code depends on ARM64_HAS_NMI cpucap run in the window between the ARM64_HAS_NMI cpucap is detected and alternative is patched. So it would be nice to migrate caller over to alternative_has_cap_likey(). Signed-off-by: Liao Chang --- arch/arm64/include/asm/cpufeature.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index dc8b2d0d3763..4c35565ad656 100644 --- a/arch/arm64/include/asm/cpufeature.h +++ b/arch/arm64/include/asm/cpufeature.h @@ -803,7 +803,7 @@ static __always_inline bool system_uses_irq_prio_masking(void) static __always_inline bool system_uses_nmi(void) { return IS_ENABLED(CONFIG_ARM64_NMI) && - cpus_have_const_cap(ARM64_USES_NMI); + alternative_has_cap_likely(ARM64_USES_NMI); } static inline bool system_supports_mte(void)