Skip to content

Commit 32b38af

Browse files
Marc Zyngiergregkh
authored andcommitted
arm64: Run ARCH_WORKAROUND_1 enabling code on all CPUs
commit 18fce56 upstream. Commit 73f3816 ("arm64: Advertise mitigation of Spectre-v2, or lack thereof") changed the way we deal with ARCH_WORKAROUND_1, by moving most of the enabling code to the .matches() callback. This has the unfortunate effect that the workaround gets only enabled on the first affected CPU, and no other. In order to address this, forcefully call the .matches() callback from a .cpu_enable() callback, which brings us back to the original behaviour. Fixes: 73f3816 ("arm64: Advertise mitigation of Spectre-v2, or lack thereof") Cc: <stable@vger.kernel.org> Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Will Deacon <will@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0baaa4a commit 32b38af

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

arch/arm64/kernel/cpu_errata.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,12 @@ check_branch_predictor(const struct arm64_cpu_capabilities *entry, int scope)
599599
return (need_wa > 0);
600600
}
601601

602+
static void
603+
cpu_enable_branch_predictor_hardening(const struct arm64_cpu_capabilities *cap)
604+
{
605+
cap->matches(cap, SCOPE_LOCAL_CPU);
606+
}
607+
602608
static const __maybe_unused struct midr_range tx2_family_cpus[] = {
603609
MIDR_ALL_VERSIONS(MIDR_BRCM_VULCAN),
604610
MIDR_ALL_VERSIONS(MIDR_CAVIUM_THUNDERX2),
@@ -890,9 +896,11 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
890896
},
891897
#endif
892898
{
899+
.desc = "Branch predictor hardening",
893900
.capability = ARM64_HARDEN_BRANCH_PREDICTOR,
894901
.type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
895902
.matches = check_branch_predictor,
903+
.cpu_enable = cpu_enable_branch_predictor_hardening,
896904
},
897905
#ifdef CONFIG_RANDOMIZE_BASE
898906
{

0 commit comments

Comments
 (0)