diff mbox series

[v2,5/9] arm64/cpufeature: Use alternatives to check enabled ARM64_HAS_NMI feature

Message ID 20240411064858.3232574-6-liaochang1@huawei.com (mailing list archive)
State New, archived
Headers show
Series Rework the DAIF mask, unmask and track API | expand

Commit Message

Liao, Chang April 11, 2024, 6:48 a.m. UTC
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 <liaochang1@huawei.com>
---
 arch/arm64/include/asm/cpufeature.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Brown April 15, 2024, 1:13 a.m. UTC | #1
On Thu, Apr 11, 2024 at 06:48:54AM +0000, Liao Chang wrote:
> 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().

Just squash this one in as well.
diff mbox series

Patch

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)