Merge "corstone700: updating the kernel arguments to support initramfs" into integration
diff --git a/Makefile b/Makefile
index 47a544d..289fc00 100644
--- a/Makefile
+++ b/Makefile
@@ -938,13 +938,18 @@
endif
# Generate and include sp_gen.mk if SPD is spmd and SP_LAYOUT_FILE is defined
-ifdef SP_LAYOUT_FILE
ifeq (${SPD},spmd)
+ifdef SP_LAYOUT_FILE
+ ifeq (${SPMD_SPM_AT_SEL2},0)
+ $(error "SPMD with SPM at S-EL1 does not require SP_LAYOUT_FILE")
+ endif
-include $(BUILD_PLAT)/sp_gen.mk
FIP_DEPS += sp
NEED_SP_PKG := yes
else
- $(error "SP_LAYOUT_FILE will be used only if SPD=spmd")
+ ifeq (${SPMD_SPM_AT_SEL2},1)
+ $(error "SPMD with SPM at S-EL2 require SP_LAYOUT_FILE")
+ endif
endif
endif
diff --git a/include/lib/el3_runtime/aarch64/context.h b/include/lib/el3_runtime/aarch64/context.h
index e061950..0029658 100644
--- a/include/lib/el3_runtime/aarch64/context.h
+++ b/include/lib/el3_runtime/aarch64/context.h
@@ -183,7 +183,7 @@
#define CTX_SPSR_EL2 U(0xd0)
#define CTX_SP_EL2 U(0xd8)
#define CTX_TCR_EL2 U(0xe0)
-#define CTX_TRFCR_EL2 U(0xe8)
+#define CTX_TPIDR_EL2 U(0xe8)
#define CTX_TTBR0_EL2 U(0xf0)
#define CTX_VBAR_EL2 U(0xf8)
#define CTX_VMPIDR_EL2 U(0x100)
@@ -234,11 +234,13 @@
#define CTX_VSESR_EL2 U(0x228)
#define CTX_VSTCR_EL2 U(0x230)
#define CTX_VSTTBR_EL2 U(0x238)
+#define CTX_TRFCR_EL2 U(0x240)
// Starting with Armv8.5
-#define CTX_SCXTNUM_EL2 U(0x240)
+#define CTX_SCXTNUM_EL2 U(0x248)
/* Align to the next 16 byte boundary */
#define CTX_EL2_SYSREGS_END U(0x250)
+
#endif /* CTX_INCLUDE_EL2_REGS */
/*******************************************************************************
diff --git a/lib/el3_runtime/aarch64/context.S b/lib/el3_runtime/aarch64/context.S
index 30ad7b7..221f33e 100644
--- a/lib/el3_runtime/aarch64/context.S
+++ b/lib/el3_runtime/aarch64/context.S
@@ -100,7 +100,7 @@
stp x10, x11, [x0, #CTX_SPSR_EL2]
mrs x12, tcr_el2
- mrs x13, TRFCR_EL2
+ mrs x13, tpidr_el2
stp x12, x13, [x0, #CTX_TCR_EL2]
mrs x14, ttbr0_el2
@@ -204,11 +204,14 @@
mrs x16, vsttbr_el2
str x16, [x0, #CTX_VSTTBR_EL2]
+
+ mrs x17, TRFCR_EL2
+ str x17, [x0, #CTX_TRFCR_EL2]
#endif
#if ARM_ARCH_AT_LEAST(8, 5)
- mrs x17, scxtnum_el2
- str x17, [x0, #CTX_SCXTNUM_EL2]
+ mrs x9, scxtnum_el2
+ str x9, [x0, #CTX_SCXTNUM_EL2]
#endif
ret
@@ -289,7 +292,7 @@
ldp x12, x13, [x0, #CTX_TCR_EL2]
msr tcr_el2, x12
- msr TRFCR_EL2, x13
+ msr tpidr_el2, x13
ldp x14, x15, [x0, #CTX_TTBR0_EL2]
msr ttbr0_el2, x14
@@ -391,11 +394,14 @@
ldr x16, [x0, #CTX_VSTTBR_EL2]
msr vsttbr_el2, x16
+
+ ldr x17, [x0, #CTX_TRFCR_EL2]
+ msr TRFCR_EL2, x17
#endif
#if ARM_ARCH_AT_LEAST(8, 5)
- ldr x17, [x0, #CTX_SCXTNUM_EL2]
- msr scxtnum_el2, x17
+ ldr x9, [x0, #CTX_SCXTNUM_EL2]
+ msr scxtnum_el2, x9
#endif
ret
diff --git a/plat/arm/common/arm_bl2_setup.c b/plat/arm/common/arm_bl2_setup.c
index d9fc84e..6c3f64f 100644
--- a/plat/arm/common/arm_bl2_setup.c
+++ b/plat/arm/common/arm_bl2_setup.c
@@ -205,7 +205,7 @@
******************************************************************************/
int arm_bl2_plat_handle_post_image_load(unsigned int image_id)
{
-#if defined(SPD_spmd)
+#if defined(SPD_spmd) && SPMD_SPM_AT_SEL2
/* For Secure Partitions we don't need post processing */
if ((image_id >= (MAX_NUMBER_IDS - MAX_SP_IDS)) &&
(image_id < MAX_NUMBER_IDS)) {
diff --git a/plat/arm/common/arm_common.mk b/plat/arm/common/arm_common.mk
index 65f6bf3..deecb3a 100644
--- a/plat/arm/common/arm_common.mk
+++ b/plat/arm/common/arm_common.mk
@@ -183,7 +183,9 @@
ARM_IO_SOURCES += plat/arm/common/arm_fconf_io_storage.c \
plat/arm/common/fconf/arm_fconf_io.c
ifeq (${SPD},spmd)
-ARM_IO_SOURCES += plat/arm/common/fconf/arm_fconf_sp.c
+ ifeq (${SPMD_SPM_AT_SEL2},1)
+ ARM_IO_SOURCES += plat/arm/common/fconf/arm_fconf_sp.c
+ endif
endif
endif
diff --git a/plat/arm/common/arm_image_load.c b/plat/arm/common/arm_image_load.c
index 593199d..ed7f1f5 100644
--- a/plat/arm/common/arm_image_load.c
+++ b/plat/arm/common/arm_image_load.c
@@ -32,11 +32,11 @@
next_bl_params_cpy_ptr);
}
-#if defined(SPD_spmd)
+#if defined(SPD_spmd) && SPMD_SPM_AT_SEL2
/*******************************************************************************
* This function appends Secure Partitions to list of loadable images.
******************************************************************************/
-void plat_add_sp_images_load_info(struct bl_load_info *load_info)
+static void plat_add_sp_images_load_info(struct bl_load_info *load_info)
{
bl_load_info_node_t *node_info = load_info->head;
unsigned int index = 0;
@@ -78,7 +78,7 @@
******************************************************************************/
struct bl_load_info *plat_get_bl_image_load_info(void)
{
-#if defined(SPD_spmd)
+#if defined(SPD_spmd) && SPMD_SPM_AT_SEL2
bl_load_info_t *bl_load_info;
bl_load_info = get_bl_load_info_from_mem_params_desc();