|
@@ -1137,6 +1137,26 @@ static void __init setup_elf_hwcaps(const struct arm64_cpu_capabilities *hwcaps)
|
|
|
cap_set_elf_hwcap(hwcaps);
|
|
|
}
|
|
|
|
|
|
+/*
|
|
|
+ * Check if the current CPU has a given feature capability.
|
|
|
+ * Should be called from non-preemptible context.
|
|
|
+ */
|
|
|
+static bool __this_cpu_has_cap(const struct arm64_cpu_capabilities *cap_array,
|
|
|
+ unsigned int cap)
|
|
|
+{
|
|
|
+ const struct arm64_cpu_capabilities *caps;
|
|
|
+
|
|
|
+ if (WARN_ON(preemptible()))
|
|
|
+ return false;
|
|
|
+
|
|
|
+ for (caps = cap_array; caps->desc; caps++)
|
|
|
+ if (caps->capability == cap &&
|
|
|
+ caps->matches &&
|
|
|
+ caps->matches(caps, SCOPE_LOCAL_CPU))
|
|
|
+ return true;
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
void update_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
|
|
|
const char *info)
|
|
|
{
|
|
@@ -1200,8 +1220,9 @@ verify_local_elf_hwcaps(const struct arm64_cpu_capabilities *caps)
|
|
|
}
|
|
|
|
|
|
static void
|
|
|
-verify_local_cpu_features(const struct arm64_cpu_capabilities *caps)
|
|
|
+verify_local_cpu_features(const struct arm64_cpu_capabilities *caps_list)
|
|
|
{
|
|
|
+ const struct arm64_cpu_capabilities *caps = caps_list;
|
|
|
for (; caps->matches; caps++) {
|
|
|
if (!cpus_have_cap(caps->capability))
|
|
|
continue;
|
|
@@ -1209,7 +1230,7 @@ verify_local_cpu_features(const struct arm64_cpu_capabilities *caps)
|
|
|
* If the new CPU misses an advertised feature, we cannot proceed
|
|
|
* further, park the cpu.
|
|
|
*/
|
|
|
- if (!caps->matches(caps, SCOPE_LOCAL_CPU)) {
|
|
|
+ if (!__this_cpu_has_cap(caps_list, caps->capability)) {
|
|
|
pr_crit("CPU%d: missing feature: %s\n",
|
|
|
smp_processor_id(), caps->desc);
|
|
|
cpu_die_early();
|
|
@@ -1291,25 +1312,6 @@ static void __init mark_const_caps_ready(void)
|
|
|
static_branch_enable(&arm64_const_caps_ready);
|
|
|
}
|
|
|
|
|
|
-/*
|
|
|
- * Check if the current CPU has a given feature capability.
|
|
|
- * Should be called from non-preemptible context.
|
|
|
- */
|
|
|
-static bool __this_cpu_has_cap(const struct arm64_cpu_capabilities *cap_array,
|
|
|
- unsigned int cap)
|
|
|
-{
|
|
|
- const struct arm64_cpu_capabilities *caps;
|
|
|
-
|
|
|
- if (WARN_ON(preemptible()))
|
|
|
- return false;
|
|
|
-
|
|
|
- for (caps = cap_array; caps->desc; caps++)
|
|
|
- if (caps->capability == cap && caps->matches)
|
|
|
- return caps->matches(caps, SCOPE_LOCAL_CPU);
|
|
|
-
|
|
|
- return false;
|
|
|
-}
|
|
|
-
|
|
|
extern const struct arm64_cpu_capabilities arm64_errata[];
|
|
|
|
|
|
bool this_cpu_has_cap(unsigned int cap)
|