feat(fvp): add handoff boot tests

Now that handoff support has been added to FVP in U-Boot, add some tests
to exercise end-to-end Linux boot.

Change-Id: I466ae28bc78faa928c5852d1fd2834fc3e405669
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
diff --git a/fvp_utils.sh b/fvp_utils.sh
index 7ec4fa7..d241cd1 100644
--- a/fvp_utils.sh
+++ b/fvp_utils.sh
@@ -15,6 +15,7 @@
 fip_addr="${fip_addr:-0x08000000}"
 initrd_addr="${initrd_addr:-0x84000000}"
 kernel_addr="${kernel_addr:-0x80080000}"
+boot_script_addr="${boot_script_addr:-0x8fb00000}"
 el3_payload_addr="${el3_payload_addr:-0x80000000}"
 
 # SPM requires following addresses for RESET_TO_BL31 case
@@ -37,7 +38,12 @@
 uefi_ci_bin_url="${uefi_ci_bin_url:-$uefi_downloads/Artifacts/Linux/github/fvp/static/DEBUG_GCC5/FVP_AARCH64_EFI.fd}"
 
 uboot32_fip_url="$linaro_release/fvp32-latest-busybox-uboot/fip.bin"
-uboot_url="$linaro_release/fvp-latest-busybox-uboot/bl33-uboot.bin"
+if [[ "$test_config" == *handoff* ]]; then
+	uboot_url="${tfa_downloads}/handoff/fvp/u-boot.bin"
+else
+	uboot_url="$linaro_release/fvp-latest-busybox-uboot/bl33-uboot.bin"
+fi
+uboot_script_url="${tfa_downloads}/linux_boot/fvp/boot.scr"
 
 rootfs_url="$linaro_release/lt-vexpress64-openembedded_minimal-armv8-gcc-5.2_20170127-761.img.gz"
 
@@ -286,6 +292,7 @@
         [bl31]="bl31.bin"
         [bl32]="bl32.bin"
         [busybox]="busybox.bin"
+        [boot_script]="boot_script.bin"
         [cactus_primary]="cactus-primary.pkg"
         [cactus_secondary]="cactus-secondary.pkg"
         [cactus_tertiary]="cactus-tertiary.pkg"
@@ -337,6 +344,7 @@
         [bl31]="$(gen_bin_url bl31.bin)"
         [bl32]="$(gen_bin_url bl32.bin)"
         [busybox]="$(gen_bin_url busybox.bin.gz)"
+        [boot_script]="$(gen_bin_url boot_script.bin)"
         [cactus_primary]="$(gen_bin_url cactus-primary.pkg)"
         [cactus_secondary]="$(gen_bin_url cactus-secondary.pkg)"
         [cactus_tertiary]="$(gen_bin_url cactus-tertiary.pkg)"
@@ -391,6 +399,7 @@
         ["[= ]bl2.bin"]="={BL2}"
         ["[= ]bl31.bin"]="={BL31}"
         ["[= ]bl32.bin"]="={BL32}"
+        ["[= ]boot_script.bin"]="={BOOT_SCRIPT}"
         ["[= ]cactus-primary.pkg"]="={CACTUS_PRIMARY}"
         ["[= ]cactus-secondary.pkg"]="={CACTUS_SECONDARY}"
         ["[= ]cactus-tertiary.pkg"]="={CACTUS_TERTIARY}"
diff --git a/group/tf-l2-boot-tests-cortex/fvp-aarch64-handoff:fvp-linux-dtb-fip.uboot-cortexa73x4-debug b/group/tf-l2-boot-tests-cortex/fvp-aarch64-handoff:fvp-linux-dtb-fip.uboot-cortexa73x4-debug
new file mode 100644
index 0000000..285d1ca
--- /dev/null
+++ b/group/tf-l2-boot-tests-cortex/fvp-aarch64-handoff:fvp-linux-dtb-fip.uboot-cortexa73x4-debug
@@ -0,0 +1,5 @@
+#
+# Copyright (c) 2025, Arm Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
diff --git a/group/tf-l2-boot-tests-cortex/fvp-dynamiq-aarch64-only-handoff:fvp-linux-dtb.dyn-fip.uboot-cortexa710x8-debug b/group/tf-l2-boot-tests-cortex/fvp-dynamiq-aarch64-only-handoff:fvp-linux-dtb.dyn-fip.uboot-cortexa710x8-debug
new file mode 100644
index 0000000..285d1ca
--- /dev/null
+++ b/group/tf-l2-boot-tests-cortex/fvp-dynamiq-aarch64-only-handoff:fvp-linux-dtb.dyn-fip.uboot-cortexa710x8-debug
@@ -0,0 +1,5 @@
+#
+# Copyright (c) 2025, Arm Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
diff --git a/group/tf-l2-boot-tests-cortex/fvp-dynamiq-aarch64-only-handoff:fvp-linux-dtb.dyn-fip.uboot-neoverse_n1-debug b/group/tf-l2-boot-tests-cortex/fvp-dynamiq-aarch64-only-handoff:fvp-linux-dtb.dyn-fip.uboot-neoverse_n1-debug
new file mode 100644
index 0000000..285d1ca
--- /dev/null
+++ b/group/tf-l2-boot-tests-cortex/fvp-dynamiq-aarch64-only-handoff:fvp-linux-dtb.dyn-fip.uboot-neoverse_n1-debug
@@ -0,0 +1,5 @@
+#
+# Copyright (c) 2025, Arm Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
diff --git a/group/tf-l2-boot-tests-latest/fvp-aarch64-handoff:fvp-linux-dtb-fip.uboot-aemv8a_revb-debug b/group/tf-l2-boot-tests-latest/fvp-aarch64-handoff:fvp-linux-dtb-fip.uboot-aemv8a_revb-debug
new file mode 100644
index 0000000..285d1ca
--- /dev/null
+++ b/group/tf-l2-boot-tests-latest/fvp-aarch64-handoff:fvp-linux-dtb-fip.uboot-aemv8a_revb-debug
@@ -0,0 +1,5 @@
+#
+# Copyright (c) 2025, Arm Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
diff --git a/model/fvp_common.sh b/model/fvp_common.sh
index e52ed28..9a4eb70 100644
--- a/model/fvp_common.sh
+++ b/model/fvp_common.sh
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2019-2023, Arm Limited. All rights reserved.
+# Copyright (c) 2019-2025, Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -72,6 +72,7 @@
 ${dtb_bin+--data ${data_instance}=$dtb_bin@${dtb_addr:?}}
 ${kernel_bin+--data ${data_instance}=$kernel_bin@${kernel_addr:?}}
 ${initrd_bin+--data ${data_instance}=$initrd_bin@${initrd_addr:?}}
+${boot_script_bin+--data ${data_instance}=$boot_script_bin@${boot_script_addr:?}}
 
 ${spm_bin+--data ${data_instance}=$spm_bin@${spm_addr:?}}
 ${spmc_manifest+--data ${data_instance}=$spmc_manifest@${spmc_manifest_addr:?}}
diff --git a/run_config/fvp-fip.uboot b/run_config/fvp-fip.uboot
index 562fa2a..0a014b0 100644
--- a/run_config/fvp-fip.uboot
+++ b/run_config/fvp-fip.uboot
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 #
-# Copyright (c) 2019-2020 Arm Limited. All rights reserved.
+# Copyright (c) 2019-2025 Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -8,4 +8,8 @@
 post_tf_build() {
 	url="$uboot_url" filename="uboot.bin" fetch_and_archive
 	build_fip BL33="$archive/uboot.bin"
+
+	# Fetch a simple boot script for testing in CI where semi-hosting might not
+	# be possible.
+	url="$uboot_script_url" filename="boot_script.bin" fetch_and_archive
 }
diff --git a/tf_config/fvp-dynamiq-aarch64-only-handoff b/tf_config/fvp-dynamiq-aarch64-only-handoff
new file mode 100644
index 0000000..50b2a79
--- /dev/null
+++ b/tf_config/fvp-dynamiq-aarch64-only-handoff
@@ -0,0 +1,9 @@
+CROSS_COMPILE=aarch64-none-elf-
+CTX_INCLUDE_AARCH32_REGS=0
+FVP_CLUSTER_COUNT=1
+FVP_MAX_CPUS_PER_CLUSTER=8
+FVP_TRUSTED_SRAM_SIZE=384
+HW_ASSISTED_COHERENCY=1
+PLAT=fvp
+TRANSFER_LIST=1
+USE_COHERENT_MEM=0