]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: errata: Fix KVM Spectre-v2 mitigation selection for Cortex-A57/A72
authorJames Morse <james.morse@arm.com>
Wed, 30 Nov 2022 18:28:19 +0000 (18:28 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Dec 2022 10:23:04 +0000 (11:23 +0100)
commit7338f833774ffee7cf46bbdc0d86c7bdecebc630
tree3f13bb6246695c97c61d8a8bfc79c35b1d0663a4
parentd31aa18a5bd1e37fd991566b882a051405f6c77b
arm64: errata: Fix KVM Spectre-v2 mitigation selection for Cortex-A57/A72

Both the Spectre-v2 and Spectre-BHB mitigations involve running a sequence
immediately after exiting a guest, before any branches. In the stable
kernels these sequences are built by copying templates into an empty vector
slot.

For Spectre-BHB, Cortex-A57 and A72 require the branchy loop with k=8.
If Spectre-v2 needs mitigating at the same time, a firmware call to EL3 is
needed. The work EL3 does at this point is also enough to mitigate
Spectre-BHB.

When enabling the Spectre-BHB mitigation, spectre_bhb_enable_mitigation()
should check if a slot has already been allocated for Spectre-v2, meaning
no work is needed for Spectre-BHB.

This check was missed in the earlier backport, add it.

Fixes: bc572473c925 ("arm64: Mitigate spectre style branch history side channels")
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/kernel/cpu_errata.c