VHE: Modify kokoro test scripts to run VHE tests
This patch modifies test.sh and test_spmc.sh to allow running hafnium
tests on VHE enabled builds of hafnium and SPMC. This patch also adds
the option to run only EL0 partition tests through a command line
options.
Example commands:
./kokoro/test.sh --vhe
./kokoro/test.sh --vhe --el0
./kokoro/test.sh --vhe --el0 --fvp
./kokoro/test_spmc.sh --vhe
Signed-off-by: Raghu Krishnamurthy <raghu.ncstate@gmail.com>
Change-Id: Iac9e4c1d82b0d944896eec47fe35e0332e42d958
diff --git a/kokoro/test.sh b/kokoro/test.sh
index b211c00..eb0e423 100755
--- a/kokoro/test.sh
+++ b/kokoro/test.sh
@@ -15,6 +15,8 @@
USE_FVP=false
USE_TFA=false
+USE_VHE=false
+EL0_TEST_ONLY=false
SKIP_LONG_RUNNING_TESTS=false
RUN_ALL_QEMU_CPUS=false
@@ -25,6 +27,10 @@
;;
--tfa) USE_TFA=true
;;
+ --vhe) USE_VHE=true
+ ;;
+ --el0) EL0_TEST_ONLY=true
+ ;;
--skip-long-running-tests) SKIP_LONG_RUNNING_TESTS=true
;;
--run-all-qemu-cpus) RUN_ALL_QEMU_CPUS=true
@@ -41,14 +47,28 @@
HYPERVISOR_PATH="$OUT/"
if [ $USE_FVP == true ]
then
- HYPERVISOR_PATH+="aem_v8a_fvp_clang"
+if [ $USE_VHE == true ]
+then
+ HYPERVISOR_PATH+="aem_v8a_fvp_vhe_clang"
+ HFTEST+=(--out_initrd "$OUT/aem_v8a_fvp_vhe_vm_clang")
+ HFTEST+=(--out_partitions "$OUT/aem_v8a_fvp_vhe_vm_clang")
HFTEST+=(--driver=fvp)
+else
+ HYPERVISOR_PATH+="aem_v8a_fvp_clang"
HFTEST+=(--out_initrd "$OUT/aem_v8a_fvp_vm_clang")
HFTEST+=(--out_partitions "$OUT/aem_v8a_fvp_vm_clang")
+ HFTEST+=(--driver=fvp)
+fi
+else
+if [ $USE_VHE == true ]
+then
+ HYPERVISOR_PATH+="qemu_aarch64_vhe_clang"
+ HFTEST+=(--out_initrd "$OUT/qemu_aarch64_vhe_vm_clang")
else
HYPERVISOR_PATH+="qemu_aarch64_clang"
HFTEST+=(--out_initrd "$OUT/qemu_aarch64_vm_clang")
fi
+fi
if [ $USE_TFA == true ]
then
HFTEST+=(--tfa)
@@ -82,30 +102,39 @@
HFTEST_CPU+=(--log "$LOG_DIR_BASE")
fi
- "${HFTEST_CPU[@]}" --hypervisor "$HYPERVISOR_PATH/arch_test.bin"
- if [ $USE_TFA == true -o $USE_FVP == true ]
+ if [ $EL0_TEST_ONLY == false ]
then
- "${HFTEST_CPU[@]}" --hypervisor "$HYPERVISOR_PATH/aarch64_test.bin"
+ "${HFTEST_CPU[@]}" --hypervisor "$HYPERVISOR_PATH/arch_test.bin"
+ if [ $USE_TFA == true -o $USE_FVP == true ]
+ then
+ "${HFTEST_CPU[@]}" --hypervisor "$HYPERVISOR_PATH/aarch64_test.bin"
+ fi
+
+ "${HFTEST_CPU[@]}" --hypervisor "$HYPERVISOR_PATH/hafnium.bin" \
+ --initrd test/vmapi/arch/aarch64/aarch64_test
+
+ "${HFTEST_CPU[@]}" --hypervisor "$HYPERVISOR_PATH/hafnium.bin" \
+ --initrd test/vmapi/arch/aarch64/gicv3/gicv3_test
+
+ "${HFTEST_CPU[@]}" --hypervisor "$HYPERVISOR_PATH/hafnium.bin" \
+ --initrd test/vmapi/primary_only/primary_only_test
+
+ "${HFTEST_CPU[@]}" --hypervisor "$HYPERVISOR_PATH/hafnium.bin" \
+ --initrd test/vmapi/primary_with_secondaries/primary_with_secondaries_test
+
+ "${HFTEST_CPU[@]}" --hypervisor "$HYPERVISOR_PATH/hafnium.bin" \
+ --initrd test/vmapi/primary_with_secondaries/primary_with_secondaries_no_fdt
+
+ "${HFTEST_CPU[@]}" --hypervisor "$HYPERVISOR_PATH/hafnium.bin" \
+ --initrd test/linux/linux_test \
+ --force-long-running --vm_args "rdinit=/test_binary --"
fi
- "${HFTEST_CPU[@]}" --hypervisor "$HYPERVISOR_PATH/hafnium.bin" \
- --initrd test/vmapi/arch/aarch64/aarch64_test
-
- "${HFTEST_CPU[@]}" --hypervisor "$HYPERVISOR_PATH/hafnium.bin" \
- --initrd test/vmapi/arch/aarch64/gicv3/gicv3_test
-
- "${HFTEST_CPU[@]}" --hypervisor "$HYPERVISOR_PATH/hafnium.bin" \
- --initrd test/vmapi/primary_only/primary_only_test
-
- "${HFTEST_CPU[@]}" --hypervisor "$HYPERVISOR_PATH/hafnium.bin" \
- --initrd test/vmapi/primary_with_secondaries/primary_with_secondaries_test
-
- "${HFTEST_CPU[@]}" --hypervisor "$HYPERVISOR_PATH/hafnium.bin" \
- --initrd test/vmapi/primary_with_secondaries/primary_with_secondaries_no_fdt
-
- "${HFTEST_CPU[@]}" --hypervisor "$HYPERVISOR_PATH/hafnium.bin" \
- --initrd test/linux/linux_test \
- --force-long-running --vm_args "rdinit=/test_binary --"
+ if [ $USE_VHE == true ]
+ then
+ "${HFTEST_CPU[@]}" --hypervisor "$HYPERVISOR_PATH/hafnium.bin" \
+ --initrd test/vmapi/el0_partitions/el0_partitions_test
+ fi
# TODO: Get Trusty tests working on FVP too.
if [ $USE_TFA == true ]
diff --git a/kokoro/test_spmc.sh b/kokoro/test_spmc.sh
index 8047e5f..bb6bea1 100755
--- a/kokoro/test_spmc.sh
+++ b/kokoro/test_spmc.sh
@@ -10,15 +10,48 @@
KOKORO_DIR="$(dirname "$0")"
source $KOKORO_DIR/test_common.sh
-HFTEST=(${TIMEOUT[@]} 300s ./test/hftest/hftest.py)
-SPMC_PATH="$OUT/secure_aem_v8a_fvp_clang"
-HYPERVISOR_PATH="$OUT/aem_v8a_fvp_clang"
+USE_VHE=false
+EL0_TEST_ONLY=false
-HFTEST+=(--out_partitions "$OUT/secure_aem_v8a_fvp_vm_clang")
+while test $# -gt 0
+do
+ case "$1" in
+ --vhe) USE_VHE=true
+ ;;
+ --el0) EL0_TEST_ONLY=true
+ ;;
+ *) echo "Unexpected argument $1"
+ exit 1
+ ;;
+ esac
+ shift
+done
+
+HFTEST=(${TIMEOUT[@]} 300s ./test/hftest/hftest.py)
+if [ $USE_VHE == true ]
+then
+ SPMC_PATH="$OUT/secure_aem_v8a_fvp_vhe_clang"
+ HYPERVISOR_PATH="$OUT/aem_v8a_fvp_vhe_clang"
+ HFTEST+=(--out_partitions "$OUT/secure_aem_v8a_fvp_vhe_vm_clang")
+else
+ SPMC_PATH="$OUT/secure_aem_v8a_fvp_clang"
+ HYPERVISOR_PATH="$OUT/aem_v8a_fvp_clang"
+ HFTEST+=(--out_partitions "$OUT/secure_aem_v8a_fvp_vm_clang")
+fi
+
HFTEST+=(--log "$LOG_DIR_BASE")
HFTEST+=(--spmc "$SPMC_PATH/hafnium.bin" --driver=fvp)
-${HFTEST[@]} --partitions_json test/vmapi/ffa_secure_partition_only/ffa_secure_partition_only_test.json
+if [ $EL0_TEST_ONLY == false ]
+then
+ ${HFTEST[@]} --partitions_json test/vmapi/ffa_secure_partition_only/ffa_secure_partition_only_test.json
-${HFTEST[@]} --hypervisor "$HYPERVISOR_PATH/hafnium.bin" \
- --partitions_json test/vmapi/ffa_secure_partitions/ffa_both_world_partitions_test.json
+ ${HFTEST[@]} --hypervisor "$HYPERVISOR_PATH/hafnium.bin" \
+ --partitions_json test/vmapi/ffa_secure_partitions/ffa_both_world_partitions_test.json
+fi
+
+if [ $USE_VHE == true ]
+then
+ ${HFTEST[@]} --hypervisor "$HYPERVISOR_PATH/hafnium.bin" \
+ --partitions_json test/vmapi/el0_partitions/secure_partitions/ffa_both_world_partitions_test.json
+fi
diff --git a/test/hftest/hftest.py b/test/hftest/hftest.py
index 359c071..e3df464 100755
--- a/test/hftest/hftest.py
+++ b/test/hftest/hftest.py
@@ -367,6 +367,8 @@
f"cluster0.cpu0={self.FVP_PREBUILT_BL31}@{self.CPU_START_ADDRESS}",
"-C", "bp.ve_sysregs.mmbSiteDefault=0",
"-C", "bp.ve_sysregs.exit_on_shutdown=1",
+ "-C", "cluster0.has_arm_v8-1=1",
+ "-C", "cluster1.has_arm_v8-1=1",
]
if uart0_log_path and uart1_log_path: