aboutsummaryrefslogtreecommitdiff
path: root/include/plat
diff options
context:
space:
mode:
authorDaniel Boulby <daniel.boulby@arm.com>2018-09-18 11:52:49 +0100
committerAntonio Nino Diaz <antonio.ninodiaz@arm.com>2018-10-03 12:06:07 +0100
commitcb4adb0d8c36e6650b8b74d27e8c7417067e8cd5 (patch)
treea95e2c9bb05b3b091d434c32022eef46313c628e /include/plat
parentc9263e62a749610c880bdc693e4e644bd9091611 (diff)
downloadarm-trusted-firmware-cb4adb0d8c36e6650b8b74d27e8c7417067e8cd5.tar.gz
FVP: Reclaim init code for the stack
Map the initialization code for BL31 to overlap with the memory required for the secondary cores stack. Once BL31 has been initialized the memory can be remapped to RW data so that it can be used for secondary cores stacks. By moving code from .text to .text.init the size of the BL31 image is decreased by a page. Split arm_common.ld.S into two linker scripts, one for tzc_dram (arm_tzc_dram.ld.S) and one for reclaiming initialization code (arm_reclaim_init.ld.S) so that platforms can chose which memory regions they wish to include. Change-Id: I648e88f3eda1aa71765744cf34343ecda9320b32 Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Diffstat (limited to 'include/plat')
-rw-r--r--include/plat/arm/common/arm_def.h2
-rw-r--r--include/plat/arm/common/arm_reclaim_init.ld.S36
-rw-r--r--include/plat/arm/common/arm_tzc_dram.ld.S (renamed from include/plat/arm/common/arm_common.ld.S)6
-rw-r--r--include/plat/arm/common/plat_arm.h6
4 files changed, 46 insertions, 4 deletions
diff --git a/include/plat/arm/common/arm_def.h b/include/plat/arm/common/arm_def.h
index 23cd12f51..8d81af960 100644
--- a/include/plat/arm/common/arm_def.h
+++ b/include/plat/arm/common/arm_def.h
@@ -280,7 +280,7 @@
* The max number of regions like RO(code), coherent and data required by
* different BL stages which need to be mapped in the MMU.
*/
-# define ARM_BL_REGIONS 4
+#define ARM_BL_REGIONS 5
#define MAX_MMAP_REGIONS (PLAT_ARM_MMAP_ENTRIES + \
ARM_BL_REGIONS)
diff --git a/include/plat/arm/common/arm_reclaim_init.ld.S b/include/plat/arm/common/arm_reclaim_init.ld.S
new file mode 100644
index 000000000..8f22170fe
--- /dev/null
+++ b/include/plat/arm/common/arm_reclaim_init.ld.S
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+#ifndef ARM_RECLAIM_INIT_LD_S
+#define ARM_RECLAIM_INIT_LD_S
+
+SECTIONS
+{
+ .init __STACKS_START__ : {
+ . = . + PLATFORM_STACK_SIZE;
+ . = ALIGN(PAGE_SIZE);
+ __INIT_CODE_START__ = .;
+ /*
+ * Exclude PSCI initialization functions to ensure the init section
+ * does not become larger than the overlaid stack region
+ */
+ *(EXCLUDE_FILE (*psci_setup.o).text.init*)
+ __INIT_CODE_UNALIGNED__ = .;
+ . = ALIGN(PAGE_SIZE);
+ __INIT_CODE_END__ = .;
+ } >RAM
+
+#ifdef BL31_PROGBITS_LIMIT
+ ASSERT(__INIT_CODE_END__ <= BL31_PROGBITS_LIMIT,
+ "BL31 init has exceeded progbits limit.")
+#endif
+
+#if RECLAIM_INIT_CODE
+ ASSERT(__INIT_CODE_END__ <= __STACKS_END__,
+ "Init code ends past the end of the stacks")
+#endif
+}
+
+#endif /* ARM_RECLAIM_INIT_LD_S */
diff --git a/include/plat/arm/common/arm_common.ld.S b/include/plat/arm/common/arm_tzc_dram.ld.S
index 3f6e29b0a..df951e117 100644
--- a/include/plat/arm/common/arm_common.ld.S
+++ b/include/plat/arm/common/arm_tzc_dram.ld.S
@@ -3,8 +3,8 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#ifndef __ARM_COMMON_LD_S__
-#define __ARM_COMMON_LD_S__
+#ifndef ARM_TZC_DRAM_LD_S__
+#define ARM_TZC_DRAM_LD_S__
#include <xlat_tables_defs.h>
@@ -27,4 +27,4 @@ SECTIONS
} >EL3_SEC_DRAM
}
-#endif /* __ARM_COMMON_LD_S__ */
+#endif /* ARM_TZC_DRAM_LD_S__ */
diff --git a/include/plat/arm/common/plat_arm.h b/include/plat/arm/common/plat_arm.h
index 3f344abce..d543894d7 100644
--- a/include/plat/arm/common/plat_arm.h
+++ b/include/plat/arm/common/plat_arm.h
@@ -221,6 +221,12 @@ void arm_bl1_set_mbedtls_heap(void);
int arm_get_mbedtls_heap(void **heap_addr, size_t *heap_size);
/*
+ * Free the memory storing initialization code only used during an images boot
+ * time so it can be reclaimed for runtime data
+ */
+void arm_free_init_memory(void);
+
+/*
* Mandatory functions required in ARM standard platforms
*/
unsigned int plat_arm_get_cluster_core_count(u_register_t mpidr);