Commit fbd890b9 authored by Suzuki K Poulose's avatar Suzuki K Poulose Committed by Will Deacon

arm64: capabilities: Allow features based on local CPU scope

So far we have treated the feature capabilities as system wide
and this wouldn't help with features that could be detected locally
on one or more CPUs (e.g, KPTI, Software prefetch). This patch
splits the feature detection to two phases :

 1) Local CPU features are checked on all boot time active CPUs.
 2) System wide features are checked only once after all CPUs are
    active.
Reviewed-by: default avatarDave Martin <dave.martin@arm.com>
Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent d69fe9a7
...@@ -510,6 +510,7 @@ static void __init init_cpu_ftr_reg(u32 sys_reg, u64 new) ...@@ -510,6 +510,7 @@ static void __init init_cpu_ftr_reg(u32 sys_reg, u64 new)
} }
extern const struct arm64_cpu_capabilities arm64_errata[]; extern const struct arm64_cpu_capabilities arm64_errata[];
static const struct arm64_cpu_capabilities arm64_features[];
static void update_cpu_capabilities(const struct arm64_cpu_capabilities *caps, static void update_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
u16 scope_mask, const char *info); u16 scope_mask, const char *info);
...@@ -557,11 +558,12 @@ void __init init_cpu_features(struct cpuinfo_arm64 *info) ...@@ -557,11 +558,12 @@ void __init init_cpu_features(struct cpuinfo_arm64 *info)
} }
/* /*
* Run the errata work around checks on the boot CPU, once we have * Run the errata work around and local feature checks on the
* initialised the cpu feature infrastructure. * boot CPU, once we have initialised the cpu feature infrastructure.
*/ */
update_cpu_capabilities(arm64_errata, SCOPE_LOCAL_CPU, update_cpu_capabilities(arm64_errata, SCOPE_LOCAL_CPU,
"enabling workaround for"); "enabling workaround for");
update_cpu_capabilities(arm64_features, SCOPE_LOCAL_CPU, "detected:");
} }
static void update_cpu_ftr_reg(struct arm64_ftr_reg *reg, u64 new) static void update_cpu_ftr_reg(struct arm64_ftr_reg *reg, u64 new)
...@@ -1447,15 +1449,18 @@ void check_local_cpu_capabilities(void) ...@@ -1447,15 +1449,18 @@ void check_local_cpu_capabilities(void)
/* /*
* If we haven't finalised the system capabilities, this CPU gets * If we haven't finalised the system capabilities, this CPU gets
* a chance to update the errata work arounds. * a chance to update the errata work arounds and local features.
* Otherwise, this CPU should verify that it has all the system * Otherwise, this CPU should verify that it has all the system
* advertised capabilities. * advertised capabilities.
*/ */
if (!sys_caps_initialised) if (!sys_caps_initialised) {
update_cpu_capabilities(arm64_errata, SCOPE_LOCAL_CPU, update_cpu_capabilities(arm64_errata, SCOPE_LOCAL_CPU,
"enabling workaround for"); "enabling workaround for");
else update_cpu_capabilities(arm64_features, SCOPE_LOCAL_CPU,
"detected:");
} else {
verify_local_cpu_capabilities(); verify_local_cpu_capabilities();
}
} }
DEFINE_STATIC_KEY_FALSE(arm64_const_caps_ready); DEFINE_STATIC_KEY_FALSE(arm64_const_caps_ready);
...@@ -1479,7 +1484,7 @@ void __init setup_cpu_features(void) ...@@ -1479,7 +1484,7 @@ void __init setup_cpu_features(void)
u32 cwg; u32 cwg;
/* Set the CPU feature capabilies */ /* Set the CPU feature capabilies */
update_cpu_capabilities(arm64_features, SCOPE_ALL, "detected:"); update_cpu_capabilities(arm64_features, SCOPE_SYSTEM, "detected:");
update_cpu_capabilities(arm64_errata, SCOPE_SYSTEM, update_cpu_capabilities(arm64_errata, SCOPE_SYSTEM,
"enabling workaround for"); "enabling workaround for");
enable_cpu_capabilities(arm64_features, SCOPE_ALL); enable_cpu_capabilities(arm64_features, SCOPE_ALL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment