blob: 3e45d41786fd82fdd1f05edaa5a606491d2a3367 [file] [log] [blame] [view]
Sandrine Bailleuxc2f02602015-12-15 14:27:17 +00001ARM Trusted Firmware Reset Design
2=================================
3
41. [Introduction](#1--introduction)
52. [General reset code flow](#2--general-reset-code-flow)
63. [Programmable CPU reset address](#3--programmable-cpu-reset-address)
74. [Cold boot on a single CPU](#4--cold-boot-on-a-single-cpu)
85. [Programmable CPU reset address, Cold boot on a single CPU](#5--programmable-cpu-reset-address-cold-boot-on-a-single-cpu)
96. [Using BL31 entrypoint as the reset address](#6--using-bl31-entrypoint-as-the-reset-address)
10
11
121. Introduction
13----------------
14
15This document describes the high-level design of the framework to handle CPU
16resets in ARM Trusted Firmware. It also describes how the platform integrator
17can tailor this code to the system configuration to some extent, resulting in a
18simplified and more optimised boot flow.
19
20This document should be used in conjunction with the [Firmware Design], which
21provides greater implementation details around the reset code, specifically
22for the cold boot path.
23
24
252. General reset code flow
26---------------------------
27
28The ARM Trusted Firmware (TF) reset code is implemented in BL1 by default. The
29following high-level diagram illustrates this:
30
31![Default reset code flow](diagrams/default_reset_code.png?raw=true)
32
33This diagram shows the default, unoptimised reset flow. Depending on the system
34configuration, some of these steps might be unnecessary. The following sections
35guide the platform integrator by indicating which build options exclude which
36steps, depending on the capability of the platform.
37
38Note: If BL31 is used as the Trusted Firmware entry point instead of BL1, the
39diagram above is still relevant, as all these operations will occur in BL31 in
40this case. Please refer to section 6 "Using BL31 entrypoint as the reset
41address" for more information.
42
43
443. Programmable CPU reset address
45----------------------------------
46
47By default, the TF assumes that the CPU reset address is not programmable.
48Therefore, all CPUs start at the same address (typically address 0) whenever
49they reset. Further logic is then required to identify whether it is a cold or
50warm boot to direct CPUs to the right execution path.
51
52If the reset vector address (reflected in the reset vector base address register
53`RVBAR_EL3`) is programmable then it is possible to make each CPU start directly
54at the right address, both on a cold and warm reset. Therefore, the boot type
55detection can be skipped, resulting in the following boot flow:
56
57![Reset code flow with programmable reset address](
58diagrams/reset_code_no_boot_type_check.png?raw=true)
59
60To enable this boot flow, compile the TF with `PROGRAMMABLE_RESET_ADDRESS=1`.
61This option only affects the TF reset image, which is BL1 by default or BL31 if
62`RESET_TO_BL31=1`.
63
64On both the FVP and Juno platforms, the reset vector address is not programmable
65so both ports use `PROGRAMMABLE_RESET_ADDRESS=0`.
66
67
684. Cold boot on a single CPU
69-----------------------------
70
71By default, the TF assumes that several CPUs may be released out of reset.
72Therefore, the cold boot code has to arbitrate access to hardware resources
73shared amongst CPUs. This is done by nominating one of the CPUs as the primary,
74which is responsible for initialising shared hardware and coordinating the boot
75flow with the other CPUs.
76
77If the platform guarantees that only a single CPU will ever be brought up then
78no arbitration is required. The notion of primary/secondary CPU itself no longer
79applies. This results in the following boot flow:
80
81![Reset code flow with single CPU released out of reset](
82diagrams/reset_code_no_cpu_check.png?raw=true)
83
84To enable this boot flow, compile the TF with `COLD_BOOT_SINGLE_CPU=1`. This
85option only affects the TF reset image, which is BL1 by default or BL31 if
86`RESET_TO_BL31=1`.
87
88On both the FVP and Juno platforms, although only one core is powered up by
89default, there are platform-specific ways to release any number of cores out of
90reset. Therefore, both platform ports use `COLD_BOOT_SINGLE_CPU=0`.
91
92
935. Programmable CPU reset address, Cold boot on a single CPU
94-------------------------------------------------------------
95
96It is obviously possible to combine both optimisations on platforms that have
97a programmable CPU reset address and which release a single CPU out of reset.
98This results in the following boot flow:
99
100![Reset code flow with programmable reset address and single CPU released out of
101reset](diagrams/reset_code_no_checks.png?raw=true)
102
103To enable this boot flow, compile the TF with both `COLD_BOOT_SINGLE_CPU=1`
104and `PROGRAMMABLE_RESET_ADDRESS=1`. These options only affect the TF reset
105image, which is BL1 by default or BL31 if `RESET_TO_BL31=1`.
106
107
1086. Using BL31 entrypoint as the reset address
109----------------------------------------------
110
111On some platforms the runtime firmware (BL3x images) for the application
112processors are loaded by some firmware running on a secure system processor
113on the SoC, rather than by BL1 and BL2 running on the primary application
114processor. For this type of SoC it is desirable for the application processor
115to always reset to BL31 which eliminates the need for BL1 and BL2.
116
117TF provides a build-time option `RESET_TO_BL31` that includes some additional
118logic in the BL31 entry point to support this use case.
119
120In this configuration, the platform's Trusted Boot Firmware must ensure that
121BL31 is loaded to its runtime address, which must match the CPU's `RVBAR_EL3`
122reset vector base address, before the application processor is powered on.
123Additionally, platform software is responsible for loading the other BL3x images
124required and providing entry point information for them to BL31. Loading these
125images might be done by the Trusted Boot Firmware or by platform code in BL31.
126
127Although the ARM FVP platform does not support programming the reset base
128address dynamically at run-time, it is possible to set the initial value of the
129`RVBAR_EL3` register at start-up. This feature is provided on the Base FVP only.
130It allows the ARM FVP port to support the `RESET_TO_BL31` configuration, in
131which case the `bl31.bin` image must be loaded to its run address in Trusted
132SRAM and all CPU reset vectors be changed from the default `0x0` to this run
133address. See the [User Guide] for details of running the FVP models in this way.
134
135Although technically it would be possible to program the reset base address with
136the right support in the SCP firmware, this is currently not implemented so the
137Juno port doesn't support the `RESET_TO_BL31` configuration.
138
139The `RESET_TO_BL31` configuration requires some additions and changes in the
140BL31 functionality:
141
142#### Determination of boot path
143
144In this configuration, BL31 uses the same reset framework and code as the one
145described for BL1 above. Therefore, it is affected by the
146`PROGRAMMABLE_RESET_ADDRESS` and `COLD_BOOT_SINGLE_CPU` build options in the
147same way.
148
149In the default, unoptimised BL31 reset flow, on a warm boot a CPU is directed
150to the PSCI implementation via a platform defined mechanism. On a cold boot,
151the platform must place any secondary CPUs into a safe state while the primary
152CPU executes a modified BL31 initialization, as described below.
153
154#### Platform initialization
155
156In this configuration, when the CPU resets to BL31 there are no parameters that
157can be passed in registers by previous boot stages. Instead, the platform code
158in BL31 needs to know, or be able to determine, the location of the BL32 (if
159required) and BL33 images and provide this information in response to the
160`bl31_plat_get_next_image_ep_info()` function.
161
162Additionally, platform software is responsible for carrying out any security
163initialisation, for example programming a TrustZone address space controller.
164This might be done by the Trusted Boot Firmware or by platform code in BL31.
165
166- - - - - - - - - - - - - - - - - - - - - - - - - -
167
168_Copyright (c) 2015, ARM Limited and Contributors. All rights reserved._
169
170
171[User Guide]: user-guide.md
172[Firmware Design]: firmware-design.md