Soby Mathew | 5541bb3 | 2014-09-22 14:13:34 +0100 | [diff] [blame] | 1 | ARM CPU Specific Build Macros |
| 2 | ============================= |
| 3 | |
| 4 | Contents |
| 5 | -------- |
| 6 | |
Joakim Bech | 14a5b34 | 2014-11-25 10:55:26 +0100 | [diff] [blame] | 7 | 1. [Introduction](#1--introduction) |
| 8 | 2. [CPU Errata Workarounds](#2--cpu-errata-workarounds) |
| 9 | 3. [CPU Specific optimizations](#3--cpu-specific-optimizations) |
| 10 | |
Soby Mathew | 5541bb3 | 2014-09-22 14:13:34 +0100 | [diff] [blame] | 11 | |
| 12 | 1. Introduction |
| 13 | ---------------- |
| 14 | |
| 15 | This document describes the various build options present in the CPU specific |
| 16 | operations framework to enable errata workarounds and to enable optimizations |
| 17 | for a specific CPU on a platform. |
| 18 | |
| 19 | 2. CPU Errata Workarounds |
| 20 | -------------------------- |
Soby Mathew | 3fd5ddf | 2014-08-18 16:57:56 +0100 | [diff] [blame] | 21 | |
Sandrine Bailleux | 4480425 | 2014-08-06 11:27:23 +0100 | [diff] [blame] | 22 | ARM Trusted Firmware exports a series of build flags which control the |
Soby Mathew | 3fd5ddf | 2014-08-18 16:57:56 +0100 | [diff] [blame] | 23 | errata workarounds that are applied to each CPU by the reset handler. The |
Sandrine Bailleux | 121f2ae | 2015-01-28 10:11:48 +0000 | [diff] [blame] | 24 | errata details can be found in the CPU specific errata documents published |
Sandrine Bailleux | 86d8948 | 2016-04-21 11:30:41 +0100 | [diff] [blame] | 25 | by 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 | |
| 30 | The errata workarounds are implemented for a particular revision or a set of |
| 31 | processor revisions. This is checked by the reset handler at runtime. Each |
| 32 | errata workaround is identified by its `ID` as specified in the processor's |
Soby Mathew | 3fd5ddf | 2014-08-18 16:57:56 +0100 | [diff] [blame] | 33 | errata notice document. The format of the define used to enable/disable the |
Sandrine Bailleux | 54035fc | 2016-01-13 14:57:38 +0000 | [diff] [blame] | 34 | errata workaround is `ERRATA_<Processor name>_<ID>`, where the `Processor name` |
| 35 | is for example `A57` for the `Cortex_A57` CPU. |
Soby Mathew | 3fd5ddf | 2014-08-18 16:57:56 +0100 | [diff] [blame] | 36 | |
Jeenu Viswambharan | 10bcd76 | 2017-01-03 11:01:51 +0000 | [diff] [blame] | 37 | Refer to the section _CPU errata status reporting_ in [Firmware Design |
| 38 | guide][Firmware Design] for information on to write errata workaround functions. |
| 39 | |
Sandrine Bailleux | 86d8948 | 2016-04-21 11:30:41 +0100 | [diff] [blame] | 40 | All workarounds are disabled by default. The platform is responsible for |
Soby Mathew | 3fd5ddf | 2014-08-18 16:57:56 +0100 | [diff] [blame] | 41 | enabling these workarounds according to its requirement by defining the |
Soby Mathew | 7395a72 | 2014-09-22 12:11:36 +0100 | [diff] [blame] | 42 | errata workaround build flags in the platform specific makefile. In case |
| 43 | these workarounds are enabled for the wrong CPU revision then the errata |
| 44 | workaround is not applied. In the DEBUG build, this is indicated by |
| 45 | printing a warning to the crash console. |
Soby Mathew | 3fd5ddf | 2014-08-18 16:57:56 +0100 | [diff] [blame] | 46 | |
| 47 | In the current implementation, a platform which has more than 1 variant |
| 48 | with different revisions of a processor has no runtime mechanism available |
| 49 | for it to specify which errata workarounds should be enabled or not. |
| 50 | |
Sandrine Bailleux | 4480425 | 2014-08-06 11:27:23 +0100 | [diff] [blame] | 51 | The value of the build flags are 0 by default, that is, disabled. Any other |
Soby Mathew | 3fd5ddf | 2014-08-18 16:57:56 +0100 | [diff] [blame] | 52 | value will enable it. |
| 53 | |
Jimmy Huang | 6b0d97b | 2015-07-29 20:55:31 +0800 | [diff] [blame] | 54 | For 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 Mathew | 7395a72 | 2014-09-22 12:11:36 +0100 | [diff] [blame] | 63 | For Cortex-A57, following errata build flags are defined : |
Soby Mathew | 3fd5ddf | 2014-08-18 16:57:56 +0100 | [diff] [blame] | 64 | |
Soby Mathew | 7395a72 | 2014-09-22 12:11:36 +0100 | [diff] [blame] | 65 | * `ERRATA_A57_806969`: This applies errata 806969 workaround to Cortex-A57 |
Soby Mathew | 3fd5ddf | 2014-08-18 16:57:56 +0100 | [diff] [blame] | 66 | CPU. This needs to be enabled only for revision r0p0 of the CPU. |
| 67 | |
Soby Mathew | 7395a72 | 2014-09-22 12:11:36 +0100 | [diff] [blame] | 68 | * `ERRATA_A57_813420`: This applies errata 813420 workaround to Cortex-A57 |
Soby Mathew | 3fd5ddf | 2014-08-18 16:57:56 +0100 | [diff] [blame] | 69 | CPU. This needs to be enabled only for revision r0p0 of the CPU. |
| 70 | |
Sandrine Bailleux | df22d60 | 2016-04-14 13:32:31 +0100 | [diff] [blame] | 71 | * `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 Bailleux | 0728886 | 2016-04-14 14:24:13 +0100 | [diff] [blame] | 74 | * `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 Bailleux | a8b1c76 | 2016-04-14 14:04:48 +0100 | [diff] [blame] | 77 | * `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 Bailleux | 0b77197 | 2016-04-14 14:18:07 +0100 | [diff] [blame] | 80 | * `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 Bailleux | adeecf9 | 2016-04-21 11:10:52 +0100 | [diff] [blame] | 83 | * `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 Mathew | 5541bb3 | 2014-09-22 14:13:34 +0100 | [diff] [blame] | 86 | 3. CPU Specific optimizations |
| 87 | ------------------------------ |
| 88 | |
| 89 | This section describes some of the optimizations allowed by the CPU micro |
| 90 | architecture 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 Bailleux | 54035fc | 2016-01-13 14:57:38 +0000 | [diff] [blame] | 100 | * `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 Bailleux | d1b2b20 | 2016-02-09 17:01:37 +0000 | [diff] [blame] | 111 | 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 Bailleux | 54035fc | 2016-01-13 14:57:38 +0000 | [diff] [blame] | 114 | |
Soby Mathew | 3fd5ddf | 2014-08-18 16:57:56 +0100 | [diff] [blame] | 115 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 116 | |
Sandrine Bailleux | 54035fc | 2016-01-13 14:57:38 +0000 | [diff] [blame] | 117 | _Copyright (c) 2014-2016, ARM Limited and Contributors. All rights reserved._ |
Sandrine Bailleux | d1b2b20 | 2016-02-09 17:01:37 +0000 | [diff] [blame] | 118 | |
| 119 | [A57 SW Optimization Guide]: http://infocenter.arm.com/help/topic/com.arm.doc.uan0015b/Cortex_A57_Software_Optimization_Guide_external.pdf |
Sandrine Bailleux | 86d8948 | 2016-04-21 11:30:41 +0100 | [diff] [blame] | 120 | [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 Viswambharan | 10bcd76 | 2017-01-03 11:01:51 +0000 | [diff] [blame] | 122 | [Firmware Design]: firmware-design.md |