mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-15 09:04:17 +00:00
Remove coherent stack usage from the cold boot path
This patch reworks the cold boot path across the BL1, BL2, BL3-1 and BL3-2 boot loader stages to not use stacks allocated in coherent memory for early platform setup and enabling the MMU. Stacks allocated in normal memory are used instead. Attributes for stack memory change from nGnRnE when the MMU is disabled to Normal WBWA Inner-shareable when the MMU and data cache are enabled. It is possible for the CPU to read stale stack memory after the MMU is enabled from another CPUs cache. Hence, it is unsafe to turn on the MMU and data cache while using normal stacks when multiple CPUs are a part of the same coherency domain. It is safe to do so in the cold boot path as only the primary cpu executes it. The secondary cpus are in a quiescent state. This patch does not remove the allocation of coherent stack memory. That is done in a subsequent patch. Change-Id: I12c80b7c7ab23506d425c5b3a8a7de693498f830
This commit is contained in:
parent
a1a441775f
commit
754a2b7a09
4 changed files with 26 additions and 47 deletions
|
@ -130,14 +130,16 @@ func bl1_entrypoint
|
|||
ldr x2, =__DATA_SIZE__
|
||||
bl memcpy16
|
||||
|
||||
/* ---------------------------------------------
|
||||
* Give ourselves a small coherent stack to
|
||||
* ease the pain of initializing the MMU and
|
||||
* CCI in assembler
|
||||
* ---------------------------------------------
|
||||
/* --------------------------------------------
|
||||
* Allocate a stack whose memory will be marked
|
||||
* as Normal-IS-WBWA when the MMU is enabled.
|
||||
* There is no risk of reading stale stack
|
||||
* memory after enabling the MMU as only the
|
||||
* primary cpu is running at the moment.
|
||||
* --------------------------------------------
|
||||
*/
|
||||
mrs x0, mpidr_el1
|
||||
bl platform_set_coherent_stack
|
||||
bl platform_set_stack
|
||||
|
||||
/* ---------------------------------------------
|
||||
* Architectural init. can be generic e.g.
|
||||
|
@ -150,14 +152,6 @@ func bl1_entrypoint
|
|||
bl bl1_early_platform_setup
|
||||
bl bl1_plat_arch_setup
|
||||
|
||||
/* ---------------------------------------------
|
||||
* Give ourselves a stack allocated in Normal
|
||||
* -IS-WBWA memory
|
||||
* ---------------------------------------------
|
||||
*/
|
||||
mrs x0, mpidr_el1
|
||||
bl platform_set_stack
|
||||
|
||||
/* --------------------------------------------------
|
||||
* Initialize platform and jump to our c-entry point
|
||||
* for this type of reset. Panic if it returns
|
||||
|
|
|
@ -96,12 +96,15 @@ func bl2_entrypoint
|
|||
bl zeromem16
|
||||
|
||||
/* --------------------------------------------
|
||||
* Give ourselves a small coherent stack to
|
||||
* ease the pain of initializing the MMU
|
||||
* Allocate a stack whose memory will be marked
|
||||
* as Normal-IS-WBWA when the MMU is enabled.
|
||||
* There is no risk of reading stale stack
|
||||
* memory after enabling the MMU as only the
|
||||
* primary cpu is running at the moment.
|
||||
* --------------------------------------------
|
||||
*/
|
||||
mrs x0, mpidr_el1
|
||||
bl platform_set_coherent_stack
|
||||
bl platform_set_stack
|
||||
|
||||
/* ---------------------------------------------
|
||||
* Perform early platform setup & platform
|
||||
|
@ -112,14 +115,6 @@ func bl2_entrypoint
|
|||
bl bl2_early_platform_setup
|
||||
bl bl2_plat_arch_setup
|
||||
|
||||
/* ---------------------------------------------
|
||||
* Give ourselves a stack allocated in Normal
|
||||
* -IS-WBWA memory
|
||||
* ---------------------------------------------
|
||||
*/
|
||||
mrs x0, mpidr_el1
|
||||
bl platform_set_stack
|
||||
|
||||
/* ---------------------------------------------
|
||||
* Jump to main function.
|
||||
* ---------------------------------------------
|
||||
|
|
|
@ -152,12 +152,15 @@ func bl31_entrypoint
|
|||
msr spsel, #0
|
||||
|
||||
/* --------------------------------------------
|
||||
* Give ourselves a small coherent stack to
|
||||
* ease the pain of initializing the MMU
|
||||
* Allocate a stack whose memory will be marked
|
||||
* as Normal-IS-WBWA when the MMU is enabled.
|
||||
* There is no risk of reading stale stack
|
||||
* memory after enabling the MMU as only the
|
||||
* primary cpu is running at the moment.
|
||||
* --------------------------------------------
|
||||
*/
|
||||
mrs x0, mpidr_el1
|
||||
bl platform_set_coherent_stack
|
||||
bl platform_set_stack
|
||||
|
||||
/* ---------------------------------------------
|
||||
* Perform platform specific early arch. setup
|
||||
|
@ -174,14 +177,6 @@ func bl31_entrypoint
|
|||
bl bl31_early_platform_setup
|
||||
bl bl31_plat_arch_setup
|
||||
|
||||
/* ---------------------------------------------
|
||||
* Give ourselves a stack allocated in Normal
|
||||
* -IS-WBWA memory
|
||||
* ---------------------------------------------
|
||||
*/
|
||||
mrs x0, mpidr_el1
|
||||
bl platform_set_stack
|
||||
|
||||
/* ---------------------------------------------
|
||||
* Jump to main function.
|
||||
* ---------------------------------------------
|
||||
|
|
|
@ -111,12 +111,15 @@ func tsp_entrypoint
|
|||
bl zeromem16
|
||||
|
||||
/* --------------------------------------------
|
||||
* Give ourselves a small coherent stack to
|
||||
* ease the pain of initializing the MMU
|
||||
* Allocate a stack whose memory will be marked
|
||||
* as Normal-IS-WBWA when the MMU is enabled.
|
||||
* There is no risk of reading stale stack
|
||||
* memory after enabling the MMU as only the
|
||||
* primary cpu is running at the moment.
|
||||
* --------------------------------------------
|
||||
*/
|
||||
mrs x0, mpidr_el1
|
||||
bl platform_set_coherent_stack
|
||||
bl platform_set_stack
|
||||
|
||||
/* ---------------------------------------------
|
||||
* Perform early platform setup & platform
|
||||
|
@ -126,14 +129,6 @@ func tsp_entrypoint
|
|||
bl bl32_early_platform_setup
|
||||
bl bl32_plat_arch_setup
|
||||
|
||||
/* ---------------------------------------------
|
||||
* Give ourselves a stack allocated in Normal
|
||||
* -IS-WBWA memory
|
||||
* ---------------------------------------------
|
||||
*/
|
||||
mrs x0, mpidr_el1
|
||||
bl platform_set_stack
|
||||
|
||||
/* ---------------------------------------------
|
||||
* Jump to main function.
|
||||
* ---------------------------------------------
|
||||
|
|
Loading…
Add table
Reference in a new issue