Skip to content

Commit 25148ce

Browse files
hartun01hugueskamba
authored andcommitted
feat(corstone-1000): add Cortex-A320 support
Introduce `CORSTONE1000_CORTEX_A320` to enable Cortex-A320 on Corstone-1000 while keeping Cortex-A35 as the default. When the define is enabled, the build switches from `cortex_a35.S` to `cortex_a320.S`, maintaining compatibility with existing A35-based designs. Also add Normal-World mappings for the Ethos-U85 NPU and its SRAM on Cortex-A320 platforms so U-Boot and other non-secure software can safely access these regions: * **Ethos-U85 registers**: base `0x1A050000`, size `0x00004000` (16 KB), attrs `MT_DEVICE | MT_RW | MT_NS` * **Non-secure SRAM**: base `0x02400000`, size `0x00400000` (4 MB), attrs `MT_MEMORY | MT_RW | MT_NS` Enable GICv3 with GIC-600 when building for Cortex-A320 (retain GICv2/GIC-400 for Cortex-A35): * Update `plat_my_core_pos()` and `plat_arm_calc_core_pos()` to use the Cortex-A320 MPIDR_EL1 affinity layout. * Add an A320-specific core-position routine in assembly guarded by `CORSTONE1000_CORTEX_A320`. * Switch to the GICv3 driver with GIC-600 extensions: update GIC base addresses, use GICv3 APIs, and set `USE_GIC_DRIVER=3`, `GICV3_SUPPORT_GIC600=1`, `GIC_ENABLE_V4_EXTN=1`. These changes prepare the platform for Cortex-A320 integration and ensure correct GIC configuration and secondary-core bring-up, while preserving A35 behavior. Change-Id: Ief03dd528e67918e160d5b42ad1344b0ba3440f8 Signed-off-by: Harsimran Singh Tungal <harsimransingh.tungal@arm.com> Signed-off-by: Frazer Carsley <frazer.carsley@arm.com> Signed-off-by: Michael Safwat <michael.safwat@arm.com>
1 parent 9616a50 commit 25148ce

File tree

5 files changed

+84
-1
lines changed

5 files changed

+84
-1
lines changed

‎plat/arm/board/corstone1000/common/corstone1000_helpers.S‎

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021-2024 Arm Limited and Contributors. All rights reserved.
2+
* Copyright (c) 2021-2025 Arm Limited and Contributors. All rights reserved.
33
*
44
* SPDX-License-Identifier: BSD-3-Clause
55
*/
@@ -13,6 +13,40 @@
1313
.globl plat_is_my_cpu_primary
1414
.globl plat_arm_calc_core_pos
1515

16+
#ifdef CORSTONE1000_CORTEX_A320
17+
.globl plat_my_core_pos
18+
19+
func plat_my_core_pos
20+
mrs x0, mpidr_el1
21+
b plat_arm_calc_core_pos
22+
endfunc plat_my_core_pos
23+
24+
func plat_arm_calc_core_pos
25+
/*
26+
* Aff0 is always 0 for Cortex-A320 MPIDR format:
27+
* https://developer.arm.com/documentation/109551/0001/AArch64-registers/AArch64-Identification-registers-summary/MPIDR-EL1--Multiprocessor-Affinity-Register?lang=en
28+
*/
29+
/* Extract Aff1 (core ID) */
30+
ubfx x1, x0, #MPIDR_AFF1_SHIFT, #MPIDR_AFFINITY_BITS
31+
32+
/* Extract Aff2 (cluster lower bits) */
33+
ubfx x2, x0, #MPIDR_AFF2_SHIFT, #MPIDR_AFFINITY_BITS
34+
35+
/* Extract Aff3 (cluster upper bits) */
36+
ubfx x3, x0, #MPIDR_AFF3_SHIFT, #MPIDR_AFFINITY_BITS
37+
38+
/* cluster_id = (Aff3 << 8) | Aff2 */
39+
lsl x3, x3, #MPIDR_AFFINITY_BITS
40+
orr x3, x3, x2
41+
42+
/* core_pos = core_id + (cluster_id * FVP_MAX_CPUS_PER_CLUSTER) */
43+
mov x4, #CORSTONE1000_MAX_CPUS_PER_CLUSTER
44+
madd x0, x3, x4, x1
45+
46+
ret
47+
endfunc plat_arm_calc_core_pos
48+
#endif
49+
1650
/* --------------------------------------------------------------------
1751
* void plat_secondary_cold_boot_setup (void);
1852
*

‎plat/arm/board/corstone1000/common/corstone1000_plat.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ const mmap_region_t plat_arm_mmap[] = {
2626
ARM_MAP_NS_DRAM1,
2727
CORSTONE1000_MAP_DEVICE,
2828
CORSTONE1000_EXTERNAL_FLASH,
29+
#ifdef CORSTONE1000_CORTEX_A320
30+
ARM_MAP_ETHOS_U85,
31+
ARM_MAP_NONSECURE_SRAM,
32+
#endif
2933
{0}
3034
};
3135

‎plat/arm/board/corstone1000/common/corstone1000_pm.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
#include <plat/arm/common/plat_arm.h>
99
#include <platform_def.h>
1010
#include <plat/common/platform.h>
11+
#ifdef CORSTONE1000_CORTEX_A320
12+
#include <drivers/arm/gicv3.h>
13+
#else
1114
#include <drivers/arm/gicv2.h>
15+
#endif
1216
/*******************************************************************************
1317
* Export the platform handlers via plat_arm_psci_pm_ops. The ARM Standard
1418
* platform layer will take care of registering the handlers with PSCI.
@@ -24,7 +28,11 @@ static void corstone1000_system_reset(void)
2428
* Disable GIC CPU interface to prevent pending interrupt
2529
* from waking up the AP from WFI.
2630
*/
31+
#ifdef CORSTONE1000_CORTEX_A320
32+
gicv3_cpuif_disable(plat_my_core_pos());
33+
#else
2734
gicv2_cpuif_disable();
35+
#endif
2836

2937
/* Flush and invalidate data cache */
3038
dcsw_op_all(DCCISW);

‎plat/arm/board/corstone1000/common/include/platform_def.h‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,19 @@
112112
#define ARM_SHARED_RAM_SIZE (SZ_8K) /* 8 KB */
113113
#define ARM_SHARED_RAM_BASE ARM_TRUSTED_SRAM_BASE
114114

115+
#ifdef CORSTONE1000_CORTEX_A320
116+
#define TOTAL_SECURE_SRAM_SIZE (SZ_4M)
117+
#define TOTAL_NONSECURE_SRAM_SIZE (SZ_4M)
118+
#define PLAT_ARM_TRUSTED_SRAM_SIZE (TOTAL_SECURE_SRAM_SIZE - \
119+
ARM_SHARED_RAM_SIZE)
120+
#else
115121
/* The remaining Trusted SRAM is used to load the BL images */
116122
#define TOTAL_SRAM_SIZE (SZ_4M) /* 4 MB */
117123

118124

119125
#define PLAT_ARM_TRUSTED_SRAM_SIZE (TOTAL_SRAM_SIZE - \
120126
ARM_SHARED_RAM_SIZE)
127+
#endif
121128

122129
#define PLAT_ARM_MAX_BL2_SIZE (180 * SZ_1K) /* 180 KB */
123130

@@ -208,8 +215,13 @@
208215
#define MAX_IO_BLOCK_DEVICES 1
209216

210217
/* GIC related constants */
218+
#ifdef CORSTONE1000_CORTEX_A320
219+
#define PLAT_ARM_GICD_BASE 0x1C000000
220+
#define PLAT_ARM_GICR_BASE 0x1C040000
221+
#else
211222
#define PLAT_ARM_GICD_BASE 0x1C010000
212223
#define PLAT_ARM_GICC_BASE 0x1C02F000
224+
#endif
213225

214226
/* MHUv2 Secure Channel receiver and sender */
215227
#define PLAT_SDK700_MHU0_SEND 0x1B800000
@@ -334,6 +346,20 @@
334346
CORSTONE1000_DEVICE_BASE, \
335347
CORSTONE1000_DEVICE_SIZE, \
336348
MT_DEVICE | MT_RW | MT_SECURE)
349+
#ifdef CORSTONE1000_CORTEX_A320
350+
#define ARM_ETHOS_U85_BASE UL(0x1A050000)
351+
#define ARM_ETHOS_U85_SIZE UL(0x4000)
352+
#define ARM_MAP_ETHOS_U85 MAP_REGION_FLAT( \
353+
ARM_ETHOS_U85_BASE, \
354+
ARM_ETHOS_U85_SIZE, \
355+
MT_DEVICE | MT_RW | MT_NS)
356+
357+
#define ARM_NONSECURE_SRAM_BASE (ARM_TRUSTED_SRAM_BASE + TOTAL_SECURE_SRAM_SIZE)
358+
#define ARM_MAP_NONSECURE_SRAM MAP_REGION_FLAT( \
359+
ARM_NONSECURE_SRAM_BASE, \
360+
TOTAL_NONSECURE_SRAM_SIZE, \
361+
MT_MEMORY | MT_RW | MT_NS)
362+
#endif
337363

338364
#define ARM_IRQ_SEC_PHY_TIMER 29
339365

‎plat/arm/board/corstone1000/platform.mk‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@ ifeq ($(filter ${TARGET_PLATFORM}, fpga fvp),)
99
$(error TARGET_PLATFORM must be fpga or fvp)
1010
endif
1111

12+
ifeq ($(CORSTONE1000_CORTEX_A320), 1)
13+
CORSTONE1000_CPU_LIBS +=lib/cpus/aarch64/cortex_a320.S
14+
$(eval $(call add_define,CORSTONE1000_CORTEX_A320))
15+
GIC_ENABLE_V4_EXTN := 1
16+
GICV3_SUPPORT_GIC600 := 1
17+
else
1218
CORSTONE1000_CPU_LIBS +=lib/cpus/aarch64/cortex_a35.S
19+
endif
1320

1421
PLAT_INCLUDES := -Iplat/arm/board/corstone1000/common/include \
1522
-Iplat/arm/board/corstone1000/include \
@@ -44,7 +51,11 @@ $(eval $(call add_define,CORSTONE1000_FVP_MULTICORE))
4451
endif
4552
endif
4653

54+
ifeq ($(CORSTONE1000_CORTEX_A320), 1)
55+
USE_GIC_DRIVER := 3
56+
else
4757
USE_GIC_DRIVER := 2
58+
endif
4859

4960
BL2_SOURCES += plat/arm/board/corstone1000/common/corstone1000_security.c \
5061
plat/arm/board/corstone1000/common/corstone1000_err.c \

0 commit comments

Comments
 (0)