[PATCH v2 10/13] arm64: Add MIDR-based override infrastructure
Marc Zyngier
maz at kernel.org
Mon Nov 20 04:37:18 PST 2023
In order to be able to use the override infrastructure to "fix"
CPUs that have deviated from teh architecture spec, add a new
pile of hacks on top of the existing one, allowing a feature
to be overriden based on matching a MIDR list.
Signed-off-by: Marc Zyngier <maz at kernel.org>
---
arch/arm64/kernel/idreg-override.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/arch/arm64/kernel/idreg-override.c b/arch/arm64/kernel/idreg-override.c
index 7b5b9dc20e6b..57c145bf50b7 100644
--- a/arch/arm64/kernel/idreg-override.c
+++ b/arch/arm64/kernel/idreg-override.c
@@ -321,6 +321,23 @@ static __init void parse_cmdline(void)
__parse_cmdline(prop, true);
}
+struct midr_override_data {
+ const char feature[FTR_ALIAS_OPTION_LEN];
+ const struct midr_range ranges[];
+};
+
+static const struct midr_override_data * const midr_ovr_data[] __initconst = {
+};
+
+static void __init apply_midr_overrides(void)
+{
+ const u64 midr = read_cpuid_id();
+
+ for (int i = 0; i < ARRAY_SIZE(midr_ovr_data); i++)
+ if (is_midr_in_range_list(midr, midr_ovr_data[i]->ranges))
+ __parse_cmdline(midr_ovr_data[i]->feature, false);
+}
+
/* Keep checkers quiet */
void init_feature_override(u64 boot_status);
@@ -337,6 +354,8 @@ asmlinkage void __init init_feature_override(u64 boot_status)
__boot_status = boot_status;
+ apply_midr_overrides();
+
parse_cmdline();
for (i = 0; i < ARRAY_SIZE(regs); i++) {
--
2.39.2
More information about the linux-arm-kernel
mailing list