aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Turner <andrew@FreeBSD.org>2026-06-18 13:34:47 +0000
committerAndrew Turner <andrew@FreeBSD.org>2026-06-18 14:56:53 +0000
commitcd94485281f3fc6ae5414180420527ce11846742 (patch)
treeb7296fff0b84f97385009ad471dd5bcd80e29bec
parenta9e12d3ec8bde29e97227757bc08cb1a0a93afa9 (diff)
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
-rw-r--r--sys/arm64/arm64/cpu_feat.c24
-rw-r--r--sys/arm64/include/cpu_feat.h7
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