spm: add config to support RESET_TO_BL31
Google's hafnium CI skips BL1/BL2 boot stages and boots BL31 directly.
This patch replicates hafnium CI's setup and it will be a base for
consolidation of both CI's in the future.
Since there is no BL2, along with other images Secure partitions are
also pre-loaded using model commands.
Change-Id: If81ae9d5b2c2abc68ff2573c4b1a23080b5789e2
Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
diff --git a/fvp_utils.sh b/fvp_utils.sh
index 137c923..4a4879c 100644
--- a/fvp_utils.sh
+++ b/fvp_utils.sh
@@ -17,6 +17,12 @@
kernel_addr="${kernel_addr:-0x80080000}"
el3_payload_addr="${el3_payload_addr:-0x80000000}"
+# SPM requires following addresses for RESET_TO_BL31 case
+spm_addr="${spm_addr:-0x6000000}"
+spmc_manifest_addr="${spmc_addr:-0x0403f000}"
+sp1_addr="${sp1_addr:-0x7000000}"
+sp2_addr="${sp2_addr:-0x7100000}"
+
ns_bl1u_addr="${ns_bl1u_addr:-0x0beb8000}"
fwu_fip_addr="${fwu_fip_addr:-0x08400000}"
backup_fip_addr="${backup_fip_addr:-0x09000000}"
diff --git a/group/tf-l3-boot-tests-spm/fvp-spm-rst-bl31,fvp-default:fvp-spm.rstbl31 b/group/tf-l3-boot-tests-spm/fvp-spm-rst-bl31,fvp-default:fvp-spm.rstbl31
new file mode 100644
index 0000000..d52947d
--- /dev/null
+++ b/group/tf-l3-boot-tests-spm/fvp-spm-rst-bl31,fvp-default:fvp-spm.rstbl31
@@ -0,0 +1,6 @@
+#
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
diff --git a/model/fvp_common.sh b/model/fvp_common.sh
index f2b4982..eb92f65 100644
--- a/model/fvp_common.sh
+++ b/model/fvp_common.sh
@@ -56,6 +56,11 @@
${kernel_bin+--data cluster0.cpu0=$kernel_bin@${kernel_addr:?}}
${initrd_bin+--data cluster0.cpu0=$initrd_bin@${initrd_addr:?}}
+${spm_bin+--data ${data_instance}=$spm_bin@${spm_addr:?}}
+${spmc_manifest+--data ${data_instance}=$spmc_manifest@${spmc_manifest_addr:?}}
+${sp1_pkg+--data ${data_instance}=$sp1_pkg@${sp1_addr:?}}
+${sp2_pkg+--data ${data_instance}=$sp2_pkg@${sp2_addr:?}}
+
${ns_bl1u_bin+--data cluster0.cpu0=$ns_bl1u_bin@$ns_bl1u_addr}
${fwu_fip_bin+--data cluster0.cpu0=$fwu_fip_bin@$fwu_fip_addr}
${backup_fip_bin+--data cluster0.cpu0=$backup_fip_bin@$backup_fip_addr}
diff --git a/run_config/fvp-spm.rstbl31 b/run_config/fvp-spm.rstbl31
new file mode 100644
index 0000000..13cc6ac
--- /dev/null
+++ b/run_config/fvp-spm.rstbl31
@@ -0,0 +1,55 @@
+#!/bin/bash
+#
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+post_tf_build() {
+ #
+ # To build SP packages in TF-A we need to build FIP.
+ # The resulting FIP has valid SP Packages mentioned in SP_LAYOUT_FILE
+ # but dummy BL33 and BL32.
+ #
+ local dummy_file="$(mktempfile)"
+ echo "hello world" > "$dummy_file"
+
+ build_fip BL33="$dummy_file" BL32="$dummy_file"
+
+ url="$project_filer/ci-files/spm-07-29-2020/hafnium.bin" fetch_file
+ url="$project_filer/ci-files/spm-07-29-2020/secure_hafnium.bin" fetch_file
+ url="$project_filer/ci-files/spm-07-29-2020/initrd.img" fetch_file
+ url="$project_filer/ci-files/spm-07-29-2020/manifest.dtb" fetch_file
+ url="${tf_build_root}/${plat}/${mode}/fdts/fvp_spmc_manifest.dtb" fetch_file
+ url="${tf_build_root}/${plat}/${mode}/cactus-primary.pkg" fetch_file
+ url="${tf_build_root}/${plat}/${mode}/cactus-secondary.pkg" fetch_file
+
+ archive_file "hafnium.bin"
+ archive_file "secure_hafnium.bin"
+ archive_file "initrd.img"
+ archive_file "manifest.dtb"
+ archive_file "fvp_spmc_manifest.dtb"
+ archive_file "cactus-primary.pkg"
+ archive_file "cactus-secondary.pkg"
+}
+
+post_fetch_tf_resource() {
+ model="base-aemv8a" \
+ arch_version="8.4" \
+ reset_to_bl31="1" \
+ preload_bl33="1" \
+ preload_bl33_bin="hafnium.bin" \
+ spmc_manifest="fvp_spmc_manifest.dtb" \
+ spm_bin="secure_hafnium.bin" \
+ sp1_pkg="cactus-primary.pkg" \
+ sp2_pkg="cactus-secondary.pkg" \
+ initrd_bin="initrd.img" \
+ el3_payload_bin="manifest.dtb" \
+ gen_model_params
+}
+
+fetch_tf_resource() {
+ # Expect scripts
+ uart="0" file="spm-linux-uart0.exp" track_expect
+ uart="2" file="spm-uart2.exp" track_expect
+}
diff --git a/tf_config/fvp-spm-rst-bl31 b/tf_config/fvp-spm-rst-bl31
new file mode 100644
index 0000000..2b9c828
--- /dev/null
+++ b/tf_config/fvp-spm-rst-bl31
@@ -0,0 +1,8 @@
+CROSS_COMPILE=aarch64-none-elf-
+PLAT=fvp
+RESET_TO_BL31=1
+SPD=spmd
+SPMD_SPM_AT_SEL2=1
+CTX_INCLUDE_EL2_REGS=1
+ARM_ARCH_MINOR=4
+SP_LAYOUT_FILE=${tftf_root}/build/fvp/${bin_mode}/sp_layout.json