Run under TF-A for tests on QEMU.
Bug: 204895048
Change-Id: I4c4dc6e7b6de4286cb11a4fae9d270aa3823d7b8
diff --git a/Makefile b/Makefile
index eb5c4f3..d482310 100644
--- a/Makefile
+++ b/Makefile
@@ -170,6 +170,7 @@
BL31_BIN := $(BL_DIR)/bl31.bin
BL32_BIN := $(BL_DIR)/bl32.bin
BL33_BIN := $(BL_DIR)/bl33.bin
+BL_BINS := $(BL1_BIN) $(BL2_BIN) $(BL31_BIN) $(BL32_BIN) $(BL33_BIN)
##
## U-Boot
@@ -251,12 +252,12 @@
$(BL32_BIN): | $(BL_DIR)
touch $@
-.PHONY: bl
-bl: $(BL1_BIN) $(BL2_BIN) $(BL31_BIN) $(BL32_BIN) $(BL33_BIN)
-
$(BL33_BIN): $(UBOOT_OUT)/u-boot.bin | $(BL_DIR)
cp $< $@
+.PHONY: bl
+bl: $(BL_BINS)
+
.PHONY: bl_clean
bl_clean: tfa_clean bl33_clean
rm -rf $(BL_DIR)
@@ -428,10 +429,10 @@
## Generating/Updating prebuilts
##
-PREBUILTS_CROSVM_EXT4 := prebuilts/linux-aarch64/images/crosvm.ext4
-PREBUILTS_ROOTFS_EXT4 := prebuilts/linux-aarch64/images/rootfs.ext4
-PREBUILTS_QEMU_ROM := prebuilts/linux-aarch64/images/efi-virtio.rom
-PREBUILTS_QEMU_BIN := prebuilts/linux-x86/qemu
+PREBUILTS_CROSVM_EXT4 := $(ROOT_DIR)/prebuilts/linux-aarch64/images/crosvm.ext4
+PREBUILTS_ROOTFS_EXT4 := $(ROOT_DIR)/prebuilts/linux-aarch64/images/rootfs.ext4
+PREBUILTS_QEMU_ROM := $(ROOT_DIR)/prebuilts/linux-aarch64/images/efi-virtio.rom
+PREBUILTS_QEMU_BIN := $(ROOT_DIR)/prebuilts/linux-x86/qemu
CUSTOM_CROSVM_EXT4 := $(OUT_DIR)/images/crosvm.ext4
@@ -623,7 +624,7 @@
-a 'ksft=$(call hyphenlist,3,3,$@):$(call hyphenlist,4,-1,$@)'
.PHONY test: $(TESTS)
-$(TESTS): $(KERNEL_IMAGE) $(KERNEL_MODULES_DEP)
+$(TESTS): $(KERNEL_IMAGE) $(KERNEL_MODULES_DEP) $(BL_BINS)
@ $(RUN_TEST)
.PHONY test-list: $(TEST_LISTS)
$(TEST_LISTS):
diff --git a/aarch64/run_qemu.sh b/aarch64/run_qemu.sh
index 180b889..8a9fec7 100755
--- a/aarch64/run_qemu.sh
+++ b/aarch64/run_qemu.sh
@@ -23,7 +23,7 @@
default_var PVMFW ""
default_var CPU ""
default_var SMP 2
-default_var RAM 512
+default_var RAM 1024
default_var GIC 3
default_var GDB 0
default_var MODE "pkvm"
@@ -33,7 +33,7 @@
default_var TIMEOUT ""
# QEMU CPUs to use for VHE and nVHE runs
-CPU_VHE="max"
+CPU_VHE="max,sve=off"
CPU_NVHE="cortex-a53"
KiB=1024
@@ -204,8 +204,7 @@
fi
CMD+=("${QEMU}")
-CMD+=(-M virt)
-CMD+=(-machine virtualization=true -machine virt,gic-version=${GIC})
+CMD+=(-machine virt,virtualization=true,gic-version=${GIC},secure=on)
CMD+=(-cpu "${CPU}")
CMD+=(-smp "${SMP}")
CMD+=(-m "${RAM}")
@@ -215,6 +214,7 @@
CMD+=(-object rng-random,filename=/dev/urandom,id=rng0)
CMD+=(-device virtio-rng-pci,rng=rng0)
CMD+=(-nographic -nodefaults -serial stdio)
+CMD+=(-bios "bl1.bin" -semihosting-config enable=on,target=native)
APPEND+=(rootwait root=/dev/vda)
@@ -277,4 +277,6 @@
# Invoke QEMU and then propagate its exit code.
# We do this instead of `exec` to delete TMP_FILES in the EXIT handler.
-set +e; "${CMD[@]}"; exit $?
+set +e
+( cd "${BL_DIR}"; "${CMD[@]}" )
+exit $?
diff --git a/common.inc b/common.inc
index 0387a8b..da3dbcf 100644
--- a/common.inc
+++ b/common.inc
@@ -36,6 +36,8 @@
OUT_DIR="${ROOT_DIR}/out"
+BL_DIR="${OUT_DIR}/bl"
+
LINUX_OUT="${OUT_DIR}/linux"
LINUX_OUT_IMAGE="${LINUX_OUT}/arch/arm64/boot/Image.gz"
LINUX_OUT_ELF="${LINUX_OUT}/vmlinux"