Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qemu_v8: add Trusted Services support #802

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions br-ext/package/optee_test_ext/S30test-arm-ffa-user
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh

ARM_FFA_USER_DIR=/mnt/host/out/linux-arm-ffa-user

start() {
if [ -x $ARM_FFA_USER_DIR/load_module.sh ]; then
if ! grep -qs arm_ffa_user /proc/modules; then
echo "Loading arm-ffa-user kernel module"
$ARM_FFA_USER_DIR/load_module.sh
fi
fi

return $?
}

stop() {
if [ -x $ARM_FFA_USER_DIR/load_module.sh ]; then
if grep -qs arm_ffa_user /proc/modules; then
echo "Unloading arm-ffa-user kernel module"
rmmod arm-ffa-user
fi
fi

return $?
}

restart() {
stop
sleep 1
start
}

case "$1" in
start|stop|restart)
"$1";;
reload)
# Restart, since there is no "reload" feature
restart;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
esac
5 changes: 5 additions & 0 deletions br-ext/package/optee_test_ext/optee_test_ext.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ ifneq ($(BR2_PACKAGE_OPTEE_TEST_EXT_WITH_CXX_TESTS),)
TARGET_CONFIGURE_OPTS += WITH_CXX_TESTS=$(BR2_PACKAGE_OPTEE_TEST_EXT_WITH_CXX_TESTS)
endif

define OPTEE_TEST_EXT_INSTALL_INIT_SYSV
$(INSTALL) -m 0755 -D $(OPTEE_TEST_EXT_PKGDIR)/S30test-arm-ffa-user \
$(TARGET_DIR)/etc/init.d/S30test-arm-ffa-user
endef

define OPTEE_TEST_EXT_PREPARE_GP_SUITE
sh $(@D)/host/xtest/gp/prepare_suite.sh $(@D) \
$(BR2_PACKAGE_OPTEE_TEST_EXT_GP_PACKAGE)
Expand Down
37 changes: 34 additions & 3 deletions qemu_v8.mk
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,23 @@ endif
# Enable fTPM
MEASURED_BOOT_FTPM ?= y

include common.mk

DEBUG ?= 1

# Option to build with GICV3 enabled
GICV3 ?= y


SEL0_SPS ?= n
ifeq ($(SEL0_SPS),y)
SPMC_AT_EL = 1
ifneq ($(SPMC_AT_EL),1)
$(error Unsupported SPMC_AT_EL value $(SPMC_AT_EL) for SEL0_SPS=y)
endif
# Needed for arm-ffa-user.ko
QEMU_VIRTFS_AUTOMOUNT = y
LINUX_COMMON_TARGETS += modules
endif

# Option to configure FF-A and SPM:
# n: disabled
# 3: SPMC and SPMD at EL3 (in TF-A)
Expand All @@ -61,11 +71,14 @@ PAUTH ?= n
# Option to configure Memory Tagging Extension
MEMTAG ?= n

include common.mk

################################################################################
# Paths to git projects and various binaries
################################################################################
TF_A_PATH ?= $(ROOT)/trusted-firmware-a
BINARIES_PATH ?= $(ROOT)/out/bin
OUT_PATH ?= $(ROOT)/out
BINARIES_PATH ?= $(OUT_PATH)/bin
QEMU_PATH ?= $(ROOT)/qemu
QEMU_BUILD ?= $(QEMU_PATH)/build
MODULE_OUTPUT ?= $(ROOT)/out/kernel_modules
Expand Down Expand Up @@ -348,6 +361,24 @@ LINUX_CLEANER_COMMON_FLAGS += ARCH=arm64

linux-cleaner: linux-cleaner-common

################################################################################
# Trusted Services
################################################################################
ifeq ($(SEL0_SPS),y)
SP_PACKAGING_METHOD = embedded
SPMC_TESTS=y
include trusted-services.mk

# SPMC test SPs
OPTEE_OS_COMMON_EXTRA_FLAGS += CFG_SPMC_TESTS=y CFG_SECURE_PARTITION=y
OPTEE_OS_COMMON_EXTRA_FLAGS += CFG_SP_SKIP_FAILED=y
OPTEE_OS_COMMON_EXTRA_FLAGS += CFG_DT=y CFG_MAP_EXT_DT_SECURE=y
$(eval $(call build-sp,spm-test1,opteesp,5c9edbc3-7b3a-4367-9f83-7c191ae86a37,$(SP_SPMC_TEST_EXTRA_FLAGS)))
$(eval $(call build-sp,spm-test2,opteesp,7817164c-c40c-4d1a-867a-9bb2278cf41a,$(SP_SPMC_TEST_EXTRA_FLAGS)))
$(eval $(call build-sp,spm-test3,opteesp,23eb0100-e32a-4497-9052-2f11e584afa6,$(SP_SPMC_TEST_EXTRA_FLAGS)))
$(eval $(call build-sp,spm-test4,opteesp,423762ed-7772-406f-99d8-0c27da0abbf8,$(SP_SPMC_TEST_EXTRA_FLAGS)))
endif

################################################################################
# OP-TEE
################################################################################
Expand Down