@@ -145,7 +145,7 @@ static inline void cpus_set_cap(unsigned int num)
num, ARM64_NCAPS);
} else {
__set_bit(num, cpu_hwcaps);
- static_branch_enable(&cpu_hwcap_keys[num]);
+ static_branch_enable_cpuslocked(&cpu_hwcap_keys[num]);
}
}
@@ -223,6 +223,7 @@ void update_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
void check_local_cpu_capabilities(void);
void update_cpu_errata_workarounds(void);
+void update_cpu_errata_workarounds_cpuslocked(void);
void __init enable_errata_workarounds(void);
void verify_local_cpu_errata_workarounds(void);
@@ -175,11 +175,18 @@ void verify_local_cpu_errata_workarounds(void)
}
}
-void update_cpu_errata_workarounds(void)
+void update_cpu_errata_workarounds_cpuslocked(void)
{
update_cpu_capabilities(arm64_errata, "enabling workaround for");
}
+void update_cpu_errata_workarounds(void)
+{
+ get_online_cpus();
+ update_cpu_errata_workarounds_cpuslocked();
+ put_online_cpus();
+}
+
void __init enable_errata_workarounds(void)
{
enable_cpu_capabilities(arm64_errata);
@@ -956,6 +956,7 @@ static void __init setup_elf_hwcaps(const struct arm64_cpu_capabilities *hwcaps)
cap_set_elf_hwcap(hwcaps);
}
+/* Should be called with CPU hotplug lock held */
void update_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
const char *info)
{
@@ -1075,14 +1076,16 @@ void check_local_cpu_capabilities(void)
* advertised capabilities.
*/
if (!sys_caps_initialised)
- update_cpu_errata_workarounds();
+ update_cpu_errata_workarounds_cpuslocked();
else
verify_local_cpu_capabilities();
}
static void __init setup_feature_capabilities(void)
{
+ get_online_cpus();
update_cpu_capabilities(arm64_features, "detected feature:");
+ put_online_cpus();
enable_cpu_capabilities(arm64_features);
}