Skip to content

Commit e437bc8

Browse files
hartun01jonmason
authored andcommitted
arm-bsp/trusted-firmware-m: corstone1000: Multicore support for Corstone-1000 FVP
This changeset introduces the multicore support for the Corstone-1000 FVP. Signed-off-by: Harsimran Singh Tungal <harsimransingh.tungal@arm.com>
1 parent 3eaa5c6 commit e437bc8

2 files changed

Lines changed: 120 additions & 0 deletions

File tree

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
From 1120957e74a1a0727a215188813cab3e47602e71 Mon Sep 17 00:00:00 2001
2+
From: Harsimran Singh Tungal <harsimransingh.tungal@arm.com>
3+
Date: Thu, 9 May 2024 13:20:57 +0000
4+
Subject: [PATCH] platform: CS1000: Add multicore support for FVP
5+
6+
This changeset adds the support to enable the secondary cores for
7+
the Corstone-1000 FVP
8+
9+
Upstream-Status: Submitted [https://review.trustedfirmware.org/c/TF-M/trusted-firmware-m/+/29242]
10+
Signed-off-by: Harsimran Singh Tungal <harsimransingh.tungal@arm.com>
11+
---
12+
.../target/arm/corstone1000/CMakeLists.txt | 6 +++
13+
.../corstone1000/Device/Config/device_cfg.h | 6 +++
14+
.../arm/corstone1000/tfm_hal_multi_core.c | 38 ++++++++++++++++++-
15+
3 files changed, 48 insertions(+), 2 deletions(-)
16+
17+
diff --git a/platform/ext/target/arm/corstone1000/CMakeLists.txt b/platform/ext/target/arm/corstone1000/CMakeLists.txt
18+
index e2a7ac302..a269251aa 100644
19+
--- a/platform/ext/target/arm/corstone1000/CMakeLists.txt
20+
+++ b/platform/ext/target/arm/corstone1000/CMakeLists.txt
21+
@@ -374,6 +374,12 @@ target_sources(tfm_psa_rot_partition_ns_agent_mailbox
22+
tfm_hal_multi_core.c
23+
)
24+
25+
+if (PLATFORM_IS_FVP)
26+
+target_compile_definitions(tfm_psa_rot_partition_ns_agent_mailbox
27+
+ PUBLIC
28+
+ $<$<BOOL:${ENABLE_MULTICORE}>:CORSTONE1000_FVP_MULTICORE>
29+
+)
30+
+endif()
31+
#========================= tfm_spm ============================================#
32+
33+
target_sources(tfm_spm
34+
diff --git a/platform/ext/target/arm/corstone1000/Device/Config/device_cfg.h b/platform/ext/target/arm/corstone1000/Device/Config/device_cfg.h
35+
index 222905d3d..9d48f119e 100644
36+
--- a/platform/ext/target/arm/corstone1000/Device/Config/device_cfg.h
37+
+++ b/platform/ext/target/arm/corstone1000/Device/Config/device_cfg.h
38+
@@ -45,5 +45,11 @@
39+
/* CFI Controller */
40+
#define CFI_S
41+
42+
+/* Total number of host cores */
43+
+#if CORSTONE1000_FVP_MULTICORE
44+
+#define PLATFORM_HOST_MAX_CORE_COUNT 4
45+
+#else
46+
+#define PLATFORM_HOST_MAX_CORE_COUNT 1
47+
+#endif
48+
49+
#endif /* __DEVICE_CFG_H__ */
50+
diff --git a/platform/ext/target/arm/corstone1000/tfm_hal_multi_core.c b/platform/ext/target/arm/corstone1000/tfm_hal_multi_core.c
51+
index f0e2bc333..ce72e50c9 100644
52+
--- a/platform/ext/target/arm/corstone1000/tfm_hal_multi_core.c
53+
+++ b/platform/ext/target/arm/corstone1000/tfm_hal_multi_core.c
54+
@@ -11,9 +11,14 @@
55+
#include "tfm_hal_multi_core.h"
56+
#include "fwu_agent.h"
57+
58+
-#define HOST_SYS_RST_CTRL_OFFSET 0x0
59+
+#define HOST_SYS_RST_CTRL_OFFSET 0x000
60+
+#define HOST_CPU_PE0_CONFIG_OFFSET 0x010
61+
+#define HOST_CPU_PE1_CONFIG_OFFSET 0x020
62+
+#define HOST_CPU_PE2_CONFIG_OFFSET 0x030
63+
+#define HOST_CPU_PE3_CONFIG_OFFSET 0x040
64+
+#define HOST_CPU_BOOT_MASK_OFFSET 0x300
65+
#define HOST_CPU_CORE0_WAKEUP_OFFSET 0x308
66+
-#define HOST_CPU_PE0_CONFIG_OFFSET 0x010
67+
+
68+
#define AA64nAA32_MASK (1 << 3)
69+
70+
#ifdef EXTERNAL_SYSTEM_SUPPORT
71+
@@ -53,9 +58,29 @@ void tfm_hal_boot_ns_cpu(uintptr_t start_addr)
72+
volatile uint32_t *PE0_CONFIG =
73+
(uint32_t *)(CORSTONE1000_HOST_BASE_SYSTEM_CONTROL_BASE
74+
+ HOST_CPU_PE0_CONFIG_OFFSET);
75+
+#if CORSTONE1000_FVP_MULTICORE
76+
+ volatile uint32_t *PE1_CONFIG =
77+
+ (uint32_t *)(CORSTONE1000_HOST_BASE_SYSTEM_CONTROL_BASE
78+
+ + HOST_CPU_PE1_CONFIG_OFFSET);
79+
+ volatile uint32_t *PE2_CONFIG =
80+
+ (uint32_t *)(CORSTONE1000_HOST_BASE_SYSTEM_CONTROL_BASE
81+
+ + HOST_CPU_PE2_CONFIG_OFFSET);
82+
+ volatile uint32_t *PE3_CONFIG =
83+
+ (uint32_t *)(CORSTONE1000_HOST_BASE_SYSTEM_CONTROL_BASE
84+
+ + HOST_CPU_PE3_CONFIG_OFFSET);
85+
+ volatile uint32_t *CPU_BOOT_MASK =
86+
+ (uint32_t *)(CORSTONE1000_HOST_BASE_SYSTEM_CONTROL_BASE
87+
+ + HOST_CPU_BOOT_MASK_OFFSET);
88+
89+
+ *CPU_BOOT_MASK = 0xf;
90+
+#endif
91+
/* Select host CPU architecture as AArch64 */
92+
*PE0_CONFIG |= AA64nAA32_MASK; /* 0b1 – AArch64 */
93+
+#if CORSTONE1000_FVP_MULTICORE
94+
+ *PE1_CONFIG |= AA64nAA32_MASK; /* 0b1 – AArch64 */
95+
+ *PE2_CONFIG |= AA64nAA32_MASK; /* 0b1 – AArch64 */
96+
+ *PE3_CONFIG |= AA64nAA32_MASK; /* 0b1 – AArch64 */
97+
+#endif
98+
99+
/* wakeup CORE0 before bringing it out of reset */
100+
*reset_ctl_wakeup_reg = 0x1;
101+
@@ -63,6 +88,15 @@ void tfm_hal_boot_ns_cpu(uintptr_t start_addr)
102+
/* Clear HOST_SYS_RST_CTRL register to bring host out of RESET */
103+
*reset_ctl_reg = 0;
104+
105+
+#if CORSTONE1000_FVP_MULTICORE
106+
+ /* Wake up secondary cores.
107+
+ * This should be done after bringing the primary core out of reset. */
108+
+ for(int core_index=1; core_index < PLATFORM_HOST_MAX_CORE_COUNT; core_index++)
109+
+ {
110+
+ *reset_ctl_wakeup_reg = (0x1 << core_index);
111+
+ }
112+
+#endif
113+
+
114+
(void) start_addr;
115+
116+
#ifdef EXTERNAL_SYSTEM_SUPPORT
117+
--
118+
2.34.1
119+

meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-corstone1000.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ SRC_URI:append:corstone1000 = " \
2929
file://0010-CC312-alignment-of-cc312-differences-between-fvp-and.patch \
3030
file://0011-Platform-corstone1000-Increase-buffers-for-EFI-vars.patch \
3131
file://0012-corstone1000-Remove-reset-after-capsule-update.patch \
32+
file://0013-platform-CS1000-Add-multicore-support-for-FVP.patch \
3233
"
3334

3435
# TF-M ships patches for external dependencies that needs to be applied

0 commit comments

Comments
 (0)