mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-22 20:38:03 +00:00
fix(zynqmp): conditional reservation of memory in DTB
When the TF-A is placed in DDR memory range, the DDR memory range is getting explicitly reserved in the default device tree by TF-A. This creates an error condition in the use case where Device tree is not present or it is present at a different location. To fix this, a new build time parameter, XILINX_OF_BOARD_DTB_ADDR, is introduced. The TF-A will reserve the DDR memory only when a valid DTB address is provided to XILINX_OF_BOARD_DTB_ADDR during build. Now the user has options, either manually reserve the desired DDR address range for TF-A in device tree or let TF-A access and modify the device tree, to reserve the DDR address range, in runtime using the build parameter. Change-Id: I846fa373ba9f7c984eda3a55ccaaa622082cad81 Signed-off-by: Akshay Belsare <akshay.belsare@amd.com>
This commit is contained in:
parent
88844f6de2
commit
c52a142b7c
4 changed files with 42 additions and 10 deletions
|
@ -31,6 +31,7 @@ To build TF-A for JTAG DCC console:
|
||||||
ZynqMP platform specific build options
|
ZynqMP platform specific build options
|
||||||
--------------------------------------
|
--------------------------------------
|
||||||
|
|
||||||
|
- ``XILINX_OF_BOARD_DTB_ADDR`` : Specifies the base address of Device tree.
|
||||||
- ``ZYNQMP_ATF_MEM_BASE``: Specifies the base address of the bl31 binary.
|
- ``ZYNQMP_ATF_MEM_BASE``: Specifies the base address of the bl31 binary.
|
||||||
- ``ZYNQMP_ATF_MEM_SIZE``: Specifies the size of the memory region of the bl31 binary.
|
- ``ZYNQMP_ATF_MEM_SIZE``: Specifies the size of the memory region of the bl31 binary.
|
||||||
- ``ZYNQMP_BL32_MEM_BASE``: Specifies the base address of the bl32 binary.
|
- ``ZYNQMP_BL32_MEM_BASE``: Specifies the base address of the bl32 binary.
|
||||||
|
@ -47,13 +48,33 @@ ZynqMP Debug behavior
|
||||||
With DEBUG=1, TF-A for ZynqMP uses DDR memory range instead of OCM memory range
|
With DEBUG=1, TF-A for ZynqMP uses DDR memory range instead of OCM memory range
|
||||||
due to size constraints.
|
due to size constraints.
|
||||||
For DEBUG=1 configuration for ZynqMP the BL31_BASE is set to the DDR location
|
For DEBUG=1 configuration for ZynqMP the BL31_BASE is set to the DDR location
|
||||||
of 0x1000 and BL31_LIMIT is set to DDR location of 0x7FFFF.
|
of 0x1000 and BL31_LIMIT is set to DDR location of 0x7FFFF. By default the
|
||||||
|
above memory range will NOT be reserved in device tree.
|
||||||
|
|
||||||
If the user wants to move the bl31 to a different DDR location, user can provide
|
To reserve the above memory range in device tree, the device tree base address
|
||||||
the DDR address location in the build command as follows,
|
must be provided during build as,
|
||||||
|
|
||||||
make CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1 DEBUG=1 \
|
make CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1 DEBUG=1 \
|
||||||
ZYNQMP_ATF_MEM_BASE=<DDR address> ZYNQMP_ATF_MEM_SIZE=<size> bl31
|
XILINX_OF_BOARD_DTB_ADDR=<DTB address> bl31
|
||||||
|
|
||||||
|
The default DTB base address for ZynqMP platform is 0x100000. This default value
|
||||||
|
is not set in the code and to use this default address, user still needs to
|
||||||
|
provide it through the build command as above.
|
||||||
|
|
||||||
|
If the user wants to move the bl31 to a different DDR location, user can provide
|
||||||
|
the DDR address location using the build time parameters ZYNQMP_ATF_MEM_BASE and
|
||||||
|
ZYNQMP_ATF_MEM_SIZE.
|
||||||
|
|
||||||
|
The DDR address must be reserved in the DTB by the user, either by manually
|
||||||
|
adding the reserved memory node, in the device tree, with the required address
|
||||||
|
range OR let TF-A modify the device tree on the run.
|
||||||
|
|
||||||
|
To let TF-A access and modify the device tree, the DTB address must be provided
|
||||||
|
to the build command as follows,
|
||||||
|
|
||||||
|
make CROSS_COMPILE=aarch64-none-elf- PLAT=zynqmp RESET_TO_BL31=1 DEBUG=1 \
|
||||||
|
ZYNQMP_ATF_MEM_BASE=<DDR address> ZYNQMP_ATF_MEM_SIZE=<size> \
|
||||||
|
XILINX_OF_BOARD_DTB_ADDR=<DTB address> bl31
|
||||||
|
|
||||||
|
|
||||||
FSBL->TF-A Parameter Passing
|
FSBL->TF-A Parameter Passing
|
||||||
|
|
|
@ -171,7 +171,7 @@ static uint64_t rdo_el3_interrupt_handler(uint32_t id, uint32_t flags,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (BL31_LIMIT < PLAT_DDR_LOWMEM_MAX)
|
#if (defined(XILINX_OF_BOARD_DTB_ADDR) && !IS_TFA_IN_OCM(BL31_BASE))
|
||||||
static void prepare_dtb(void)
|
static void prepare_dtb(void)
|
||||||
{
|
{
|
||||||
void *dtb = (void *)XILINX_OF_BOARD_DTB_ADDR;
|
void *dtb = (void *)XILINX_OF_BOARD_DTB_ADDR;
|
||||||
|
@ -217,7 +217,7 @@ static void prepare_dtb(void)
|
||||||
|
|
||||||
void bl31_platform_setup(void)
|
void bl31_platform_setup(void)
|
||||||
{
|
{
|
||||||
#if (BL31_LIMIT < PLAT_DDR_LOWMEM_MAX)
|
#if (defined(XILINX_OF_BOARD_DTB_ADDR) && !IS_TFA_IN_OCM(BL31_BASE))
|
||||||
prepare_dtb();
|
prepare_dtb();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ void bl31_plat_arch_setup(void)
|
||||||
plat_arm_interconnect_enter_coherency();
|
plat_arm_interconnect_enter_coherency();
|
||||||
|
|
||||||
const mmap_region_t bl_regions[] = {
|
const mmap_region_t bl_regions[] = {
|
||||||
#if (BL31_LIMIT < PLAT_DDR_LOWMEM_MAX)
|
#if (defined(XILINX_OF_BOARD_DTB_ADDR) && !IS_TFA_IN_OCM(BL31_BASE))
|
||||||
MAP_REGION_FLAT(XILINX_OF_BOARD_DTB_ADDR, XILINX_OF_BOARD_DTB_MAX_SIZE,
|
MAP_REGION_FLAT(XILINX_OF_BOARD_DTB_ADDR, XILINX_OF_BOARD_DTB_MAX_SIZE,
|
||||||
MT_MEMORY | MT_RW | MT_NS),
|
MT_MEMORY | MT_RW | MT_NS),
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014-2022, ARM Limited and Contributors. All rights reserved.
|
* Copyright (c) 2014-2022, ARM Limited and Contributors. All rights reserved.
|
||||||
|
* Copyright (c) 2018-2022, Xilinx, Inc. All rights reserved.
|
||||||
|
* Copyright (c) 2022-2023, Advanced Micro Devices, Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -83,15 +85,18 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Platform specific page table and MMU setup constants
|
* Platform specific page table and MMU setup constants
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#define XILINX_OF_BOARD_DTB_ADDR U(0x100000)
|
|
||||||
#define XILINX_OF_BOARD_DTB_MAX_SIZE U(0x200000)
|
#define XILINX_OF_BOARD_DTB_MAX_SIZE U(0x200000)
|
||||||
#define PLAT_DDR_LOWMEM_MAX U(0x80000000)
|
#define PLAT_DDR_LOWMEM_MAX U(0x80000000)
|
||||||
|
#define PLAT_OCM_BASE U(0xFFFC0000)
|
||||||
|
#define PLAT_OCM_LIMIT U(0xFFFFFFFF)
|
||||||
|
|
||||||
|
#define IS_TFA_IN_OCM(x) ((x >= PLAT_OCM_BASE) && (x < PLAT_OCM_LIMIT))
|
||||||
|
|
||||||
#define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 32)
|
#define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 32)
|
||||||
#define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 32)
|
#define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 32)
|
||||||
|
|
||||||
#ifndef MAX_MMAP_REGIONS
|
#ifndef MAX_MMAP_REGIONS
|
||||||
#if (BL31_LIMIT < PLAT_DDR_LOWMEM_MAX)
|
#if (defined(XILINX_OF_BOARD_DTB_ADDR) && !IS_TFA_IN_OCM(BL31_BASE))
|
||||||
#define MAX_MMAP_REGIONS 8
|
#define MAX_MMAP_REGIONS 8
|
||||||
#else
|
#else
|
||||||
#define MAX_MMAP_REGIONS 7
|
#define MAX_MMAP_REGIONS 7
|
||||||
|
@ -99,7 +104,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MAX_XLAT_TABLES
|
#ifndef MAX_XLAT_TABLES
|
||||||
#if (BL31_LIMIT < PLAT_DDR_LOWMEM_MAX)
|
#if !IS_TFA_IN_OCM(BL31_BASE)
|
||||||
#define MAX_XLAT_TABLES 8
|
#define MAX_XLAT_TABLES 8
|
||||||
#else
|
#else
|
||||||
#define MAX_XLAT_TABLES 5
|
#define MAX_XLAT_TABLES 5
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013-2021, ARM Limited and Contributors. All rights reserved.
|
# Copyright (c) 2013-2021, ARM Limited and Contributors. All rights reserved.
|
||||||
# Portions copyright (c) 2021-2022, ProvenRun S.A.S. All rights reserved.
|
# Portions copyright (c) 2021-2022, ProvenRun S.A.S. All rights reserved.
|
||||||
|
# Copyright (c) 2018-2022, Xilinx, Inc. All rights reserved.
|
||||||
|
# Copyright (c) 2022-2023, Advanced Micro Devices, Inc. All rights reserved.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
@ -75,6 +77,10 @@ ifdef ZYNQMP_SECURE_EFUSES
|
||||||
$(eval $(call add_define,ZYNQMP_SECURE_EFUSES))
|
$(eval $(call add_define,ZYNQMP_SECURE_EFUSES))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef XILINX_OF_BOARD_DTB_ADDR
|
||||||
|
$(eval $(call add_define,XILINX_OF_BOARD_DTB_ADDR))
|
||||||
|
endif
|
||||||
|
|
||||||
PLAT_INCLUDES := -Iinclude/plat/arm/common/ \
|
PLAT_INCLUDES := -Iinclude/plat/arm/common/ \
|
||||||
-Iinclude/plat/arm/common/aarch64/ \
|
-Iinclude/plat/arm/common/aarch64/ \
|
||||||
-Iplat/xilinx/common/include/ \
|
-Iplat/xilinx/common/include/ \
|
||||||
|
|
Loading…
Add table
Reference in a new issue