From 8416e7917f9c82336e900659d35038942418582f Mon Sep 17 00:00:00 2001 From: Levi Yun Date: Wed, 24 Jul 2024 18:03:58 +0100 Subject: [PATCH] feat(fvp): add StandaloneMm manifest in fvp Support StandaloneMm running with FF-A as S-EL0 SP when TF-A is built with EL3 SPMC partition manager. For this 1. add manifest file describing StandaloneMm partition. 2. add number of page mapping area. 3. StandaloneMm should use SRAM with 512K. while enabling, StandaloneMm, BL1 image requires more size: aarch64-none-elf/bin/ld: BL31 image has exceeded its limit. aarch64-none-elf/bin/ld: region `RAM' overflowed by 16384 bytes So, when using SRAM size with 512K configuration, increase size limit of BL1 binary. Signed-off-by: Levi Yun Change-Id: Idaa1db510340ebb812cfd13588610b2eea941918 --- plat/arm/board/fvp/fdts/fvp_stmm_manifest.dts | 146 ++++++++++++++++++ plat/arm/board/fvp/include/platform_def.h | 5 +- 2 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 plat/arm/board/fvp/fdts/fvp_stmm_manifest.dts diff --git a/plat/arm/board/fvp/fdts/fvp_stmm_manifest.dts b/plat/arm/board/fvp/fdts/fvp_stmm_manifest.dts new file mode 100644 index 000000000..df6810f56 --- /dev/null +++ b/plat/arm/board/fvp/fdts/fvp_stmm_manifest.dts @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/dts-v1/; + +#include + +/ { +#define MODE_SEL0 (0x1) +#define MODE_SEL1 (0x2) + +#define SECURE_RO 0x1 +#define SECURE_RW 0x3 +#define SECURE_EXECUTE_RO 0x5 +#define SECURE_EXECUTE_RW 0x7 +#define NON_SECURE_RO 0x9 +#define NON_SECURE_RW 0xB +#define NON_SECURE_EXECUTE_RO 0xD +#define NON_SECURE_EXECUTE_RW 0xF + /* + * FF-A compatible Secure Partition Manager parses the + * config file and fetch the following booting arguments to + * pass on to the StandAloneMM(StMM) Secure Partition. + */ + compatible = "arm,ffa-manifest-1.0"; + + description = "FVP Base StandaloneMm"; + ffa-version = <0x00010002>; /* 31:16 - Major, 15:0 - Minor */ + uuid = <0xdcae8d37 0x46446bf0 0xab401483 0xa3873c93>; + id = <0x8001>; + execution-ctx-count = ; + exception-level = ; /* SEL0*/ + execution-state = <0>; /* AArch64*/ + load-address = <0x0 0xff200000>; + image-size = <0x0 0x00300000>; + xlat-granule = <0>; /* 4KiB */ + boot-order = <0>; + messaging-method = <0x603>; /* Direct req/resp/req2/resp2 supported. */ + gp-register-num = <0>; + + device-regions { + compatible = "arm,ffa-manifest-device-regions"; + + /** + * System registers, rtc, uart and etc regions for access from S-EL0. + */ + io_fpga { + base-address = <0x0 0x1C000000>; + pages-count = <0x3000>; + attributes = ; + }; + + system_reg_el0 { + base-address = <0x0 0x1C010000>; + pages-count = <0x10>; + attributes = ; + }; + + /** + * ARM CSS SoC Peripherals area. + * Similar to SOC_CSS_MAP_DEVICE. + */ + soc_components { + base-address = <0x0 0x20000000>; + pages-count = <0xc200>; + attributes = ; + }; + + /** + * NOR0 Flash region, used for Firmware Image Update. + */ + nor_flash0 { + base-address = <0x0 0x08000000>; + pages-count = <0x4000>; + attributes = ; + }; + + /** + * NOR1 Flash region, used for Secure booting. + */ + nor_flash1 { + base-address = <0x0 0x0c000000>; + pages-count = <0x4000>; + attributes = ; + }; + }; + + memory-regions { + compatible = "arm,ffa-manifest-memory-regions"; + + /* + * SPM Payload memory. Mapped as code region for S-EL0 + * Similar to ARM_SP_IMAGE_MMAP. + */ + stmm_region { + description = "image"; + base-address = <0x0 0xff200000>; + pages-count = <0x300>; + /* StMM will remap the regions during runtime */ + attributes = ; + }; + + /* + * Memory shared between EL3 and S-EL0. + * Similar to ARM_SPM_BUF_EL0_MMAP. + */ + rx-tx-buffers { + description = "shared-buff"; + base-address = <0x0 0xff500000>; + pages-count = <0x100>; + attributes = ; + }; + + /* + * Memory shared between Normal world and S-EL0. + * Similar to ARM_SP_IMAGE_NS_BUF_MMAP. + */ + ns_comm_buffer { + /* + * Description is needed for StMM to identify + * ns-communication buffer. + */ + description = "ns-comm"; + base-address = <0x0 0xff600000>; + pages-count = <0x10>; + attributes = ; + }; + + /* + * Heap used by SP to allocate memory for DMA. + */ + heap { + /* + * Description is needed for StMM to identify + * heap buffer. + */ + description = "heap"; + base-address = <0x0 0xFF610000>; + pages-count = <0x7F0>; + attributes = ; + }; + }; +}; diff --git a/plat/arm/board/fvp/include/platform_def.h b/plat/arm/board/fvp/include/platform_def.h index e0c9725ce..df4be8f7c 100644 --- a/plat/arm/board/fvp/include/platform_def.h +++ b/plat/arm/board/fvp/include/platform_def.h @@ -170,6 +170,8 @@ # elif SPMC_AT_EL3 # define PLAT_ARM_MMAP_ENTRIES 13 # define MAX_XLAT_TABLES 11 +# define PLAT_SP_IMAGE_MMAP_REGIONS 30 +# define PLAT_SP_IMAGE_MAX_XLAT_TABLES 10 # else # define PLAT_ARM_MMAP_ENTRIES 9 # if USE_DEBUGFS @@ -220,7 +222,8 @@ defined(IMAGE_BL2) && MEASURED_BOOT * In case of PSA Crypto API, few algorithms like ECDSA needs bigger BL1 RW * area. */ -#if TF_MBEDTLS_KEY_ALG_ID == TF_MBEDTLS_RSA_AND_ECDSA || PSA_CRYPTO +#if TF_MBEDTLS_KEY_ALG_ID == TF_MBEDTLS_RSA_AND_ECDSA || PSA_CRYPTO || \ +FVP_TRUSTED_SRAM_SIZE == 512 #define PLAT_ARM_MAX_BL1_RW_SIZE UL(0xC000) #else #define PLAT_ARM_MAX_BL1_RW_SIZE UL(0xB000)