git: 88489d90afa5 - stable/15 - arm64: Fix enabling CPU features

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Mon, 22 Sep 2025 15:20:22 UTC
The branch stable/15 has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=88489d90afa5306b1dbbecca19efdb1cc4fd133f

commit 88489d90afa5306b1dbbecca19efdb1cc4fd133f
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2025-09-19 10:05:47 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2025-09-20 01:00:54 +0000

    arm64: Fix enabling CPU features
    
    Previously when enabling CPU feature we assumed the no check function
    means the feature was unconditionally enabled. When adding support to
    disable features on boot this check was incorrectly partially left in
    place. As all current features have a check function this meant all
    features were disabled.
    
    Fix this by restoring the previous behaviour while also allowing the
    user to disable the feature.
    
    Reviewed by:    emaste
    Fixes:          4bc68fa98f68 ("arm64: Support managing features from loader")
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D52579
    
    (cherry picked from commit 5e690f1e12ce8699f16019854dfffd1857a801d8)
---
 sys/arm64/arm64/cpu_feat.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sys/arm64/arm64/cpu_feat.c b/sys/arm64/arm64/cpu_feat.c
index fb065ea463cf..94114d47f846 100644
--- a/sys/arm64/arm64/cpu_feat.c
+++ b/sys/arm64/arm64/cpu_feat.c
@@ -78,10 +78,11 @@ enable_cpu_feat(uint32_t stage)
 		    PCPU_GET(cpuid) != 0)
 			continue;
 
-		if (feat->feat_check != NULL)
-			continue;
-
-		check_status = feat->feat_check(feat, midr);
+		if (feat->feat_check != NULL) {
+			check_status = feat->feat_check(feat, midr);
+		} else {
+			check_status = FEAT_DEFAULT_ENABLE;
+		}
 		/* Ignore features that are not present */
 		if (check_status == FEAT_ALWAYS_DISABLE)
 			goto next;