acs: prepare to extend with S-EL0 partitions
Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: Ie73ff1a8ba668699bb2776a26a3d1fe43ee67f31
diff --git a/acs/builder.sh b/acs/builder.sh
index afc44d4..682ceb2 100755
--- a/acs/builder.sh
+++ b/acs/builder.sh
@@ -4,48 +4,71 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
-# Build ACS test suite.
+set -ex
+
+# Build TF-A project.
+# Argument $1 provides the sp layout file to be used.
+# Argument $2 provides the spmc manifest to be used.
+build_tfa() {
+ local SP_LAYOUT=$1
+ local SPMC_MANIFEST=$2
+
+ echo "Building TF-A."
+ make -C ${WORKSPACE}/trusted-firmware-a \
+ CROSS_COMPILE=aarch64-none-elf- \
+ PLAT=fvp \
+ DEBUG=1 \
+ BL33=${WORKSPACE}/ff-a-acs/build/output/vm1.bin \
+ BL32=${WORKSPACE}/hafnium/out/reference/secure_aem_v8a_fvp_vhe_clang/hafnium.bin \
+ SP_LAYOUT_FILE=${SP_LAYOUT} \
+ ARM_SPMC_MANIFEST_DTS=${SPMC_MANIFEST} \
+ ARM_ARCH_MAJOR=8 \
+ ARM_ARCH_MINOR=5 \
+ BRANCH_PROTECTION=1 \
+ GIC_EXT_INTID=1 \
+ PLAT_TEST_SPM=1 \
+ ENABLE_FEAT_MTE2=1 \
+ SPD=spmd \
+ ARM_BL2_SP_LIST_DTS=${WORKSPACE}/trusted-firmware-a/build/fvp/debug/sp_list_fragment.dts \
+ all fip -j8
+}
+
+# Copy the generated FIP image from TF-A project.
+# Argument $1 contains the output file.
+copy_tfa_fip() {
+ cp ${WORKSPACE}/trusted-firmware-a/build/fvp/debug/fip.bin $1
+}
+
+# Builds the ACS suite, assuming the repo has been setup.
+# Argument $1 contains the exception level for the SPs, which should be 0 or 1.
+build_acs() {
+ cd ${WORKSPACE}/ff-a-acs/build
+ cmake ../ -G"Unix Makefiles" \
+ -DCROSS_COMPILE=aarch64-none-elf- \
+ -DTARGET=tgt_tfa_fvp \
+ -DPLATFORM_FFA_V_ALL=1 \
+ -DPLATFORM_NS_HYPERVISOR_PRESENT=0 \
+ -DPLATFORM_SP_EL=$1 \
+ -DENABLE_BTI=ON \
+ -DCMAKE_BUILD_TYPE=Debug \
+ -DSUITE=all
+ make
+}
+
+# Build Hafnium.
+export PATH=${WORKSPACE}/hafnium/prebuilts/linux-x64/dtc:$PATH
+echo "Building Hafnium."
+make -C ${WORKSPACE}/hafnium PLATFORM=secure_aem_v8a_fvp_vhe
+
+# Setup the ACS test suite.
cd ${WORKSPACE}/ff-a-acs
mkdir build
-cd build
-echo "Building ACS test suite."
-cmake ../ -G"Unix Makefiles" \
- -DCROSS_COMPILE=aarch64-none-elf- \
- -DTARGET=tgt_tfa_fvp \
- -DPLATFORM_FFA_V_ALL=1 \
- -DPLATFORM_NS_HYPERVISOR_PRESENT=0 \
- -DPLATFORM_SP_EL=1 \
- -DENABLE_BTI=ON \
- -DCMAKE_BUILD_TYPE=Debug \
- -DSUITE=all
-make
-
-# Build Hafnium
-export PATH=${WORKSPACE}/hafnium/prebuilts/linux-x64/dtc:$PATH
-
-cd ${WORKSPACE}/hafnium
-echo "Building Hafnium."
-make PLATFORM=secure_aem_v8a_fvp_vhe
-
-# Build TF-A
-cd ${WORKSPACE}/trusted-firmware-a
-echo "Building TF-A."
-make CROSS_COMPILE=aarch64-none-elf- PLAT=fvp DEBUG=1 \
- BL33=${WORKSPACE}/ff-a-acs/build/output/vm1.bin \
- BL32=${WORKSPACE}/hafnium/out/reference/secure_aem_v8a_fvp_vhe_clang/hafnium.bin \
- SP_LAYOUT_FILE=${WORKSPACE}/ff-a-acs/platform/manifest/tgt_tfa_fvp/sp_layout.json \
- ARM_SPMC_MANIFEST_DTS=${WORKSPACE}/ff-a-acs/platform/manifest/tgt_tfa_fvp/fvp_spmc_manifest.dts \
- ARM_ARCH_MAJOR=8 \
- ARM_ARCH_MINOR=5 \
- BRANCH_PROTECTION=1 \
- GIC_EXT_INTID=1 \
- PLAT_TEST_SPM=1 \
- ENABLE_FEAT_MTE2=1 \
- SPD=spmd \
- ARM_BL2_SP_LIST_DTS=${WORKSPACE}/trusted-firmware-a/build/fvp/debug/sp_list_fragment.dts \
- all fip -j8
+echo "Building ACS test suite (S-EL1 targets)."
+build_acs 1
+build_tfa ${WORKSPACE}/ff-a-acs/platform/manifest/tgt_tfa_fvp/sp_layout.json ${WORKSPACE}/ff-a-acs/platform/manifest/tgt_tfa_fvp/fvp_spmc_manifest.dts
+copy_tfa_fip ${WORKSPACE}/fip_sp_sel1.bin
echo "Finished building all targets."
cd ${WORKSPACE}
diff --git a/acs/runner.sh b/acs/runner.sh
index c82a436..4f0dfb2 100755
--- a/acs/runner.sh
+++ b/acs/runner.sh
@@ -6,42 +6,59 @@
#
# Run ACS test suite.
+set -ex
+
mkdir ${WORKSPACE}/logs
-${WORKSPACE}/../fvp/Base_RevC_AEMvA_pkg/models/Linux64_GCC-9.3/FVP_Base_RevC-2xAEMvA \
--C pctl.startup=0.0.0.0 \
--C cluster0.NUM_CORES=4 \
--C cluster1.NUM_CORES=4 \
--C bp.secure_memory=1 \
--C bp.secureflashloader.fname=${WORKSPACE}/trusted-firmware-a/build/fvp/debug/bl1.bin \
--C bp.flashloader0.fname=${WORKSPACE}/trusted-firmware-a/build/fvp/debug/fip.bin \
--C cluster0.has_arm_v8-5=1 \
--C cluster1.has_arm_v8-5=1 \
--C pci.pci_smmuv3.mmu.SMMU_AIDR=2 \
--C pci.pci_smmuv3.mmu.SMMU_IDR0=0x0046123B \
--C pci.pci_smmuv3.mmu.SMMU_IDR1=0x00600002 \
--C pci.pci_smmuv3.mmu.SMMU_IDR3=0x1714 \
--C pci.pci_smmuv3.mmu.SMMU_IDR5=0xFFFF0472 \
--C pci.pci_smmuv3.mmu.SMMU_S_IDR1=0xA0000002 \
--C pci.pci_smmuv3.mmu.SMMU_S_IDR2=0 \
--C pci.pci_smmuv3.mmu.SMMU_S_IDR3=0 \
--C cluster0.has_branch_target_exception=1 \
--C cluster1.has_branch_target_exception=1 \
--C cluster0.has_pointer_authentication=2 \
--C cluster1.has_pointer_authentication=2 \
--C bp.dram_metadata.is_enabled=1 \
--C cluster0.memory_tagging_support_level=2 \
--C cluster1.memory_tagging_support_level=2 \
--C gic_distributor.ARE-fixed-to-one=1 \
--C cluster0.gicv3.extended-interrupt-range-support=1 \
--C cluster1.gicv3.extended-interrupt-range-support=1 \
--C gic_distributor.extended-ppi-count=64 \
--C gic_distributor.extended-spi-count=1024 \
--C bp.pl011_uart0.out_file=${WORKSPACE}/logs/fvp-uart0.log \
--C bp.pl011_uart1.out_file=${WORKSPACE}/logs/fvp-uart1.log \
--C bp.pl011_uart2.out_file=${WORKSPACE}/logs/fvp-uart2.log \
--C bp.vis.disable_visualisation=true \
--C bp.terminal_0.start_telnet=false \
--C bp.terminal_1.start_telnet=false \
--C bp.terminal_2.start_telnet=false \
--C bp.terminal_3.start_telnet=false \
--C bp.pl011_uart2.shutdown_tag="END OF ACS"
+SP_SEL1_LOGS=${WORKSPACE}/logs/SP_SEL1
+SP_SEL0_LOGS=${WORKSPACE}/logs/SP_SEL0
+
+# Runs FVP with ACS test suite.
+# Arguments:
+# $1 -> contains the fip binary.
+# $2 -> logs file name
+run_fvp() {
+ local FIP=$1
+ local LOGS=$2
+
+ ${WORKSPACE}/../fvp/Base_RevC_AEMvA_pkg/models/Linux64_GCC-9.3/FVP_Base_RevC-2xAEMvA \
+ -C pctl.startup=0.0.0.0 \
+ -C cluster0.NUM_CORES=4 \
+ -C cluster1.NUM_CORES=4 \
+ -C bp.secure_memory=1 \
+ -C bp.secureflashloader.fname=${WORKSPACE}/trusted-firmware-a/build/fvp/debug/bl1.bin \
+ -C bp.flashloader0.fname=${FIP} \
+ -C cluster0.has_arm_v8-5=1 \
+ -C cluster1.has_arm_v8-5=1 \
+ -C pci.pci_smmuv3.mmu.SMMU_AIDR=2 \
+ -C pci.pci_smmuv3.mmu.SMMU_IDR0=0x0046123B \
+ -C pci.pci_smmuv3.mmu.SMMU_IDR1=0x00600002 \
+ -C pci.pci_smmuv3.mmu.SMMU_IDR3=0x1714 \
+ -C pci.pci_smmuv3.mmu.SMMU_IDR5=0xFFFF0472 \
+ -C pci.pci_smmuv3.mmu.SMMU_S_IDR1=0xA0000002 \
+ -C pci.pci_smmuv3.mmu.SMMU_S_IDR2=0 \
+ -C pci.pci_smmuv3.mmu.SMMU_S_IDR3=0 \
+ -C cluster0.has_branch_target_exception=1 \
+ -C cluster1.has_branch_target_exception=1 \
+ -C cluster0.has_pointer_authentication=2 \
+ -C cluster1.has_pointer_authentication=2 \
+ -C bp.dram_metadata.is_enabled=1 \
+ -C cluster0.memory_tagging_support_level=2 \
+ -C cluster1.memory_tagging_support_level=2 \
+ -C gic_distributor.ARE-fixed-to-one=1 \
+ -C cluster0.gicv3.extended-interrupt-range-support=1 \
+ -C cluster1.gicv3.extended-interrupt-range-support=1 \
+ -C gic_distributor.extended-ppi-count=64 \
+ -C gic_distributor.extended-spi-count=1024 \
+ -C bp.pl011_uart0.out_file=${LOGS}-uart0.log \
+ -C bp.pl011_uart1.out_file=${LOGS}-uart1.log \
+ -C bp.pl011_uart2.out_file=${LOGS}-uart2.log \
+ -C bp.vis.disable_visualisation=true \
+ -C bp.terminal_0.start_telnet=false \
+ -C bp.terminal_1.start_telnet=false \
+ -C bp.terminal_2.start_telnet=false \
+ -C bp.terminal_3.start_telnet=false \
+ -C bp.pl011_uart2.shutdown_tag="END OF ACS"
+}
+
+run_fvp ${WORKSPACE}/fip_sp_sel1.bin $SP_SEL1_LOGS
+#TODO: validate with the S-EL0 targets