From 059a9519ad1cb49f3c04210d59e89773221704a3 Mon Sep 17 00:00:00 2001 From: Jacky Bai Date: Tue, 7 Jan 2020 15:48:36 +0800 Subject: plat: imx8mq: move the stack & xlat table into ocram_s Move the stack & xlat table into ocram_s due to the ocram is not enough. Signed-off-by: Jacky Bai --- bl31/bl31.ld.S | 30 ++++++++++++++++++++++++++++++ plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c | 1 + plat/imx/imx8m/imx8mq/platform.mk | 6 ++++++ 3 files changed, 37 insertions(+) diff --git a/bl31/bl31.ld.S b/bl31/bl31.ld.S index c7d587cb..c84cff38 100644 --- a/bl31/bl31.ld.S +++ b/bl31/bl31.ld.S @@ -15,6 +15,9 @@ ENTRY(bl31_entrypoint) MEMORY { RAM (rwx): ORIGIN = BL31_BASE, LENGTH = BL31_LIMIT - BL31_BASE +#if XLAT_TABLE_IN_OCRAM_S + RAM_S (rwx): ORIGIN = 0x180000, LENGTH = 0x8000 +#endif } #ifdef PLAT_EXTRA_LD_SCRIPT @@ -198,11 +201,13 @@ SECTIONS ASSERT(. <= BL31_PROGBITS_LIMIT, "BL31 progbits has exceeded its limit.") #endif +#if !STACK_IN_OCRAM_S stacks (NOLOAD) : { __STACKS_START__ = .; *(tzfw_normal_stacks) __STACKS_END__ = .; } >RAM +#endif /* * The .bss section gets initialised to 0 at runtime. @@ -264,6 +269,7 @@ SECTIONS __BSS_END__ = .; } >RAM +#if !XLAT_TABLE_IN_OCRAM_S /* * The xlat_table section is for full, aligned page tables (4K). * Removing them from .bss avoids forcing 4K alignment on @@ -273,6 +279,7 @@ SECTIONS xlat_table (NOLOAD) : { *(xlat_table) } >RAM +#endif #if USE_COHERENT_MEM /* @@ -309,4 +316,27 @@ SECTIONS __BL31_END__ = .; ASSERT(. <= BL31_LIMIT, "BL31 image has exceeded its limit.") + +#if XLAT_TABLE_IN_OCRAM_S + /* + * The xlat_table section is for full, aligned page tables (4K). + * Removing them from .bss avoids forcing 4K alignment on + * the .bss section and eliminates the unecessary zero init + */ + . = 0x180000; + xlat_table (NOLOAD) : { + *(xlat_table) + } >RAM_S + +#if STACK_IN_OCRAM_S + stacks (NOLOAD) : { + __STACKS_START__ = .; + *(tzfw_normal_stacks) + __STACKS_END__ = .; + } >RAM_S +#endif + +ASSERT(. <= OCRAM_S_LIMIT, "OCRAM_S limit has been exceeded.") + +#endif } diff --git a/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c b/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c index a347389a..27c55454 100644 --- a/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c +++ b/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c @@ -30,6 +30,7 @@ static const mmap_region_t imx_mmap[] = { MAP_REGION_FLAT(GPV_BASE, GPV_SIZE, MT_DEVICE | MT_RW), /* GPV map */ MAP_REGION_FLAT(IMX_ROM_BASE, IMX_ROM_SIZE, MT_MEMORY | MT_RO), /* ROM map */ + MAP_REGION_FLAT(OCRAM_S_BASE, OCRAM_S_SIZE, MT_MEMORY | MT_RW), /* ROM map */ MAP_REGION_FLAT(IMX_AIPS_BASE, IMX_AIPS_SIZE, MT_DEVICE | MT_RW), /* AIPS map */ MAP_REGION_FLAT(IMX_GIC_BASE, IMX_GIC_SIZE, MT_DEVICE | MT_RW), /* GIC map */ {0}, diff --git a/plat/imx/imx8m/imx8mq/platform.mk b/plat/imx/imx8m/imx8mq/platform.mk index 80ebe406..c63559a2 100644 --- a/plat/imx/imx8m/imx8mq/platform.mk +++ b/plat/imx/imx8m/imx8mq/platform.mk @@ -37,6 +37,12 @@ BL31_SOURCES += plat/imx/common/imx8_helpers.S \ drivers/delay_timer/generic_delay_timer.c \ ${IMX_GIC_SOURCES} +XLAT_TABLE_IN_OCRAM_S := 1 +STACK_IN_OCRAM_S := 1 + +$(eval $(call add_define,XLAT_TABLE_IN_OCRAM_S)) +$(eval $(call add_define,STACK_IN_OCRAM_S)) + USE_COHERENT_MEM := 1 RESET_TO_BL31 := 1 A53_DISABLE_NON_TEMPORAL_HINT := 0 -- cgit v1.2.3