Skip to content

Commit 01893f5

Browse files
committed
arm64: errata: Expand speculative SSBS workaround (again)
JIRA: https://issues.redhat.com/browse/RHEL-108306 Note: There is a touch of fuzz here because the order of the v1/v2/v3 is wrong wrt upstream. commit adeec61 Author: Mark Rutland <mark.rutland@arm.com> Date: Thu Aug 1 11:18:03 2024 +0100 arm64: errata: Expand speculative SSBS workaround (again) A number of Arm Ltd CPUs suffer from errata whereby an MSR to the SSBS special-purpose register does not affect subsequent speculative instructions, permitting speculative store bypassing for a window of time. We worked around this for a number of CPUs in commits: * 7187bb7 ("arm64: errata: Add workaround for Arm errata 3194386 and 3312417") * 75b3c43 ("arm64: errata: Expand speculative SSBS workaround") Since then, similar errata have been published for a number of other Arm Ltd CPUs, for which the same mitigation is sufficient. This is described in their respective Software Developer Errata Notice (SDEN) documents: * Cortex-A76 (MP052) SDEN v31.0, erratum 3324349 https://developer.arm.com/documentation/SDEN-885749/3100/ * Cortex-A77 (MP074) SDEN v19.0, erratum 3324348 https://developer.arm.com/documentation/SDEN-1152370/1900/ * Cortex-A78 (MP102) SDEN v21.0, erratum 3324344 https://developer.arm.com/documentation/SDEN-1401784/2100/ * Cortex-A78C (MP138) SDEN v16.0, erratum 3324346 https://developer.arm.com/documentation/SDEN-1707916/1600/ * Cortex-A78C (MP154) SDEN v10.0, erratum 3324347 https://developer.arm.com/documentation/SDEN-2004089/1000/ * Cortex-A725 (MP190) SDEN v5.0, erratum 3456106 https://developer.arm.com/documentation/SDEN-2832921/0500/ * Cortex-X1 (MP077) SDEN v21.0, erratum 3324344 https://developer.arm.com/documentation/SDEN-1401782/2100/ * Cortex-X1C (MP136) SDEN v16.0, erratum 3324346 https://developer.arm.com/documentation/SDEN-1707914/1600/ * Neoverse-N1 (MP050) SDEN v32.0, erratum 3324349 https://developer.arm.com/documentation/SDEN-885747/3200/ * Neoverse-V1 (MP076) SDEN v19.0, erratum 3324341 https://developer.arm.com/documentation/SDEN-1401781/1900/ Note that due to the manner in which Arm develops IP and tracks errata, some CPUs share a common erratum number and some CPUs have multiple erratum numbers for the same HW issue. On parts without SB, it is necessary to use ISB for the workaround. The spec_bar() macro used in the mitigation will expand to a "DSB SY; ISB" sequence in this case, which is sufficient on all affected parts. Enable the existing mitigation by adding the relevant MIDRs to erratum_spec_ssbs_list. The list is sorted alphanumerically (involving moving Neoverse-V3 after Neoverse-V2) so that this is easy to audit and potentially extend again in future. The Kconfig text is also updated to clarify the set of affected parts and the mitigation. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Cc: James Morse <james.morse@arm.com> Cc: Will Deacon <will@kernel.org> Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com> Acked-by: Will Deacon <will@kernel.org> Link: https://lore.kernel.org/r/20240801101803.1982459-4-mark.rutland@arm.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Jeremy Linton <jlinton@redhat.com>
1 parent 7391369 commit 01893f5

File tree

3 files changed

+48
-9
lines changed

3 files changed

+48
-9
lines changed

Documentation/arm64/silicon-errata.rst

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,17 +126,27 @@ stable kernels.
126126
+----------------+-----------------+-----------------+-----------------------------+
127127
| ARM | Cortex-A76 | #1490853 | N/A |
128128
+----------------+-----------------+-----------------+-----------------------------+
129+
| ARM | Cortex-A76 | #3324349 | ARM64_ERRATUM_3194386 |
130+
+----------------+-----------------+-----------------+-----------------------------+
129131
| ARM | Cortex-A77 | #1491015 | N/A |
130132
+----------------+-----------------+-----------------+-----------------------------+
131133
| ARM | Cortex-A77 | #1508412 | ARM64_ERRATUM_1508412 |
132134
+----------------+-----------------+-----------------+-----------------------------+
135+
<<<<<<< HEAD:Documentation/arm64/silicon-errata.rst
133136
| ARM | Cortex-A510 | #2051678 | ARM64_ERRATUM_2051678 |
134137
+----------------+-----------------+-----------------+-----------------------------+
135138
| ARM | Cortex-A510 | #2077057 | ARM64_ERRATUM_2077057 |
136139
+----------------+-----------------+-----------------+-----------------------------+
137140
| ARM | Cortex-A510 | #2441009 | ARM64_ERRATUM_2441009 |
138141
+----------------+-----------------+-----------------+-----------------------------+
139142
| ARM | Cortex-A510 | #2658417 | ARM64_ERRATUM_2658417 |
143+
=======
144+
| ARM | Cortex-A77 | #3324348 | ARM64_ERRATUM_3194386 |
145+
+----------------+-----------------+-----------------+-----------------------------+
146+
| ARM | Cortex-A78 | #3324344 | ARM64_ERRATUM_3194386 |
147+
+----------------+-----------------+-----------------+-----------------------------+
148+
| ARM | Cortex-A78C | #3324346,3324347| ARM64_ERRATUM_3194386 |
149+
>>>>>>> adeec61a4723 (arm64: errata: Expand speculative SSBS workaround (again)):Documentation/arch/arm64/silicon-errata.rst
140150
+----------------+-----------------+-----------------+-----------------------------+
141151
| ARM | Cortex-A710 | #2119858 | ARM64_ERRATUM_2119858 |
142152
+----------------+-----------------+-----------------+-----------------------------+
@@ -150,8 +160,14 @@ stable kernels.
150160
+----------------+-----------------+-----------------+-----------------------------+
151161
| ARM | Cortex-A720 | #3456091 | ARM64_ERRATUM_3194386 |
152162
+----------------+-----------------+-----------------+-----------------------------+
163+
| ARM | Cortex-A725 | #3456106 | ARM64_ERRATUM_3194386 |
164+
+----------------+-----------------+-----------------+-----------------------------+
153165
| ARM | Cortex-X1 | #1502854 | N/A |
154166
+----------------+-----------------+-----------------+-----------------------------+
167+
| ARM | Cortex-X1 | #3324344 | ARM64_ERRATUM_3194386 |
168+
+----------------+-----------------+-----------------+-----------------------------+
169+
| ARM | Cortex-X1C | #3324346 | ARM64_ERRATUM_3194386 |
170+
+----------------+-----------------+-----------------+-----------------------------+
155171
| ARM | Cortex-X2 | #2119858 | ARM64_ERRATUM_2119858 |
156172
+----------------+-----------------+-----------------+-----------------------------+
157173
| ARM | Cortex-X2 | #2224489 | ARM64_ERRATUM_2224489 |
@@ -172,6 +188,8 @@ stable kernels.
172188
+----------------+-----------------+-----------------+-----------------------------+
173189
| ARM | Neoverse-N1 | #1542419 | ARM64_ERRATUM_1542419 |
174190
+----------------+-----------------+-----------------+-----------------------------+
191+
| ARM | Neoverse-N1 | #3324349 | ARM64_ERRATUM_3194386 |
192+
+----------------+-----------------+-----------------+-----------------------------+
175193
| ARM | Neoverse-N2 | #2139208 | ARM64_ERRATUM_2139208 |
176194
+----------------+-----------------+-----------------+-----------------------------+
177195
| ARM | Neoverse-N2 | #2067961 | ARM64_ERRATUM_2067961 |
@@ -180,12 +198,14 @@ stable kernels.
180198
+----------------+-----------------+-----------------+-----------------------------+
181199
| ARM | Neoverse-N2 | #3324339 | ARM64_ERRATUM_3194386 |
182200
+----------------+-----------------+-----------------+-----------------------------+
201+
| ARM | Neoverse-V1 | #1619801 | N/A |
202+
+----------------+-----------------+-----------------+-----------------------------+
203+
| ARM | Neoverse-V1 | #3324341 | ARM64_ERRATUM_3194386 |
204+
+----------------+-----------------+-----------------+-----------------------------+
183205
| ARM | Neoverse-V2 | #3324336 | ARM64_ERRATUM_3194386 |
184206
+----------------+-----------------+-----------------+-----------------------------+
185207
| ARM | Neoverse-V3 | #3312417 | ARM64_ERRATUM_3194386 |
186208
+----------------+-----------------+-----------------+-----------------------------+
187-
| ARM | Neoverse-V1 | #1619801 | N/A |
188-
+----------------+-----------------+-----------------+-----------------------------+
189209
| ARM | MMU-500 | #841119,826419 | ARM_SMMU_MMU_500_CPRE_ERRATA|
190210
| | | #562869,1047329 | |
191211
+----------------+-----------------+-----------------+-----------------------------+

arch/arm64/Kconfig

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,30 +1058,40 @@ config ARM64_ERRATUM_3117295
10581058
If unsure, say Y.
10591059

10601060
config ARM64_ERRATUM_3194386
1061-
bool "Cortex-{A720,X4,X925}/Neoverse-V3: workaround for MSR SSBS not self-synchronizing"
1061+
bool "Cortex-*/Neoverse-*: workaround for MSR SSBS not self-synchronizing"
10621062
default y
10631063
help
10641064
This option adds the workaround for the following errata:
10651065

1066+
* ARM Cortex-A76 erratum 3324349
1067+
* ARM Cortex-A77 erratum 3324348
1068+
* ARM Cortex-A78 erratum 3324344
1069+
* ARM Cortex-A78C erratum 3324346
1070+
* ARM Cortex-A78C erratum 3324347
10661071
* ARM Cortex-A710 erratam 3324338
10671072
* ARM Cortex-A720 erratum 3456091
1073+
* ARM Cortex-A725 erratum 3456106
1074+
* ARM Cortex-X1 erratum 3324344
1075+
* ARM Cortex-X1C erratum 3324346
10681076
* ARM Cortex-X2 erratum 3324338
10691077
* ARM Cortex-X3 erratum 3324335
10701078
* ARM Cortex-X4 erratum 3194386
10711079
* ARM Cortex-X925 erratum 3324334
1080+
* ARM Neoverse-N1 erratum 3324349
10721081
* ARM Neoverse N2 erratum 3324339
1082+
* ARM Neoverse-V1 erratum 3324341
10731083
* ARM Neoverse V2 erratum 3324336
10741084
* ARM Neoverse-V3 erratum 3312417
10751085

10761086
On affected cores "MSR SSBS, #0" instructions may not affect
10771087
subsequent speculative instructions, which may permit unexepected
10781088
speculative store bypassing.
10791089

1080-
Work around this problem by placing a speculation barrier after
1081-
kernel changes to SSBS. The presence of the SSBS special-purpose
1082-
register is hidden from hwcaps and EL0 reads of ID_AA64PFR1_EL1, such
1083-
that userspace will use the PR_SPEC_STORE_BYPASS prctl to change
1084-
SSBS.
1090+
Work around this problem by placing a Speculation Barrier (SB) or
1091+
Instruction Synchronization Barrier (ISB) after kernel changes to
1092+
SSBS. The presence of the SSBS special-purpose register is hidden
1093+
from hwcaps and EL0 reads of ID_AA64PFR1_EL1, such that userspace
1094+
will use the PR_SPEC_STORE_BYPASS prctl to change SSBS.
10851095

10861096
If unsure, say Y.
10871097

arch/arm64/kernel/cpu_errata.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,15 +434,24 @@ static const struct midr_range erratum_spec_unpriv_load_list[] = {
434434

435435
#ifdef CONFIG_ARM64_ERRATUM_3194386
436436
static const struct midr_range erratum_spec_ssbs_list[] = {
437+
MIDR_ALL_VERSIONS(MIDR_CORTEX_A76),
438+
MIDR_ALL_VERSIONS(MIDR_CORTEX_A77),
439+
MIDR_ALL_VERSIONS(MIDR_CORTEX_A78),
440+
MIDR_ALL_VERSIONS(MIDR_CORTEX_A78C),
437441
MIDR_ALL_VERSIONS(MIDR_CORTEX_A710),
438442
MIDR_ALL_VERSIONS(MIDR_CORTEX_A720),
443+
MIDR_ALL_VERSIONS(MIDR_CORTEX_A725),
444+
MIDR_ALL_VERSIONS(MIDR_CORTEX_X1),
445+
MIDR_ALL_VERSIONS(MIDR_CORTEX_X1C),
439446
MIDR_ALL_VERSIONS(MIDR_CORTEX_X2),
440447
MIDR_ALL_VERSIONS(MIDR_CORTEX_X3),
441448
MIDR_ALL_VERSIONS(MIDR_CORTEX_X4),
442449
MIDR_ALL_VERSIONS(MIDR_CORTEX_X925),
450+
MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N1),
443451
MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N2),
444-
MIDR_ALL_VERSIONS(MIDR_NEOVERSE_V3),
452+
MIDR_ALL_VERSIONS(MIDR_NEOVERSE_V1),
445453
MIDR_ALL_VERSIONS(MIDR_NEOVERSE_V2),
454+
MIDR_ALL_VERSIONS(MIDR_NEOVERSE_V3),
446455
{}
447456
};
448457
#endif

0 commit comments

Comments
 (0)