From patchwork Tue Apr 9 01:23:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liao Chang X-Patchwork-Id: 13621705 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 ADA2ECD1292 for ; Tue, 9 Apr 2024 01:31:03 +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=frVHXUx8mi6Gxs /OpcszN2BcMZ5Mr4ki5q+1EkCKwxdvM3lcG4KTOCR2IjBA6CZzM6pYB9THMjm7VCwRTNeXASEx+CM krMt+C8uYBZ/VMltAlQNfSUV6BVP38Y/A2pgUt3fyIbEoGgWjC1Gr0qmZcHhGx9TF9xfAbUFF6xCl ERqAWin108TzytHiUniOIULwkAIo+CqeHuN7dfFQRmKn8RSWSsh8owGUmzT0QksPL0nzKbIDaiR6D r4iUY1Y9XgkpxJ+dSZjIeAdleM8Xvhw32ZrpYL1NTvbvZBzkRxaiebIk2Wp8m3QDj0GXvsFhKSO6j H1h7gHv3QuZgacZudzeQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ru0Jy-0000000HOu2-1vhZ; Tue, 09 Apr 2024 01:30:46 +0000 Received: from szxga05-in.huawei.com ([45.249.212.191]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ru0Jc-0000000HOYL-3IRx for linux-arm-kernel@lists.infradead.org; Tue, 09 Apr 2024 01:30:29 +0000 Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4VD7fP0gDRz1GG1Y; Tue, 9 Apr 2024 09:29:17 +0800 (CST) Received: from kwepemd200013.china.huawei.com (unknown [7.221.188.133]) by mail.maildlp.com (Postfix) with ESMTPS id A071D140384; Tue, 9 Apr 2024 09:30:01 +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; Tue, 9 Apr 2024 09:30:00 +0800 From: Liao Chang To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: , , Subject: [PATCH 5/9] arm64/cpufeature: Use alternatives to check enabled ARM64_HAS_NMI feature Date: Tue, 9 Apr 2024 01:23:40 +0000 Message-ID: <20240409012344.3194724-6-liaochang1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240409012344.3194724-1-liaochang1@huawei.com> References: <20240409012344.3194724-1-liaochang1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.174.28] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) 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-20240408_183025_192376_75585328 X-CRM114-Status: GOOD ( 11.99 ) 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)