Skip to content

Commit c0a01b8

Browse files
Andre-ARMwildea01
authored andcommitted
arm64: protect alternatives workarounds with Kconfig options
Not all of the errata we have workarounds for apply necessarily to all SoCs, so people compiling a kernel for one very specific SoC may not need to patch the kernel. Introduce a new submenu in the "Platform selection" menu to allow people to turn off certain bugs if they are not affected. By default all of them are enabled. Normal users or distribution kernels shouldn't bother to deselect any bugs here, since the alternatives framework will take care of patching them in only if needed. Signed-off-by: Andre Przywara <andre.przywara@arm.com> [will: moved kconfig menu under `Kernel Features'] Signed-off-by: Will Deacon <will.deacon@arm.com>
1 parent 5afaa1f commit c0a01b8

2 files changed

Lines changed: 122 additions & 0 deletions

File tree

‎arch/arm64/Kconfig‎

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,114 @@ endmenu
195195

196196
menu "Kernel Features"
197197

198+
menu "ARM errata workarounds via the alternatives framework"
199+
200+
config ARM64_ERRATUM_826319
201+
bool "Cortex-A53: 826319: System might deadlock if a write cannot complete until read data is accepted"
202+
default y
203+
help
204+
This option adds an alternative code sequence to work around ARM
205+
erratum 826319 on Cortex-A53 parts up to r0p2 with an AMBA 4 ACE or
206+
AXI master interface and an L2 cache.
207+
208+
If a Cortex-A53 uses an AMBA AXI4 ACE interface to other processors
209+
and is unable to accept a certain write via this interface, it will
210+
not progress on read data presented on the read data channel and the
211+
system can deadlock.
212+
213+
The workaround promotes data cache clean instructions to
214+
data cache clean-and-invalidate.
215+
Please note that this does not necessarily enable the workaround,
216+
as it depends on the alternative framework, which will only patch
217+
the kernel if an affected CPU is detected.
218+
219+
If unsure, say Y.
220+
221+
config ARM64_ERRATUM_827319
222+
bool "Cortex-A53: 827319: Data cache clean instructions might cause overlapping transactions to the interconnect"
223+
default y
224+
help
225+
This option adds an alternative code sequence to work around ARM
226+
erratum 827319 on Cortex-A53 parts up to r0p2 with an AMBA 5 CHI
227+
master interface and an L2 cache.
228+
229+
Under certain conditions this erratum can cause a clean line eviction
230+
to occur at the same time as another transaction to the same address
231+
on the AMBA 5 CHI interface, which can cause data corruption if the
232+
interconnect reorders the two transactions.
233+
234+
The workaround promotes data cache clean instructions to
235+
data cache clean-and-invalidate.
236+
Please note that this does not necessarily enable the workaround,
237+
as it depends on the alternative framework, which will only patch
238+
the kernel if an affected CPU is detected.
239+
240+
If unsure, say Y.
241+
242+
config ARM64_ERRATUM_824069
243+
bool "Cortex-A53: 824069: Cache line might not be marked as clean after a CleanShared snoop"
244+
default y
245+
help
246+
This option adds an alternative code sequence to work around ARM
247+
erratum 824069 on Cortex-A53 parts up to r0p2 when it is connected
248+
to a coherent interconnect.
249+
250+
If a Cortex-A53 processor is executing a store or prefetch for
251+
write instruction at the same time as a processor in another
252+
cluster is executing a cache maintenance operation to the same
253+
address, then this erratum might cause a clean cache line to be
254+
incorrectly marked as dirty.
255+
256+
The workaround promotes data cache clean instructions to
257+
data cache clean-and-invalidate.
258+
Please note that this option does not necessarily enable the
259+
workaround, as it depends on the alternative framework, which will
260+
only patch the kernel if an affected CPU is detected.
261+
262+
If unsure, say Y.
263+
264+
config ARM64_ERRATUM_819472
265+
bool "Cortex-A53: 819472: Store exclusive instructions might cause data corruption"
266+
default y
267+
help
268+
This option adds an alternative code sequence to work around ARM
269+
erratum 819472 on Cortex-A53 parts up to r0p1 with an L2 cache
270+
present when it is connected to a coherent interconnect.
271+
272+
If the processor is executing a load and store exclusive sequence at
273+
the same time as a processor in another cluster is executing a cache
274+
maintenance operation to the same address, then this erratum might
275+
cause data corruption.
276+
277+
The workaround promotes data cache clean instructions to
278+
data cache clean-and-invalidate.
279+
Please note that this does not necessarily enable the workaround,
280+
as it depends on the alternative framework, which will only patch
281+
the kernel if an affected CPU is detected.
282+
283+
If unsure, say Y.
284+
285+
config ARM64_ERRATUM_832075
286+
bool "Cortex-A57: 832075: possible deadlock on mixing exclusive memory accesses with device loads"
287+
default y
288+
help
289+
This option adds an alternative code sequence to work around ARM
290+
erratum 832075 on Cortex-A57 parts up to r1p2.
291+
292+
Affected Cortex-A57 parts might deadlock when exclusive load/store
293+
instructions to Write-Back memory are mixed with Device loads.
294+
295+
The workaround is to promote device loads to use Load-Acquire
296+
semantics.
297+
Please note that this does not necessarily enable the workaround,
298+
as it depends on the alternative framework, which will only patch
299+
the kernel if an affected CPU is detected.
300+
301+
If unsure, say Y.
302+
303+
endmenu
304+
305+
198306
choice
199307
prompt "Page size"
200308
default ARM64_4K_PAGES

‎arch/arm64/kernel/cpu_errata.c‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,32 @@ is_affected_midr_range(struct arm64_cpu_capabilities *entry)
6565
.midr_range_max = max
6666

6767
struct arm64_cpu_capabilities arm64_errata[] = {
68+
#if defined(CONFIG_ARM64_ERRATUM_826319) || \
69+
defined(CONFIG_ARM64_ERRATUM_827319) || \
70+
defined(CONFIG_ARM64_ERRATUM_824069)
6871
{
6972
/* Cortex-A53 r0p[012] */
7073
.desc = "ARM errata 826319, 827319, 824069",
7174
.capability = ARM64_WORKAROUND_CLEAN_CACHE,
7275
MIDR_RANGE(MIDR_CORTEX_A53, 0x00, 0x02),
7376
},
77+
#endif
78+
#ifdef CONFIG_ARM64_ERRATUM_819472
79+
{
80+
/* Cortex-A53 r0p[01] */
81+
.desc = "ARM errata 819472",
82+
.capability = ARM64_WORKAROUND_CLEAN_CACHE,
83+
MIDR_RANGE(MIDR_CORTEX_A53, 0x00, 0x01),
84+
},
85+
#endif
86+
#ifdef CONFIG_ARM64_ERRATUM_832075
7487
{
7588
/* Cortex-A57 r0p0 - r1p2 */
7689
.desc = "ARM erratum 832075",
7790
.capability = ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE,
7891
MIDR_RANGE(MIDR_CORTEX_A57, 0x00, 0x12),
7992
},
93+
#endif
8094
{
8195
}
8296
};

0 commit comments

Comments
 (0)