The branch main has been updated by andrew:

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

commit cd94485281f3fc6ae5414180420527ce11846742
Author:     Andrew Turner <[email protected]>
AuthorDate: 2026-06-18 13:34:47 +0000
Commit:     Andrew Turner <[email protected]>
CommitDate: 2026-06-18 14:56:53 +0000

    arm64: Add FEAT_ALWAYS_ENABLE to cpu_feat
    
    A use for it has been found in the GICv5 driver where we need to read
    the Interrupt Affinity ID early in the boot on the secondary CPUs.
    
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D54249
---
 sys/arm64/arm64/cpu_feat.c   | 24 +++++++++++++-----------
 sys/arm64/include/cpu_feat.h |  7 ++++++-
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/sys/arm64/arm64/cpu_feat.c b/sys/arm64/arm64/cpu_feat.c
index 94114d47f846..8b8af5fc7cf7 100644
--- a/sys/arm64/arm64/cpu_feat.c
+++ b/sys/arm64/arm64/cpu_feat.c
@@ -87,17 +87,19 @@ enable_cpu_feat(uint32_t stage)
                if (check_status == FEAT_ALWAYS_DISABLE)
                        goto next;
 
-               /* The user disabled the feature */
-               if ((feat->feat_flags & CPU_FEAT_USER_DISABLED) != 0)
-                       goto next;
-
-               /*
-                * The feature was disabled by default and the user
-                * didn't enable it then skip.
-                */
-               if (check_status == FEAT_DEFAULT_DISABLE &&
-                   (feat->feat_flags & CPU_FEAT_USER_ENABLED) == 0)
-                       goto next;
+               if (check_status != FEAT_ALWAYS_ENABLE) {
+                       /* The user disabled the feature */
+                       if ((feat->feat_flags & CPU_FEAT_USER_DISABLED) != 0)
+                               goto next;
+
+                       /*
+                        * The feature was disabled by default and the user
+                        * didn't enable it then skip.
+                        */
+                       if (check_status == FEAT_DEFAULT_DISABLE &&
+                           (feat->feat_flags & CPU_FEAT_USER_ENABLED) == 0)
+                               goto next;
+               }
 
                /*
                 * Check if the feature has any errata that may need a
diff --git a/sys/arm64/include/cpu_feat.h b/sys/arm64/include/cpu_feat.h
index 6a311d4000bb..5eff7f589d8b 100644
--- a/sys/arm64/include/cpu_feat.h
+++ b/sys/arm64/include/cpu_feat.h
@@ -62,7 +62,12 @@ typedef enum {
         */
        FEAT_DEFAULT_ENABLE,
 
-       /* We could add FEAT_ALWAYS_ENABLE if a need was found. */
+       /*
+        * Always enabled. Used when there is no way for the kernel to
+        * work without the feature, e.g. configuring the interrupt
+        * controller.
+        */
+       FEAT_ALWAYS_ENABLE,
 } cpu_feat_en;
 
 #define        CPU_FEAT_STAGE_MASK     0x00000001

Reply via email to