From c54bf9f7f15d7989181c001abef8b8d72cf403bb Mon Sep 17 00:00:00 2001 From: Wei-Chia Su Date: Sat, 18 Jan 2025 00:16:20 +0000 Subject: [PATCH 1/2] Build System: Add build option on specific trusted RAM size This patch adds build option SCP_SET_TRUSTED_RAM_SIZE to configure trusted RAM size (in KB). Signed-off-by: Wei-Chia Su --- framework/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/framework/CMakeLists.txt b/framework/CMakeLists.txt index 8353ccaff..bb35fe889 100644 --- a/framework/CMakeLists.txt +++ b/framework/CMakeLists.txt @@ -1,6 +1,6 @@ # # Arm SCP/MCP Software -# Copyright (c) 2021-2024, Arm Limited and Contributors. All rights reserved. +# Copyright (c) 2021-2025, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -147,6 +147,10 @@ if(SCP_ENABLE_AE_EXTENSION) target_compile_definitions(framework PUBLIC "BUILD_HAS_AE_EXTENSION") endif() +if(SCP_SET_TRUSTED_RAM_SIZE) + target_compile_definitions(framework PUBLIC "BUILD_WITH_TRUSTED_RAM_SIZE=${SCP_SET_TRUSTED_RAM_SIZE}") +endif() + # # Handle the framework logging filter level. # -- GitLab From 1a2030700689b40642c0979f0f5434bd02931b9e Mon Sep 17 00:00:00 2001 From: Wei-Chia Su Date: Sat, 18 Jan 2025 00:19:02 +0000 Subject: [PATCH 2/2] Build System: Support configurable option for trusted RAM size This patch adds configurable RAM size (default: 256KB) on Juno and SGM775/776 platform. Signed-off-by: Wei-Chia Su --- product/juno/include/scp_mmap.h | 8 +++++++- product/juno/scp_romfw/config_bootloader.c | 4 ++-- product/juno/scp_romfw_bypass/config_bootloader.c | 4 ++-- product/sgm775/include/system_mmap_scp.h | 8 +++++++- product/sgm775/scp_romfw/config_bootloader.c | 4 ++-- product/sgm776/include/system_mmap_scp.h | 8 +++++++- product/sgm776/scp_romfw/config_bootloader.c | 4 ++-- 7 files changed, 29 insertions(+), 11 deletions(-) diff --git a/product/juno/include/scp_mmap.h b/product/juno/include/scp_mmap.h index 6b36249fd..3cf95ac51 100644 --- a/product/juno/include/scp_mmap.h +++ b/product/juno/include/scp_mmap.h @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2019-2021, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2019-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -19,4 +19,10 @@ #define SCP_RAM_BASE 0x10000000 +#ifndef BUILD_WITH_TRUSTED_RAM_SIZE +# define TRUSTED_RAM_SIZE (256 * 1024) +#else +# define TRUSTED_RAM_SIZE (BUILD_WITH_TRUSTED_RAM_SIZE * 1024) +#endif + #endif /* SCP_MMAP_H */ diff --git a/product/juno/scp_romfw/config_bootloader.c b/product/juno/scp_romfw/config_bootloader.c index ba7ea22f6..f07b8866c 100644 --- a/product/juno/scp_romfw/config_bootloader.c +++ b/product/juno/scp_romfw/config_bootloader.c @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2019-2021, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2019-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -15,7 +15,7 @@ static const struct mod_bootloader_config bootloader_module_config = { .source_base = TRUSTED_RAM_BASE, - .source_size = 256 * 1024, + .source_size = TRUSTED_RAM_SIZE, .destination_base = SCP_RAM_BASE, .destination_size = SCP_RAM_SIZE, .sds_struct_id = (uint32_t)JUNO_SDS_BOOTLOADER, diff --git a/product/juno/scp_romfw_bypass/config_bootloader.c b/product/juno/scp_romfw_bypass/config_bootloader.c index ba7ea22f6..f07b8866c 100644 --- a/product/juno/scp_romfw_bypass/config_bootloader.c +++ b/product/juno/scp_romfw_bypass/config_bootloader.c @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2019-2021, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2019-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -15,7 +15,7 @@ static const struct mod_bootloader_config bootloader_module_config = { .source_base = TRUSTED_RAM_BASE, - .source_size = 256 * 1024, + .source_size = TRUSTED_RAM_SIZE, .destination_base = SCP_RAM_BASE, .destination_size = SCP_RAM_SIZE, .sds_struct_id = (uint32_t)JUNO_SDS_BOOTLOADER, diff --git a/product/sgm775/include/system_mmap_scp.h b/product/sgm775/include/system_mmap_scp.h index ee71c65f3..9c6c7637c 100644 --- a/product/sgm775/include/system_mmap_scp.h +++ b/product/sgm775/include/system_mmap_scp.h @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2015-2021, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -18,4 +18,10 @@ #define SCP_ROM_SIZE (64 * 1024) #define SCP_RAM_SIZE (128 * 1024) +#ifndef BUILD_WITH_TRUSTED_RAM_SIZE +# define TRUSTED_RAM_SIZE (256 * 1024) +#else +# define TRUSTED_RAM_SIZE (BUILD_WITH_TRUSTED_RAM_SIZE * 1024) +#endif + #endif /* SYSTEM_MMAP_SCP_H */ diff --git a/product/sgm775/scp_romfw/config_bootloader.c b/product/sgm775/scp_romfw/config_bootloader.c index e9b89d075..6d998b8fd 100644 --- a/product/sgm775/scp_romfw/config_bootloader.c +++ b/product/sgm775/scp_romfw/config_bootloader.c @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2017-2021, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -16,7 +16,7 @@ static const struct mod_bootloader_config bootloader_module_config = { .source_base = TRUSTED_RAM_BASE, - .source_size = 256 * 1024, + .source_size = TRUSTED_RAM_SIZE, .destination_base = SCP_RAM_BASE, .destination_size = SCP_RAM_SIZE, .sds_struct_id = SGM775_SDS_BOOTLOADER, diff --git a/product/sgm776/include/system_mmap_scp.h b/product/sgm776/include/system_mmap_scp.h index 80d724bb3..d3b4da913 100644 --- a/product/sgm776/include/system_mmap_scp.h +++ b/product/sgm776/include/system_mmap_scp.h @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2017-2021, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -18,4 +18,10 @@ #define SCP_ROM_SIZE (64 * 1024) #define SCP_RAM_SIZE (128 * 1024) +#ifndef BUILD_WITH_TRUSTED_RAM_SIZE +# define TRUSTED_RAM_SIZE (256 * 1024) +#else +# define TRUSTED_RAM_SIZE (BUILD_WITH_TRUSTED_RAM_SIZE * 1024) +#endif + #endif /* SYSTEM_MMAP_SCP_H */ diff --git a/product/sgm776/scp_romfw/config_bootloader.c b/product/sgm776/scp_romfw/config_bootloader.c index 54563ace7..bcc13c1a2 100644 --- a/product/sgm776/scp_romfw/config_bootloader.c +++ b/product/sgm776/scp_romfw/config_bootloader.c @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2017-2021, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -16,7 +16,7 @@ static const struct mod_bootloader_config bootloader_module_config = { .source_base = TRUSTED_RAM_BASE, - .source_size = 256 * 1024, + .source_size = TRUSTED_RAM_SIZE, .destination_base = SCP_RAM_BASE, .destination_size = SCP_RAM_SIZE, .sds_struct_id = SGM776_SDS_BOOTLOADER, -- GitLab