blob: a743487fb294d6aff914766ffd93aab3be9b6a63 [file] [log] [blame] [view]
Soby Mathew5541bb32014-09-22 14:13:34 +01001ARM CPU Specific Build Macros
2=============================
3
4Contents
5--------
6
Joakim Bech14a5b342014-11-25 10:55:26 +010071. [Introduction](#1--introduction)
82. [CPU Errata Workarounds](#2--cpu-errata-workarounds)
93. [CPU Specific optimizations](#3--cpu-specific-optimizations)
10
Soby Mathew5541bb32014-09-22 14:13:34 +010011
121. Introduction
13----------------
14
15This document describes the various build options present in the CPU specific
16operations framework to enable errata workarounds and to enable optimizations
17for a specific CPU on a platform.
18
192. CPU Errata Workarounds
20--------------------------
Soby Mathew3fd5ddf2014-08-18 16:57:56 +010021
Sandrine Bailleux44804252014-08-06 11:27:23 +010022ARM Trusted Firmware exports a series of build flags which control the
Soby Mathew3fd5ddf2014-08-18 16:57:56 +010023errata workarounds that are applied to each CPU by the reset handler. The
Sandrine Bailleux121f2ae2015-01-28 10:11:48 +000024errata details can be found in the CPU specific errata documents published
Sandrine Bailleux86d89482016-04-21 11:30:41 +010025by ARM:
26
27* [Cortex-A53 MPCore Software Developers Errata Notice][A53 Errata Notice]
28* [Cortex-A57 MPCore Software Developers Errata Notice][A57 Errata Notice]
29
30The errata workarounds are implemented for a particular revision or a set of
31processor revisions. This is checked by the reset handler at runtime. Each
32errata workaround is identified by its `ID` as specified in the processor's
Soby Mathew3fd5ddf2014-08-18 16:57:56 +010033errata notice document. The format of the define used to enable/disable the
Sandrine Bailleux54035fc2016-01-13 14:57:38 +000034errata workaround is `ERRATA_<Processor name>_<ID>`, where the `Processor name`
35is for example `A57` for the `Cortex_A57` CPU.
Soby Mathew3fd5ddf2014-08-18 16:57:56 +010036
Jeenu Viswambharan10bcd762017-01-03 11:01:51 +000037Refer to the section _CPU errata status reporting_ in [Firmware Design
38guide][Firmware Design] for information on to write errata workaround functions.
39
Sandrine Bailleux86d89482016-04-21 11:30:41 +010040All workarounds are disabled by default. The platform is responsible for
Soby Mathew3fd5ddf2014-08-18 16:57:56 +010041enabling these workarounds according to its requirement by defining the
Soby Mathew7395a722014-09-22 12:11:36 +010042errata workaround build flags in the platform specific makefile. In case
43these workarounds are enabled for the wrong CPU revision then the errata
44workaround is not applied. In the DEBUG build, this is indicated by
45printing a warning to the crash console.
Soby Mathew3fd5ddf2014-08-18 16:57:56 +010046
47In the current implementation, a platform which has more than 1 variant
48with different revisions of a processor has no runtime mechanism available
49for it to specify which errata workarounds should be enabled or not.
50
Sandrine Bailleux44804252014-08-06 11:27:23 +010051The value of the build flags are 0 by default, that is, disabled. Any other
Soby Mathew3fd5ddf2014-08-18 16:57:56 +010052value will enable it.
53
Jimmy Huang6b0d97b2015-07-29 20:55:31 +080054For Cortex-A53, following errata build flags are defined :
55
56* `ERRATA_A53_826319`: This applies errata 826319 workaround to Cortex-A53
57 CPU. This needs to be enabled only for revision <= r0p2 of the CPU.
58
59* `ERRATA_A53_836870`: This applies errata 836870 workaround to Cortex-A53
60 CPU. This needs to be enabled only for revision <= r0p3 of the CPU. From
61 r0p4 and onwards, this errata is enabled by default.
62
Soby Mathew7395a722014-09-22 12:11:36 +010063For Cortex-A57, following errata build flags are defined :
Soby Mathew3fd5ddf2014-08-18 16:57:56 +010064
Soby Mathew7395a722014-09-22 12:11:36 +010065* `ERRATA_A57_806969`: This applies errata 806969 workaround to Cortex-A57
Soby Mathew3fd5ddf2014-08-18 16:57:56 +010066 CPU. This needs to be enabled only for revision r0p0 of the CPU.
67
Soby Mathew7395a722014-09-22 12:11:36 +010068* `ERRATA_A57_813420`: This applies errata 813420 workaround to Cortex-A57
Soby Mathew3fd5ddf2014-08-18 16:57:56 +010069 CPU. This needs to be enabled only for revision r0p0 of the CPU.
70
Sandrine Bailleuxdf22d602016-04-14 13:32:31 +010071* `ERRATA_A57_826974`: This applies errata 826974 workaround to Cortex-A57
72 CPU. This needs to be enabled only for revision <= r1p1 of the CPU.
73
Sandrine Bailleux07288862016-04-14 14:24:13 +010074* `ERRATA_A57_826977`: This applies errata 826977 workaround to Cortex-A57
75 CPU. This needs to be enabled only for revision <= r1p1 of the CPU.
76
Sandrine Bailleuxa8b1c762016-04-14 14:04:48 +010077* `ERRATA_A57_828024`: This applies errata 828024 workaround to Cortex-A57
78 CPU. This needs to be enabled only for revision <= r1p1 of the CPU.
79
Sandrine Bailleux0b771972016-04-14 14:18:07 +010080* `ERRATA_A57_829520`: This applies errata 829520 workaround to Cortex-A57
81 CPU. This needs to be enabled only for revision <= r1p2 of the CPU.
82
Sandrine Bailleuxadeecf92016-04-21 11:10:52 +010083* `ERRATA_A57_833471`: This applies errata 833471 workaround to Cortex-A57
84 CPU. This needs to be enabled only for revision <= r1p2 of the CPU.
85
Soby Mathew5541bb32014-09-22 14:13:34 +0100863. CPU Specific optimizations
87------------------------------
88
89This section describes some of the optimizations allowed by the CPU micro
90architecture that can be enabled by the platform as desired.
91
92* `SKIP_A57_L1_FLUSH_PWR_DWN`: This flag enables an optimization in the
93 Cortex-A57 cluster power down sequence by not flushing the Level 1 data
94 cache. The L1 data cache and the L2 unified cache are inclusive. A flush
95 of the L2 by set/way flushes any dirty lines from the L1 as well. This
96 is a known safe deviation from the Cortex-A57 TRM defined power down
97 sequence. Each Cortex-A57 based platform must make its own decision on
98 whether to use the optimization.
99
Sandrine Bailleux54035fc2016-01-13 14:57:38 +0000100* `A53_DISABLE_NON_TEMPORAL_HINT`: This flag disables the cache non-temporal
101 hint. The LDNP/STNP instructions as implemented on Cortex-A53 do not behave
102 in a way most programmers expect, and will most probably result in a
103 significant speed degradation to any code that employs them. The ARMv8-A
104 architecture (see ARM DDI 0487A.h, section D3.4.3) allows cores to ignore
105 the non-temporal hint and treat LDNP/STNP as LDP/STP instead. Enabling this
106 flag enforces this behaviour. This needs to be enabled only for revisions
107 <= r0p3 of the CPU and is enabled by default.
108
109* `A57_DISABLE_NON_TEMPORAL_HINT`: This flag has the same behaviour as
110 `A53_DISABLE_NON_TEMPORAL_HINT` but for Cortex-A57. This needs to be
Sandrine Bailleuxd1b2b202016-02-09 17:01:37 +0000111 enabled only for revisions <= r1p2 of the CPU and is enabled by default,
112 as recommended in section "4.7 Non-Temporal Loads/Stores" of the
113 [Cortex-A57 Software Optimization Guide][A57 SW Optimization Guide].
Sandrine Bailleux54035fc2016-01-13 14:57:38 +0000114
Soby Mathew3fd5ddf2014-08-18 16:57:56 +0100115- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
116
Sandrine Bailleux54035fc2016-01-13 14:57:38 +0000117_Copyright (c) 2014-2016, ARM Limited and Contributors. All rights reserved._
Sandrine Bailleuxd1b2b202016-02-09 17:01:37 +0000118
119[A57 SW Optimization Guide]: http://infocenter.arm.com/help/topic/com.arm.doc.uan0015b/Cortex_A57_Software_Optimization_Guide_external.pdf
Sandrine Bailleux86d89482016-04-21 11:30:41 +0100120[A53 Errata Notice]: http://infocenter.arm.com/help/topic/com.arm.doc.epm048406/index.html
121[A57 Errata Notice]: http://infocenter.arm.com/help/topic/com.arm.doc.epm049219/cortex_a57_mpcore_software_developers_errata_notice.pdf
Jeenu Viswambharan10bcd762017-01-03 11:01:51 +0000122[Firmware Design]: firmware-design.md