Skip to content

Commit 62ef31e

Browse files
Andre-ARMsashalevin
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> Cc: <stable@vger.kernel.org> # v3.18.y (cherry picked from commit c0a01b8) Signed-off-by: Kevin Hilman <khilman@linaro.org> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
1 parent e51ce83 commit 62ef31e

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
@@ -193,6 +193,114 @@ endmenu
193193

194194
menu "Kernel Features"
195195

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