Skip to contentSkip to conversation

arm/trusted-services: update TS version

PATCH New Gyorgy Szing 1 participant 17 messages Jun 15, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/17 arm/trusted-services: update TS version

This change updates to latest available version of Trusted Services. List of changes:
- adapt SP recipes to file structure changes and support for "configurations". In TS each SP can be built in various different setups to allow adapting to platform and integration specific differences.
- MbedTLS dependency has been updated to v3.3.0.
- This needs new python dependencies are required in the build environment.
- psa-acs was updated to a matching version.
- do_patch() has been updated to support the MbedTLS patch added in TS.
- Update TS dependency patching method to use git instead of patch.
- Downgrade nanopb to match up-stream dependency version.

---
 .../trusted-services/trusted-services-src.inc | 27 +++++++++----------
 .../trusted-services/ts-demo_git.bb           |  1 +
 .../trusted-services/ts-newlib_4.1.0.bb       |  4 +--
 .../ts-psa-api-test-common_git.inc            |  4 ++-
 .../trusted-services/ts-sp-attestation_git.bb |  3 ++-
 .../trusted-services/ts-sp-crypto_git.bb      |  5 ++--
 .../trusted-services/ts-sp-env-test_git.bb    |  3 ++-
 .../trusted-services/ts-sp-its_git.bb         |  3 ++-
 .../trusted-services/ts-sp-se-proxy_git.bb    |  3 ++-
 .../trusted-services/ts-sp-smm-gateway_git.bb |  3 ++-
 .../trusted-services/ts-sp-storage_git.bb     |  3 ++-
 11 files changed, 32 insertions(+), 27 deletions(-)
meta-arm/recipes-security/trusted-services/trusted-services-src.inc +12 -15
index dc295506..c3ab7867 100644
@@ -5,8 +5,8 @@ LICENSE = "Apache-2.0 & BSD-3-Clause & BSD-2-Clause & Zlib"
 SRC_URI = "git://git.trustedfirmware.org/TS/trusted-services.git;protocol=https;branch=integration;name=trusted-services;destsuffix=git/trusted-services \
 "
 
-#latest on 12.10.22.
-SRCREV_trusted-services = "3d4956770f89eb9ae0a73257901ae6277c078da6"
+#Latest on 2023 April 25
+SRCREV="0d292e7c879076ea36cc39e30e0ac930b71e8cd8"
 LIC_FILES_CHKSUM = "file://${S}/license.rst;md5=ea160bac7f690a069c608516b17997f4"
 
 S = "${WORKDIR}/git/trusted-services"
@@ -17,14 +17,14 @@ SRC_URI += "git://github.com/dgibson/dtc;name=dtc;protocol=https;branch=main;des
 SRCREV_dtc = "b6910bec11614980a21e46fbccc35934b671bd81"
 LIC_FILES_CHKSUM += "file://../dtc/README.license;md5=a1eb22e37f09df5b5511b8a278992d0e"
 
-# MbedTLS, tag "mbedtls-3.1.0"
+# MbedTLS, tag "mbedtls-3.3.0"
 SRC_URI += "git://github.com/ARMmbed/mbedtls.git;name=mbedtls;protocol=https;branch=master;destsuffix=git/mbedtls"
-SRCREV_mbedtls = "d65aeb37349ad1a50e0f6c9b694d4b5290d60e49"
+SRCREV_mbedtls = "8c89224991adff88d53cd380f42a2baa36f91454"
 LIC_FILES_CHKSUM += "file://../mbedtls/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
 
-# Nanopb, tag "nanopb-0.4.6"
+# Nanopb, tag "nanopb-0.4.2"
 SRC_URI += "git://github.com/nanopb/nanopb.git;name=nanopb;protocol=https;branch=master;destsuffix=git/nanopb"
-SRCREV_nanopb = "afc499f9a410fc9bbf6c9c48cdd8d8b199d49eb4"
+SRCREV_nanopb = "df0e92f474f9cca704fe2b31483f0b4d1b1715a4"
 LIC_FILES_CHKSUM += "file://../nanopb/LICENSE.txt;md5=9db4b73a55a3994384112efcdb37c01f"
 
 # qcbor, tag "v1.0.0"
@@ -54,15 +54,12 @@ LIC_FILES_CHKSUM += "file://../openamp/LICENSE.md;md5=a8d8cf662ef6bf9936a1e14135
 
 # TS ships patches for external dependencies that needs to be applied
 apply_ts_patches() {
-    for p in ${S}/external/qcbor/*.patch; do
-        patch -p1 -N -d ${WORKDIR}/git/qcbor < ${p} || true
-    done
-    for p in ${S}/external/t_cose/*.patch; do
-        patch -p1 -N -d ${WORKDIR}/git/tcose < ${p} || true
-    done
-    for p in ${S}/external/CppUTest/*.patch; do
-        patch -p1 -d ${WORKDIR}/git/cpputest < ${p}
-    done
+    ( cd ${WORKDIR}/git/qcbor;    git stash; git branch -f bf_am; git am ${S}/external/qcbor/*.patch; git reset bf_am )
+    ( cd ${WORKDIR}/git/tcose;    git stash; git branch -f bf_am; git am ${S}/external/t_cose/*.patch; git reset bf_am )
+    ( cd ${WORKDIR}/git/mbedtls;  git stash; git branch -f bf_am; git am ${S}/external/MbedTLS/*.patch; git reset bf_am )
+    ( cd ${WORKDIR}/git/cpputest; git stash; git apply ${S}/external/CppUTest/*.patch )
+    ( cd ${WORKDIR}/git/dtc;      git stash; git apply ${S}/external/libfdt/*.patch )
+    ( cd ${WORKDIR}/git/nanopb;   git stash; git apply ${S}/external/nanopb/*.patch )
 }
 do_patch[postfuncs] += "apply_ts_patches"
 
meta-arm/recipes-security/trusted-services/ts-demo_git.bb +1 -0
index a9f7b65f..668bde56 100644
@@ -6,6 +6,7 @@ TS_ENV = "arm-linux"
 
 require trusted-services.inc
 
+DEPENDS        += "python3-jsonschema-native python3-jinja2-native"
 DEPENDS        += "libts"
 RDEPENDS:${PN} += "libts"
 
meta-arm/recipes-security/trusted-services/ts-newlib_4.1.0.bb +1 -3
index 408c7d3c..24a724a4 100644
@@ -22,9 +22,7 @@ OECMAKE_SOURCEPATH = "${S}/deployments/newlib/${TS_ENV}/"
 
 # TS ships a patch that needs to be applied to newlib
 apply_ts_patch() {
-    for p in ${S}/external/newlib/*.patch; do
-        patch -p1 -d ${WORKDIR}/git/newlib < ${p}
-    done
+    ( cd ${WORKDIR}/git/newlib;    git stash; git branch -f bf_am; git am ${S}/external/newlib/*.patch; git reset bf_am )
 }
 do_patch[postfuncs] += "apply_ts_patch"
 
meta-arm/recipes-security/trusted-services/ts-psa-api-test-common_git.inc +3 -1
index 41cb0c08..8a7b0e5c 100644
@@ -4,6 +4,8 @@ TS_ENV = "arm-linux"
 
 require trusted-services.inc
 
+DEPENDS        += "python3-jsonschema-native python3-jinja2-native"
+
 DEPENDS        += "libts"
 RDEPENDS:${PN} += "libts"
 
@@ -11,7 +13,7 @@ SRC_URI += "git://github.com/ARM-software/psa-arch-tests.git;name=psatest;protoc
             file://0001-Pass-Yocto-build-settings-to-psa-arch-tests-native.patch;patchdir=../psatest \
            "
 
-SRCREV_psatest = "451aa087a40d02c7d04778235014c5619d126471"
+SRCREV_psatest = "38cb53a4d9e292435ddf7899960b15af62decfbe"
 LIC_FILES_CHKSUM += "file://../psatest/LICENSE.md;md5=2a944942e1496af1886903d274dedb13"
 
 EXTRA_OECMAKE += "\
meta-arm/recipes-security/trusted-services/ts-sp-attestation_git.bb +2 -1
index eef05fe3..6cddfb03 100644
@@ -3,5 +3,6 @@ DESCRIPTION = "Trusted Services attestation service provider"
 require ts-sp-common.inc
 
 SP_UUID = "${ATTESTATION_UUID}"
+TS_SP_IAT_CONFIG ?= "default"
 
-OECMAKE_SOURCEPATH="${S}/deployments/attestation/${TS_ENV}"
+OECMAKE_SOURCEPATH="${S}/deployments/attestation/config/${TS_SP_IAT_CONFIG}-${TS_ENV}"
meta-arm/recipes-security/trusted-services/ts-sp-crypto_git.bb +3 -2
index 77a28557..867e4a81 100644
@@ -3,7 +3,8 @@ DESCRIPTION = "Trusted Services crypto service provider"
 require ts-sp-common.inc
 
 SP_UUID = "${CRYPTO_UUID}"
+TS_SP_CRYPTO_CONFIG ?= "default"
 
-DEPENDS += "python3-protobuf-native"
+DEPENDS += "python3-protobuf-native python3-jsonschema-native python3-jinja2-native"
 
-OECMAKE_SOURCEPATH="${S}/deployments/crypto/${TS_ENV}"
+OECMAKE_SOURCEPATH="${S}/deployments/crypto/config/${TS_SP_CRYPTO_CONFIG}-${TS_ENV}"
meta-arm/recipes-security/trusted-services/ts-sp-env-test_git.bb +2 -1
index 040fd4d1..5551a4de 100644
@@ -6,5 +6,6 @@ require ts-sp-common.inc
 COMPATIBLE_MACHINE ?= "invalid"
 
 SP_UUID = "${ENV_TEST_UUID}"
+TS_SP_ENVTEST_CONFIG ?= "baremetal-fvp_base_revc"
 
-OECMAKE_SOURCEPATH="${S}/deployments/env-test/${TS_ENV}"
+OECMAKE_SOURCEPATH="${S}/deployments/env-test/config/${TS_SP_ENVTEST_CONFIG}-${TS_ENV}"
meta-arm/recipes-security/trusted-services/ts-sp-its_git.bb +2 -1
index 4eb5dc5e..5472dbda 100644
@@ -3,5 +3,6 @@ DESCRIPTION = "Trusted Services internal secure storage service provider"
 require ts-sp-common.inc
 
 SP_UUID = "${ITS_UUID}"
+TS_SP_ITS_CONFIG ?= "default"
 
-OECMAKE_SOURCEPATH="${S}/deployments/internal-trusted-storage/${TS_ENV}"
+OECMAKE_SOURCEPATH="${S}/deployments/internal-trusted-storage/config/${TS_SP_ITS_CONFIG}-${TS_ENV}"
meta-arm/recipes-security/trusted-services/ts-sp-se-proxy_git.bb +2 -1
index b9246418..26781434 100644
@@ -3,7 +3,8 @@ DESCRIPTION = "Trusted Services proxy service providers"
 require ts-sp-common.inc
 
 SP_UUID = "${SE_PROXY_UUID}"
+TS_SP_SE_PROXY_CONFIG ?= "default"
 
 DEPENDS += "python3-protobuf-native"
 
-OECMAKE_SOURCEPATH="${S}/deployments/se-proxy/${TS_ENV}"
+OECMAKE_SOURCEPATH="${S}/deployments/se-proxy/config/${TS_SP_SE_PROXY_CONFIG}-${TS_ENV}"
meta-arm/recipes-security/trusted-services/ts-sp-smm-gateway_git.bb +2 -1
index 06ca6bd1..752f7fe7 100644
@@ -3,5 +3,6 @@ DESCRIPTION = "Trusted Services service provider for UEFI SMM services"
 require ts-sp-common.inc
 
 SP_UUID = "${SMM_GATEWAY_UUID}"
+TS_SP_SMM_GATEWAY_CONFIG ?= "default"
 
-OECMAKE_SOURCEPATH="${S}/deployments/smm-gateway/${TS_ENV}"
+OECMAKE_SOURCEPATH="${S}/deployments/smm-gateway/config/${TS_SP_SMM_GATEWAY_CONFIG}-${TS_ENV}"
meta-arm/recipes-security/trusted-services/ts-sp-storage_git.bb +2 -1
index c8937546..5b2f47b3 100644
@@ -3,5 +3,6 @@ DESCRIPTION = "Trusted Services secure storage service provider"
 require ts-sp-common.inc
 
 SP_UUID = "${STORAGE_UUID}"
+TS_SP_PS_CONFIG ?= "default"
 
-OECMAKE_SOURCEPATH="${S}/deployments/protected-storage/${TS_ENV}"
+OECMAKE_SOURCEPATH="${S}/deployments/protected-storage/config/${TS_SP_PS_CONFIG}-${TS_ENV}"
Signature · 1 line
2.39.1.windows.1
#1 lore raw

PATCH 2/17 optee-os: remove v3.18 pin of OP-TEE on qemuarm64-secureboot

To enable up-to date version of Trusted Services op-tee v3.20 or newer is needed.

---
 meta-arm/conf/machine/qemuarm64-secureboot.conf | 3 ---
 1 file changed, 3 deletions(-)
meta-arm/conf/machine/qemuarm64-secureboot.conf +0 -3
index 7277817d..55c4cab4 100644
@@ -23,6 +23,3 @@ WKS_FILE_DEPENDS = "trusted-firmware-a"
 IMAGE_BOOT_FILES = "${KERNEL_IMAGETYPE}"
 
 MACHINE_FEATURES += "optee-ftpm"
-
-PREFERRED_VERSION_optee-os ?= "3.18.%"
-
Signature · 1 line
2.39.1.windows.1
#2 lore raw

PATCH 3/17 arm/oeqa: Make ts-service-test config match selected SPs

In reply to Gyorgy Szing

From: Anton Antonov <[email protected]>

Split tests to groups, and enable groups based on machine features set. This allows limiting tests to testing deployed SPs only.

---
 .../oeqa/runtime/cases/trusted_services.py    | 78 +++++++++++++++++--
 1 file changed, 71 insertions(+), 7 deletions(-)
meta-arm/lib/oeqa/runtime/cases/trusted_services.py +71 -7
index a5f93760..1eeca205 100644
@@ -3,25 +3,23 @@
 from oeqa.runtime.case import OERuntimeTestCase
 from oeqa.core.decorator.depends import OETestDepends
 from oeqa.runtime.decorator.package import OEHasPackage
+from oeqa.core.decorator.data import skipIfNotInDataVar
 
 class TrustedServicesTest(OERuntimeTestCase):
 
-    def run_test_tool(self, cmd, expected_status=0 ):
+    def run_test_tool(self, cmd, expected_status=0, expected_output=None ):
         """ Run a test utility """
 
         status, output = self.target.run(cmd)
         self.assertEqual(status, expected_status, msg='\n'.join([cmd, output]))
+        if expected_output is not None:
+            self.assertEqual(output, expected_output, msg='\n'.join([cmd, output]))
 
     @OEHasPackage(['ts-demo'])
     @OETestDepends(['ssh.SSHTest.test_ssh'])
     def test_00_ts_demo(self):
         self.run_test_tool('ts-demo')
 
-    @OEHasPackage(['ts-service-test'])
-    @OETestDepends(['ssh.SSHTest.test_ssh'])
-    def test_01_ts_service_test(self):
-        self.run_test_tool('ts-service-test')
-
     @OEHasPackage(['ts-uefi-test'])
     @OETestDepends(['ssh.SSHTest.test_ssh'])
     def test_02_ts_uefi_test(self):
@@ -30,7 +28,8 @@ class TrustedServicesTest(OERuntimeTestCase):
     @OEHasPackage(['ts-psa-crypto-api-test'])
     @OETestDepends(['ssh.SSHTest.test_ssh'])
     def test_03_psa_crypto_api_test(self):
-        # There are a few expected PSA Crypto tests failing
+        # There are a two expected PSA Crypto tests failures testing features
+        # TS will not support.
         self.run_test_tool('psa-crypto-api-test', expected_status=46)
 
     @OEHasPackage(['ts-psa-its-api-test'])
@@ -48,3 +47,68 @@ class TrustedServicesTest(OERuntimeTestCase):
     @OETestDepends(['ssh.SSHTest.test_ssh'])
     def test_06_psa_iat_api_test(self):
         self.run_test_tool('psa-iat-api-test')
+
+    @OEHasPackage(['ts-service-test'])
+    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    def test_09_ts_service_grp_check(self):
+        # If this test fails, available test groups in ts-service-test have changed and all
+        # tests using the test executable need to be double checked to ensure test group to
+        # TS SP mapping is still valid. 
+        test_grp_list="FwuServiceTests PsServiceTests ItsServiceTests AttestationProvisioningTests"
+        test_grp_list+=" AttestationServiceTests CryptoKeyDerivationServicePackedcTests"
+        test_grp_list+=" CryptoMacServicePackedcTests CryptoCipherServicePackedcTests"
+        test_grp_list+=" CryptoHashServicePackedcTests CryptoServicePackedcTests"
+        test_grp_list+=" CryptoServiceProtobufTests CryptoServiceLimitTests"
+        test_grp_list+=" DiscoveryServiceTests"
+        self.run_test_tool('ts-service-test -lg', expected_output=test_grp_list)
+
+    @OEHasPackage(['ts-service-test'])
+    @skipIfNotInDataVar('MACHINE_FEATURES', 'ts-fwu', 'FWU SP is not included')
+    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    def test_10_fwu_service_tests(self):
+        self.run_test_tool('ts-service-test -g FwuServiceTests')
+
+    @OEHasPackage(['ts-service-test'])
+    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    def test_11_ps_service_tests(self):
+        if 'ts-storage' not in self.tc.td['MACHINE_FEATURES'] and \
+           'ts-se-proxy' not in self.tc.td['MACHINE_FEATURES']:
+            self.skipTest('Storage SP is not included into OPTEE')
+        self.run_test_tool('ts-service-test -g PsServiceTests')
+
+    @OEHasPackage(['ts-service-test'])
+    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    def test_12_its_service_tests(self):
+        if 'ts-its' not in self.tc.td['MACHINE_FEATURES'] and \
+           'ts-se-proxy' not in self.tc.td['MACHINE_FEATURES']:
+            self.skipTest('Internal Storage SP is not included into OPTEE')
+        self.run_test_tool('ts-service-test -g ItsServiceTests')
+
+    @OEHasPackage(['ts-service-test'])
+    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    def test_14_attestation_service_tests(self):
+        if 'ts-attestation' not in self.tc.td['MACHINE_FEATURES'] and \
+           'ts-se-proxy' not in self.tc.td['MACHINE_FEATURES']:
+            self.skipTest('Attestation SP is not included into OPTEE')
+        for grp in ["AttestationProvisioningTests", "AttestationServiceTests"]:
+            self.run_test_tool('ts-service-test -g %s'%grp)
+
+    @OEHasPackage(['ts-service-test'])
+    @skipIfNotInDataVar('MACHINE_FEATURES', 'ts-crypto', 'Crypto SP is not included')
+    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    def test_15_crypto_service_tests(self):
+        if 'ts-crypto' not in self.tc.td['MACHINE_FEATURES'] and \
+           'ts-se-proxy' not in self.tc.td['MACHINE_FEATURES']:
+            self.skipTest('Crypto SP is not included into OPTEE')
+        for grp in ["CryptoKeyDerivationServicePackedcTests", "CryptoMacServicePackedcTests", \
+                    "CryptoCipherServicePackedcTests", "CryptoHashServicePackedcTests", \
+                    "CryptoServicePackedcTests", "CryptoServiceProtobufTests CryptoServiceLimitTests"]:
+            self.run_test_tool('ts-service-test -g %s'%grp)
+
+    @OEHasPackage(['ts-service-test'])
+    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    def test_16_discovery_service_test(self):
+        if 'ts-crypto' not in self.tc.td['MACHINE_FEATURES'] and \
+           'ts-se-proxy' not in self.tc.td['MACHINE_FEATURES']:
+            self.skipTest('Crypto SP is not included into OPTEE')
+        self.run_test_tool('ts-service-test -g DiscoveryServiceTests')
Signature · 1 line
2.39.1.windows.1
#3 lore raw

PATCH 4/17 optee-os: Add support for TOS_FW_CONFIG on qemu

In reply to Gyorgy Szing

OP-TEE SPMC v3.20 and TF-A v2.8 is incompatible on qemu, and OP-TEE panics during boot because having an SPMC manifest passed to the SPMC is mandatory since v3.20. TF-A and OP-TEE upstream already fixed this issue by modifying the ABI between the SPMD and SPMC. Moreover qemu support in TF-A has been extended to allow building an SPMC manifest DTS file, and loading it from the FIP package.
This change adds the needed OP-TEE fixes as carried patches. The TF-A change will be added in the next commit.

---
 ...-core-arm-S-EL1-SPMC-boot-ABI-update.patch |  91 +++++++
 ...-core-ffa-add-TOS_FW_CONFIG-handling.patch | 249 ++++++++++++++++++
 .../recipes-security/optee/optee-os_3.20.0.bb |   3 +
 3 files changed, 343 insertions(+)
 create mode 100644 meta-arm/recipes-security/optee/optee-os-3.20.0/0005-core-arm-S-EL1-SPMC-boot-ABI-update.patch
 create mode 100644 meta-arm/recipes-security/optee/optee-os-3.20.0/0006-core-ffa-add-TOS_FW_CONFIG-handling.patch
meta-arm/recipes-security/optee/optee-os-3.20.0/0005-core-arm-S-EL1-SPMC-boot-ABI-update.patch new file +91 -0
new file mode 100644
index 00000000..4313a829
@@ -0,0 +1,91 @@
+From 11f4ea86579bc1a58e4adde2849326f4213694f2 Mon Sep 17 00:00:00 2001
+From: Jens Wiklander <[email protected]>
+Date: Mon, 21 Nov 2022 18:17:33 +0100
+Subject: core: arm: S-EL1 SPMC: boot ABI update
+
+Updates the boot ABI for S-EL1 SPMC to align better with other SPMCs,
+like Hafnium, but also with the non-FF-A configuration.
+
+Register usage:
+X0 - TOS FW config [1] address, if not NULL
+X2 - System DTB, if not NULL
+
+Adds check in the default get_aslr_seed() to see if the system DTB is
+present before trying to read kaslr-seed from secure-chosen.
+
+Note that this is an incompatible change and requires corresponding
+change in TF-A ("feat(qemu): update abi between spmd and spmc") [2].
+
+[1] A TF-A concept: TOS_FW_CONFIG - Trusted OS Firmware configuration
+    file. Used by Trusted OS (BL32), that is, OP-TEE in this case
+Link: [2] https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/commit/?id=25ae7ad1878244f78206cc7c91f7bdbd267331a1
+
+Upstream-Status: Accepted
+
+Acked-by: Etienne Carriere <[email protected]>
+Signed-off-by: Jens Wiklander <[email protected]>
+---
+ core/arch/arm/kernel/boot.c      |  8 +++++++-
+ core/arch/arm/kernel/entry_a64.S | 17 ++++++++---------
+ 2 files changed, 15 insertions(+), 10 deletions(-)
+
+diff --git a/core/arch/arm/kernel/boot.c b/core/arch/arm/kernel/boot.c
+index dd34173e8..e02c02b60 100644
+--- a/core/arch/arm/kernel/boot.c
++++ b/core/arch/arm/kernel/boot.c
+@@ -1502,11 +1502,17 @@ struct ns_entry_context *boot_core_hpen(void)
+ #if defined(CFG_DT)
+ unsigned long __weak get_aslr_seed(void *fdt)
+ {
+-	int rc = fdt_check_header(fdt);
++	int rc = 0;
+ 	const uint64_t *seed = NULL;
+ 	int offs = 0;
+ 	int len = 0;
+ 
++	if (!fdt) {
++		DMSG("No fdt");
++		goto err;
++	}
++
++	rc = fdt_check_header(fdt);
+ 	if (rc) {
+ 		DMSG("Bad fdt: %d", rc);
+ 		goto err;
+diff --git a/core/arch/arm/kernel/entry_a64.S b/core/arch/arm/kernel/entry_a64.S
+index 4c6e9d75c..047ae1f25 100644
+--- a/core/arch/arm/kernel/entry_a64.S
++++ b/core/arch/arm/kernel/entry_a64.S
+@@ -143,21 +143,20 @@
+ 	.endm
+ 
+ FUNC _start , :
+-#if defined(CFG_CORE_SEL1_SPMC)
+ 	/*
+-	 * With OP-TEE as SPMC at S-EL1 the SPMD (SPD_spmd) in TF-A passes
+-	 * the DTB in x0, pagaeble part in x1 and the rest of the registers
+-	 * are unused
++	 * If CFG_CORE_FFA is enabled, then x0 if non-NULL holds the TOS FW
++	 * config [1] address, else x0 if non-NULL holds the pagable part
++	 * address.
++	 *
++	 * [1] A TF-A concept: TOS_FW_CONFIG - Trusted OS Firmware
++	 * configuration file. Used by Trusted OS (BL32), that is, OP-TEE
++	 * here.
+ 	 */
+-	mov	x19, x1		/* Save pagable part */
+-	mov	x20, x0		/* Save DT address */
+-#else
+-	mov	x19, x0		/* Save pagable part address */
++	mov	x19, x0
+ #if defined(CFG_DT_ADDR)
+ 	ldr     x20, =CFG_DT_ADDR
+ #else
+ 	mov	x20, x2		/* Save DT address */
+-#endif
+ #endif
+ 
+ 	adr	x0, reset_vect_table
+-- 
+2.39.1.windows.1
+
meta-arm/recipes-security/optee/optee-os-3.20.0/0006-core-ffa-add-TOS_FW_CONFIG-handling.patch new file +249 -0

249 lines not on this page · raw message

meta-arm/recipes-security/optee/optee-os_3.20.0.bb +3 -0
index 5f4b066a..661a807d 100644
@@ -7,4 +7,7 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/optee-os-3.20.0:"
 SRCREV = "8e74d47616a20eaa23ca692f4bbbf917a236ed94"
 SRC_URI:append = " \
     file://0004-core-Define-section-attributes-for-clang.patch \
+    file://0005-core-arm-S-EL1-SPMC-boot-ABI-update.patch \
+    file://0006-core-ffa-add-TOS_FW_CONFIG-handling.patch \
    "
+EXTRA_OEMAKE += " CFG_MAP_EXT_DT_SECURE=y"
Signature · 1 line
2.39.1.windows.1
#4 lore raw

PATCH 5/17 arm/trusted-firmware-a: Add TOS_FW_CONFIG handling for quemu

In reply to Gyorgy Szing

This change:
- cherry-picks TF-A changes from master which implement passing TOS_FW_CONFIG DTB from the FIP package to the trusted OS.
- add an OP-TEE SPMC specific SPMC manifest file
- configures TF-A to build the manifest, add it to the FIP package and pass it to OP-TEE as a boot argument.

This functionality needs matching changes in OPTEE (OP-TEE v3.21 or v3.20 + carried patches.)

---
 .../files/add-spmc_manifest-for-qemu.patch    |  67 +++++
 ...emu-update-abi-between-spmd-and-spmc.patch | 263 ++++++++++++++++++
 .../trusted-firmware-a_%.bbappend             |   5 +-
 .../trusted-firmware-a_2.8.0.bb               |   6 +
 4 files changed, 340 insertions(+), 1 deletion(-)
 create mode 100644 meta-arm/recipes-bsp/trusted-firmware-a/files/add-spmc_manifest-for-qemu.patch
 create mode 100644 meta-arm/recipes-bsp/trusted-firmware-a/files/feat-qemu-update-abi-between-spmd-and-spmc.patch
meta-arm/recipes-bsp/trusted-firmware-a/files/add-spmc_manifest-for-qemu.patch new file +67 -0
new file mode 100644
index 00000000..50a57d61
@@ -0,0 +1,67 @@
+From e1cbb35ad4655fe13ccb89247c81e850f6392c92 Mon Sep 17 00:00:00 2001
+From: Gyorgy Szing <[email protected]>
+Date: Mon, 13 Mar 2023 21:15:59 +0100
+Subject: Add spmc_manifest for qemu
+
+This version only supports embedded packaging.
+
+Upstream-Status: Inappropriate [other]
+  - The SPMC manifest is integration specific and should live at an
+    integration spcific place. The manifest file is processed by TF-A
+    and I am adding the patch to TF-A to keep things simple.
+
+Signed-off-by: Gyorgy Szing <[email protected]>
+---
+ plat/qemu/fdts/optee_spmc_manifest.dts | 40 ++++++++++++++++++++++++++
+ 1 file changed, 40 insertions(+)
+ create mode 100644 plat/qemu/fdts/optee_spmc_manifest.dts
+
+diff --git a/plat/qemu/fdts/optee_spmc_manifest.dts b/plat/qemu/fdts/optee_spmc_manifest.dts
+new file mode 100644
+index 000000000..ae2ae3d95
+--- /dev/null
++++ b/plat/qemu/fdts/optee_spmc_manifest.dts
+@@ -0,0 +1,40 @@
++/* SPDX-License-Identifier: BSD-3-Clause */
++/*
++ * Copyright (c) 2023, Arm Limited. All rights reserved.
++ */
++
++/dts-v1/;
++
++/ {
++	compatible = "arm,ffa-core-manifest-1.0";
++	#address-cells = <2>;
++	#size-cells = <1>;
++
++	attribute {
++		spmc_id = <0x8000>;
++		maj_ver = <0x1>;
++		min_ver = <0x0>;
++		exec_state = <0x0>;
++		load_address = <0x0 0x0e100000>;
++		entrypoint = <0x0 0x0e100000>;
++		binary_size = <0x80000>;
++	};
++
++/*
++ * This file will be preprocessed by TF-A's build system. If Measured Boot is
++ * enabled in TF-A's config, the build system will add the MEASURED_BOOT=1 macro
++ * to the preprocessor arguments.
++ */
++#if MEASURED_BOOT
++	tpm_event_log {
++		compatible = "arm,tpm_event_log";
++		tpm_event_log_addr = <0x0 0x0>;
++		tpm_event_log_size = <0x0>;
++	};
++#endif
++
++/* If the ARM_BL2_SP_LIST_DTS is defined, SPs should be loaded from FIP */
++#ifdef ARM_BL2_SP_LIST_DTS
++	#error "FIP SP load addresses configuration is missing.
++#endif
++};
+-- 
+2.39.1.windows.1
+
meta-arm/recipes-bsp/trusted-firmware-a/files/feat-qemu-update-abi-between-spmd-and-spmc.patch new file +263 -0

263 lines not on this page · raw message

meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a_%.bbappend +4 -1
index 6cf55d69..e58a0902 100644
@@ -47,7 +47,10 @@ EXTRA_OEMAKE:append:arm:qemuall = " \
     BL32_RAM_LOCATION=tdram \
     AARCH32_SP=optee \
     "
-
+# When using OP-TEE SPMC specify the SPMC manifest file.
+EXTRA_OEMAKE:append:qemuarm64-secureboot = "${@bb.utils.contains('MACHINE_FEATURES', 'arm-ffa', \
+    'QEMU_TOS_FW_CONFIG_DTS=${S}/plat/qemu/fdts/optee_spmc_manifest.dts', '', d)}"
+     
 do_compile:append:qemuarm64-secureboot() {
     # Create a secure flash image for booting AArch64 Qemu. See:
     # https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/tree/docs/plat/qemu.rst
meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a_2.8.0.bb +6 -0
index 3a5006e5..5830339c 100644
@@ -5,6 +5,12 @@ SRCREV_tfa = "9881bb93a3bc0a3ea37e9f093e09ab4b360a9e48"
 
 SRC_URI += "file://rwx-segments.patch"
 
+# Enable passing TOS_FW_CONFIG from FIP package to Trusted OS.
+SRC_URI:append:qemuarm64-secureboot = " \
+            file://add-spmc_manifest-for-qemu.patch \
+            file://feat-qemu-update-abi-between-spmd-and-spmc.patch \
+        "
+
 LIC_FILES_CHKSUM += "file://docs/license.rst;md5=b2c740efedc159745b9b31f88ff03dde"
 
 # mbed TLS v2.28.2
Signature · 1 line
2.39.1.windows.1
#5 lore raw

PATCH 6/17 optee-test: backport SWd ABI compatibility changes

In reply to Gyorgy Szing

The ABI used by the arm-ffa-user driver to call into the SWd changed. The change was driven by the MM over FF-A ABI implementation which is used by SmmGW SP and uefi-test. uefi-test uses the same arm-ffa-user driver as xtest hence xtest needs to be updated to use the new driver. This xtest change is already merged up-stream but after v3.20, which is used here.
This change adds backported xtest changes as carried patches.

---
 ...pdate-arm_ffa_user-driver-dependency.patch |  39 +++++
 ..._ffa_user-driver-compatibility-check.patch | 163 ++++++++++++++++++
 .../optee/optee-test_3.20.0.bb                |   2 +
 3 files changed, 204 insertions(+)
 create mode 100644 meta-arm/recipes-security/optee/optee-test/Update-arm_ffa_user-driver-dependency.patch
 create mode 100644 meta-arm/recipes-security/optee/optee-test/ffa_spmc-Add-arm_ffa_user-driver-compatibility-check.patch
meta-arm/recipes-security/optee/optee-test/Update-arm_ffa_user-driver-dependency.patch new file +39 -0
new file mode 100644
index 00000000..e889f740
@@ -0,0 +1,39 @@
+From 7e15470f3dd45c844f0e0901f0c85c46a0882b8b Mon Sep 17 00:00:00 2001
+From: Gabor Toth <[email protected]>
+Date: Fri, 3 Mar 2023 12:23:45 +0100
+Subject: [PATCH 1/2] Update arm_ffa_user driver dependency
+
+Updating arm-ffa-user to v5.0.1 to get the following changes:
+ - move to 64 bit direct messages
+ - add Linux Kernel v6.1 compatibility
+The motivation is to update x-test to depend on the same driver
+version as TS uefi-test and thus to enable running these in a single
+configuration.
+Note: arm_ffa_user.h was copied from:
+ - URL:https://git.gitlab.arm.com/linux-arm/linux-trusted-services.git
+ - SHA:18e3be71f65a405dfb5d97603ae71b3c11759861
+
+Upstream-Status: Backport
+
+Signed-off-by: Gabor Toth <[email protected]>
+Acked-by: Jens Wiklander <[email protected]>
+---
+ host/xtest/include/uapi/linux/arm_ffa_user.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/host/xtest/include/uapi/linux/arm_ffa_user.h b/host/xtest/include/uapi/linux/arm_ffa_user.h
+index 9ef0be3..0acde4f 100644
+--- a/host/xtest/include/uapi/linux/arm_ffa_user.h
++++ b/host/xtest/include/uapi/linux/arm_ffa_user.h
+@@ -33,7 +33,7 @@ struct ffa_ioctl_ep_desc {
+  * @dst_id:	[in] 16-bit ID of destination endpoint.
+  */
+ struct ffa_ioctl_msg_args {
+-	__u32 args[5];
++	__u64 args[5];
+ 	__u16 dst_id;
+ };
+ #define FFA_IOC_MSG_SEND	_IOWR(FFA_IOC_MAGIC, FFA_IOC_BASE + 1, \
+-- 
+2.39.1.windows.1
+
meta-arm/recipes-security/optee/optee-test/ffa_spmc-Add-arm_ffa_user-driver-compatibility-check.patch new file +163 -0

163 lines not on this page · raw message

meta-arm/recipes-security/optee/optee-test_3.20.0.bb +2 -0
index 95452b6a..50f5afe7 100644
@@ -1,6 +1,8 @@
 require optee-test.inc
 
 SRC_URI:append = " \
+    file://Update-arm_ffa_user-driver-dependency.patch \
+    file://ffa_spmc-Add-arm_ffa_user-driver-compatibility-check.patch \
     file://musl-workaround.patch \
    "
 SRCREV = "5db8ab4c733d5b2f4afac3e9aef0a26634c4b444"
Signature · 1 line
2.39.1.windows.1
#6 lore raw

PATCH 7/17 optee-os: enable SPMC test

In reply to Gyorgy Szing

Add ta-devkit and optee-test. Change configuration to enable building and deploying OP-TEE SPMC tests.

---
 .../arm-ffa-user/arm-ffa-user_5.0.1.bb        | 14 +++--
 .../optee/optee-os-tadevkit_3.2%.bbappend     |  4 ++
 .../optee/optee-os-ts-3.18.inc                | 54 +++++++++++++++++++
 .../recipes-security/optee/optee-os-ts.inc    | 10 +++-
 .../optee/optee-os_3.1%.bbappend              |  5 ++
 ...e-os_%.bbappend => optee-os_3.2%.bbappend} |  0
 .../optee/optee-test_3.2%.bbappend            |  7 +++
 .../trusted-services/ts-sp-common.inc         |  4 +-
 .../ts-sp-spm-test-common.inc                 |  7 +++
 .../trusted-services/ts-sp-spm-test1_git.bb   |  5 ++
 .../trusted-services/ts-sp-spm-test2_git.bb   |  6 +++
 .../trusted-services/ts-sp-spm-test3_git.bb   |  6 +++
 .../trusted-services/ts-uuid.inc              |  3 ++
 13 files changed, 118 insertions(+), 7 deletions(-)
 create mode 100644 meta-arm/recipes-security/optee/optee-os-tadevkit_3.2%.bbappend
 create mode 100644 meta-arm/recipes-security/optee/optee-os-ts-3.18.inc
 create mode 100644 meta-arm/recipes-security/optee/optee-os_3.1%.bbappend
 rename meta-arm/recipes-security/optee/{optee-os_%.bbappend => optee-os_3.2%.bbappend} (100%)
 create mode 100644 meta-arm/recipes-security/optee/optee-test_3.2%.bbappend
 create mode 100644 meta-arm/recipes-security/trusted-services/ts-sp-spm-test-common.inc
 create mode 100644 meta-arm/recipes-security/trusted-services/ts-sp-spm-test1_git.bb
 create mode 100644 meta-arm/recipes-security/trusted-services/ts-sp-spm-test2_git.bb
 create mode 100644 meta-arm/recipes-security/trusted-services/ts-sp-spm-test3_git.bb
meta-arm/recipes-kernel/arm-ffa-user/arm-ffa-user_5.0.1.bb +10 -4
index 1261fa41..726a65bb 100644
@@ -18,10 +18,16 @@ COMPATIBLE_HOST = "(arm|aarch64).*-linux"
 KERNEL_MODULE_AUTOLOAD += "arm-ffa-user"
 KERNEL_MODULE_PROBECONF += "arm-ffa-user"
 
-# This debugfs driver is used only by uefi-test for testing SmmGW SP
-# UUIDs = SMM Gateway SP
-FFA-USER-UUID-LIST ?= "ed32d533-99e6-4209-9cc0-2d72cdd998a7"
-module_conf_arm-ffa-user = "options arm-ffa-user uuid_str_list=${FFA-USER-UUID-LIST}"
+# SMM Gateway SP
+UUID_LIST = "${@bb.utils.contains('MACHINE_FEATURES', 'ts-smm-gateway', \
+                                  'ed32d533-99e6-4209-9cc0-2d72cdd998a7', '' , d)}"
+# SPMC Tests SPs
+UUID_LIST:append = "${@bb.utils.contains('MACHINE_FEATURES', 'optee-spmc-test', \
+                                  ',5c9edbc3-7b3a-4367-9f83-7c191ae86a37,7817164c-c40c-4d1a-867a-9bb2278cf41a,23eb0100-e32a-4497-9052-2f11e584afa6', '' , d)}"
+
+FFA_USER_UUID_LIST ?= "${@d.getVar('UUID_LIST').strip(',')}"
+
+module_conf_arm-ffa-user = "options arm-ffa-user uuid_str_list=${FFA_USER_UUID_LIST}"
 
 do_install:append() {
     install -d ${D}${includedir}
meta-arm/recipes-security/optee/optee-os-tadevkit_3.2%.bbappend new file +4 -0
new file mode 100644
index 00000000..a9732e4c
@@ -0,0 +1,4 @@
+# Include extra headers needed by SPMC tests to TA DEVKIT.
+# Supported after op-tee v3.20
+EXTRA_OEMAKE:append = "${@bb.utils.contains('MACHINE_FEATURES', 'optee-spmc-test', \
+                                        ' CFG_SPMC_TESTS=y', '' , d)}"
meta-arm/recipes-security/optee/optee-os-ts-3.18.inc new file +54 -0

54 lines not on this page · raw message

meta-arm/recipes-security/optee/optee-os-ts.inc +9 -1
index 73b8c14f..057dde25 100644
@@ -51,4 +51,12 @@ DEPENDS:append  = "${@bb.utils.contains('MACHINE_FEATURES', 'ts-smm-gateway', \
 SP_PATHS:append = "${@bb.utils.contains('MACHINE_FEATURES', 'ts-smm-gateway', \
                                         ' ${TS_BIN}/${SMM_GATEWAY_UUID}.stripped.elf', '', d)}"
 
-EXTRA_OEMAKE:append = "${@oe.utils.conditional('SP_PATHS', '', '', ' CFG_SECURE_PARTITION=y SP_PATHS="${SP_PATHS}" ', d)}"
+# SPM test SPs
+DEPENDS:append  = "${@bb.utils.contains('MACHINE_FEATURES', 'optee-spmc-test', \
+                                        ' ts-sp-spm-test1 ts-sp-spm-test2 ts-sp-spm-test3', '' , d)}"
+SP_PATHS:append = "${@bb.utils.contains('MACHINE_FEATURES', 'optee-spmc-test', \
+                                        ' ${TS_BIN}/${SPM_TEST1_UUID}.stripped.elf ${TS_BIN}/${SPM_TEST2_UUID}.stripped.elf ${TS_BIN}/${SPM_TEST3_UUID}.stripped.elf', '', d)}"
+EXTRA_OEMAKE:append = "${@bb.utils.contains('MACHINE_FEATURES', 'optee-spmc-test', \
+                                        ' CFG_SPMC_TESTS=y', '' , d)}"
+
+EXTRA_OEMAKE:append = "${@oe.utils.conditional('SP_PATHS', '', '', ' CFG_MAP_EXT_DT_SECURE=y CFG_SECURE_PARTITION=y SP_PATHS="${SP_PATHS}" ', d)}"
meta-arm/recipes-security/optee/optee-os_3.1%.bbappend new file +5 -0
new file mode 100644
index 00000000..2ff1b834
@@ -0,0 +1,5 @@
+# Include Trusted Services Secure Partitions
+require optee-os-ts-3.18.inc
+
+# Conditionally include platform specific Trusted Services related OPTEE build parameters
+EXTRA_OEMAKE:append:qemuarm64-secureboot = "${@oe.utils.conditional('SP_PATHS', '', '', ' CFG_CORE_HEAP_SIZE=131072 CFG_TEE_BENCHMARK=n CFG_TEE_CORE_LOG_LEVEL=4 CFG_CORE_SEL1_SPMC=y ', d)}"
meta-arm/recipes-security/optee/optee-os_3.2%.bbappend renamed from meta-arm/recipes-security/optee/optee-os_%.bbappend +0 -0
similarity index 100%
rename from meta-arm/recipes-security/optee/optee-os_%.bbappend
rename to meta-arm/recipes-security/optee/optee-os_3.2%.bbappend
meta-arm/recipes-security/optee/optee-test_3.2%.bbappend new file +7 -0
new file mode 100644
index 00000000..c052774c
@@ -0,0 +1,7 @@
+# Include ffa_spmc test group if the SPMC test is enabled.
+# Supported after op-tee v3.20
+EXTRA_OEMAKE:append = "${@bb.utils.contains('MACHINE_FEATURES', 'optee-spmc-test', \
+                                        ' CFG_SPMC_TESTS=y CFG_SECURE_PARTITION=y', '' , d)}"
+
+RDEPENDS:${PN} += "${@bb.utils.contains('MACHINE_FEATURES', 'optee-spmc-test', \
+                                              ' arm-ffa-user', '' , d)}"
meta-arm/recipes-security/trusted-services/ts-sp-common.inc +2 -2
index 75ddab37..3d756015 100644
@@ -17,8 +17,8 @@ do_install:append() {
     dtc -I dts -O dtb -o ${D}${TS_INSTALL}/manifest/${SP_UUID}.dtb ${SP_DTS_FILE}
 
     # We do not need libs and headers
-    rm -r --one-file-system ${D}${TS_INSTALL}/lib
-    rm -r --one-file-system ${D}${TS_INSTALL}/include
+    rm -rf --one-file-system ${D}${TS_INSTALL}/lib
+    rm -rf --one-file-system ${D}${TS_INSTALL}/include
 }
 
 # Use Yocto debug prefix maps for compiling assembler.
meta-arm/recipes-security/trusted-services/ts-sp-spm-test-common.inc new file +7 -0
new file mode 100644
index 00000000..e357629b
@@ -0,0 +1,7 @@
+DESCRIPTION = "Trusted Services SPMC test SPs"
+
+require ts-sp-common.inc
+
+SP_UUID = "${SPM_TEST${SP_INDEX}_UUID}"
+SP_DTS_FILE ?= "${D}${TS_INSTALL}/manifest/${SP_UUID}.dts"
+OECMAKE_SOURCEPATH="${S}/deployments/spm-test${SP_INDEX}/${TS_ENV}"
meta-arm/recipes-security/trusted-services/ts-sp-spm-test1_git.bb new file +5 -0
new file mode 100644
index 00000000..4cbb970b
@@ -0,0 +1,5 @@
+DESCRIPTION = "Trusted Services SPMC test SP1"
+
+SP_INDEX="1"
+
+require ts-sp-spm-test-common.inc
meta-arm/recipes-security/trusted-services/ts-sp-spm-test2_git.bb new file +6 -0
new file mode 100644
index 00000000..e6fb822b
@@ -0,0 +1,6 @@
+DESCRIPTION = "Trusted Services SPMC test SP2"
+
+SP_INDEX="2"
+
+require ts-sp-spm-test-common.inc
+
meta-arm/recipes-security/trusted-services/ts-sp-spm-test3_git.bb new file +6 -0
new file mode 100644
index 00000000..ad3ee76e
@@ -0,0 +1,6 @@
+DESCRIPTION = "Trusted Services SPMC test SP3"
+
+SP_INDEX="3"
+
+require ts-sp-spm-test-common.inc
+
meta-arm/recipes-security/trusted-services/ts-uuid.inc +3 -0
index 7a39f733..c18ec5d7 100644
@@ -7,3 +7,6 @@ ITS_UUID         = "dc1eef48-b17a-4ccf-ac8b-dfcff7711b14"
 SE_PROXY_UUID    = "46bb39d1-b4d9-45b5-88ff-040027dab249"
 SMM_GATEWAY_UUID = "ed32d533-99e6-4209-9cc0-2d72cdd998a7"
 STORAGE_UUID     = "751bf801-3dde-4768-a514-0f10aeed1790"
+SPM_TEST1_UUID   = "5c9edbc3-7b3a-4367-9f83-7c191ae86a37"
+SPM_TEST2_UUID   = "7817164c-c40c-4d1a-867a-9bb2278cf41a"
+SPM_TEST3_UUID   = "23eb0100-e32a-4497-9052-2f11e584afa6"
\ No newline at end of file
Signature · 1 line
2.39.1.windows.1
#7 lore raw

PATCH 8/17 arm/oeqa: enable OP-TEE SPMC tests

In reply to Gyorgy Szing

Run the ffa_spmc test group of xtest if the optee-spmc-test machine feature is enabled.

---
 meta-arm/lib/oeqa/runtime/cases/trusted_services.py | 6 ++++++
 1 file changed, 6 insertions(+)
meta-arm/lib/oeqa/runtime/cases/trusted_services.py +6 -0
index 1eeca205..88298956 100644
@@ -62,6 +62,12 @@ class TrustedServicesTest(OERuntimeTestCase):
         test_grp_list+=" DiscoveryServiceTests"
         self.run_test_tool('ts-service-test -lg', expected_output=test_grp_list)
 
+    @OEHasPackage(['optee-test'])
+    @skipIfNotInDataVar('MACHINE_FEATURES', 'optee-spmc-test', 'SPMC Test SPs are not included')
+    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    def test_07_spmc_test(self):
+        self.run_test_tool('xtest -t ffa_spmc')
+
     @OEHasPackage(['ts-service-test'])
     @skipIfNotInDataVar('MACHINE_FEATURES', 'ts-fwu', 'FWU SP is not included')
     @OETestDepends(['ssh.SSHTest.test_ssh'])
Signature · 1 line
2.39.1.windows.1
#8 lore raw

PATCH 9/17 arm-bsp/trusted-services:corstone1000: remove already merged patches

In reply to Gyorgy Szing

From: Rui Miguel Silva <[email protected]>

Remove already merged patches in trusted services integration branch to avoid clash during apply patch stage and rebase the remaining patches.

---
 ...1-Add-openamp-to-SE-proxy-deployment.patch |  287 --
 ...b-capsule-update-service-components.patch} |   88 +-
 ...in-AEAD-for-psa-arch-test-54-and-58.patch} |    8 +-
 ...iver-and-the-OpenAmp-conversion-laye.patch | 1091 -------
 .../0003-Add-openamp-rpc-caller.patch         | 1196 --------
 ...=> 0003-FMP-Support-in-Corstone1000.patch} |    6 +-
 ...1.7-alignment-Align-PSA-Crypto-SIDs.patch} |   32 +-
 ...-add-psa-client-definitions-for-ff-m.patch |  298 --
 ...mon-service-component-to-ipc-support.patch |  295 --
 ...nment-Align-crypto-iovec-definition.patch} |  135 +-
 .../0006-Add-secure-storage-ipc-backend.patch |  523 ----
 ...gnment-PSA-crypto-client-in-out_vec.patch} |   39 +-
 ...storage-ipc-and-openamp-for-se_proxy.patch |   63 -
 .../corstone1000/0008-Run-psa-arch-test.patch |   72 -
 ...0009-Use-address-instead-of-pointers.patch |  168 --
 ...-Add-psa-ipc-attestation-to-se-proxy.patch |  323 ---
 ...d-as-openamp-rpc-using-secure-storag.patch |  163 --
 .../0012-add-psa-ipc-crypto-backend.patch     | 2570 -----------------
 .../0014-Configure-storage-size.patch         |   42 -
 ...face-structure-aligned-with-tf-m-cha.patch |   31 -
 ...egrate-remaining-psa-ipc-client-APIs.patch |  494 ----
 ...et_key_usage_flags-definition-to-the.patch |   40 -
 ...rstone1000-change-default-smm-values.patch |   37 -
 ...teway-add-checks-for-null-attributes.patch |   35 -
 .../0022-GetNextVariableName-Fix.patch        |   33 -
 ...3-Use-the-stateless-platform-service.patch |  140 -
 .../trusted-services/ts-arm-platforms.inc     |   32 +-
 27 files changed, 128 insertions(+), 8113 deletions(-)
 delete mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0001-Add-openamp-to-SE-proxy-deployment.patch
 rename meta-arm-bsp/recipes-security/trusted-services/corstone1000/{0013-Add-stub-capsule-update-service-components.patch => 0001-Add-stub-capsule-update-service-components.patch} (78%)
 rename meta-arm-bsp/recipes-security/trusted-services/corstone1000/{0018-Fixes-in-AEAD-for-psa-arch-test-54-and-58.patch => 0002-Fixes-in-AEAD-for-psa-arch-test-54-and-58.patch} (96%)
 delete mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0002-Implement-mhu-driver-and-the-OpenAmp-conversion-laye.patch
 delete mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0003-Add-openamp-rpc-caller.patch
 rename meta-arm-bsp/recipes-security/trusted-services/corstone1000/{0020-FMP-Support-in-Corstone1000.patch => 0003-FMP-Support-in-Corstone1000.patch} (99%)
 rename meta-arm-bsp/recipes-security/trusted-services/corstone1000/{0024-TF-Mv1.7-alignment-Align-PSA-Crypto-SIDs.patch => 0004-TF-Mv1.7-alignment-Align-PSA-Crypto-SIDs.patch} (95%)
 delete mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0004-add-psa-client-definitions-for-ff-m.patch
 delete mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0005-Add-common-service-component-to-ipc-support.patch
 rename meta-arm-bsp/recipes-security/trusted-services/corstone1000/{0025-TF-Mv1.7-alignment-Align-crypto-iovec-definition.patch => 0005-TF-Mv1.7-alignment-Align-crypto-iovec-definition.patch} (90%)
 delete mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0006-Add-secure-storage-ipc-backend.patch
 rename meta-arm-bsp/recipes-security/trusted-services/corstone1000/{0026-TF-Mv1.7-alignment-PSA-crypto-client-in-out_vec.patch => 0006-TF-Mv1.7-alignment-PSA-crypto-client-in-out_vec.patch} (80%)
 delete mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0007-Use-secure-storage-ipc-and-openamp-for-se_proxy.patch
 delete mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0008-Run-psa-arch-test.patch
 delete mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0009-Use-address-instead-of-pointers.patch
 delete mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0010-Add-psa-ipc-attestation-to-se-proxy.patch
 delete mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0011-Setup-its-backend-as-openamp-rpc-using-secure-storag.patch
 delete mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0012-add-psa-ipc-crypto-backend.patch
 delete mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0014-Configure-storage-size.patch
 delete mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0015-Fix-Crypto-interface-structure-aligned-with-tf-m-cha.patch
 delete mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0016-Integrate-remaining-psa-ipc-client-APIs.patch
 delete mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0017-Fix-update-psa_set_key_usage_flags-definition-to-the.patch
 delete mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0019-plat-corstone1000-change-default-smm-values.patch
 delete mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0021-smm_gateway-add-checks-for-null-attributes.patch
 delete mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0022-GetNextVariableName-Fix.patch
 delete mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0023-Use-the-stateless-platform-service.patch
meta-arm-bsp/recipes-security/trusted-services/corstone1000/0001-Add-openamp-to-SE-proxy-deployment.patch deleted +0 -287
deleted file mode 100644
index c44885cf..00000000
@@ -1,287 +0,0 @@
-From 13de79cd4f0d25b812e5f4ad4a19bc075496be83 Mon Sep 17 00:00:00 2001
-From: Vishnu Banavath <[email protected]>
-Date: Fri, 3 Dec 2021 16:36:51 +0000
-Subject: [PATCH 01/20] Add openamp to SE proxy deployment
-
-Openamp is required to communicate between secure partitions(running on
-Cortex-A) and trusted-firmware-m(running on Cortex-M).
-These changes are to fetch libmetal and openamp from github repo's
-and build it.
-
-Upstream-Status: Pending
-Signed-off-by: Vishnu Banavath <[email protected]>
-Signed-off-by: Rui Miguel Silva <[email protected]>
----
- deployments/se-proxy/opteesp/lse.S            | 28 ++++++++
- deployments/se-proxy/se-proxy.cmake           |  8 +++
- external/openamp/libmetal-init-cache.cmake.in | 20 ++++++
- external/openamp/libmetal.cmake               | 67 +++++++++++++++++++
- external/openamp/openamp-init-cache.cmake.in  | 20 ++++++
- external/openamp/openamp.cmake                | 66 ++++++++++++++++++
- 6 files changed, 209 insertions(+)
- create mode 100644 deployments/se-proxy/opteesp/lse.S
- create mode 100644 external/openamp/libmetal-init-cache.cmake.in
- create mode 100644 external/openamp/libmetal.cmake
- create mode 100644 external/openamp/openamp-init-cache.cmake.in
- create mode 100644 external/openamp/openamp.cmake
-
-diff --git a/deployments/se-proxy/opteesp/lse.S b/deployments/se-proxy/opteesp/lse.S
-new file mode 100644
-index 000000000000..8e466d65fc2b
---- /dev/null
-+++ b/deployments/se-proxy/opteesp/lse.S
-@@ -0,0 +1,28 @@
-+// SPDX-License-Identifier: BSD-3-Clause
-+/*
-+ * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
-+ */
-+
-+.text
-+.globl __aarch64_cas4_acq_rel
-+.globl __aarch64_cas4_sync
-+
-+__aarch64_cas4_acq_rel:
-+	mov	w16, w0
-+	ldaxr	w0, [x2]
-+	cmp	w0, w16
-+0:	bne	1f
-+
-+	stlxr	w17, w1, [x2]
-+	cbnz	w17, 0b
-+1:	ret
-+
-+__aarch64_cas4_sync:
-+	mov	w16, w0
-+	ldxr	w0, [x2]
-+	cmp	w0, w16
-+0:	bne	1f
-+
-+	stlxr	w17, w1, [x2]
-+	cbnz	w17, 0b
-+1:	ret
-diff --git a/deployments/se-proxy/se-proxy.cmake b/deployments/se-proxy/se-proxy.cmake
-index 426c66c05350..d39873a0fe81 100644
---- a/deployments/se-proxy/se-proxy.cmake
-+++ b/deployments/se-proxy/se-proxy.cmake
-@@ -61,6 +61,7 @@ add_components(TARGET "se-proxy"
- target_sources(se-proxy PRIVATE
- 	${CMAKE_CURRENT_LIST_DIR}/common/se_proxy_sp.c
- 	${CMAKE_CURRENT_LIST_DIR}/common/service_proxy_factory.c
-+	${CMAKE_CURRENT_LIST_DIR}/opteesp/lse.S
- )
- 
- #-------------------------------------------------------------------------------
-@@ -73,6 +74,13 @@ include(../../../external/nanopb/nanopb.cmake)
- target_link_libraries(se-proxy PRIVATE nanopb::protobuf-nanopb-static)
- protobuf_generate_all(TGT "se-proxy" NAMESPACE "protobuf" BASE_DIR "${TS_ROOT}/protocols")
- 
-+# libmetal
-+include(../../../external/openamp/libmetal.cmake)
-+
-+# OpenAMP
-+include(../../../external/openamp/openamp.cmake)
-+target_link_libraries(se-proxy PRIVATE openamp libmetal)
-+
- #################################################################
- 
- target_include_directories(se-proxy PRIVATE
-diff --git a/external/openamp/libmetal-init-cache.cmake.in b/external/openamp/libmetal-init-cache.cmake.in
-new file mode 100644
-index 000000000000..04c25fbde960
---- /dev/null
-+++ b/external/openamp/libmetal-init-cache.cmake.in
-@@ -0,0 +1,20 @@
-+#-------------------------------------------------------------------------------
-+# Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
-+# Copyright (c) 2021-2022, Linaro. All rights reserved.
-+#
-+# SPDX-License-Identifier: BSD-3-Clause
-+#
-+#-------------------------------------------------------------------------------
-+
-+set(CMAKE_INSTALL_PREFIX "@BUILD_INSTALL_DIR@" CACHE STRING "")
-+set(CMAKE_TOOLCHAIN_FILE "@TS_EXTERNAL_LIB_TOOLCHAIN_FILE@" CACHE STRING "")
-+set(BUILD_SHARED_LIBS Off CACHE BOOL "")
-+set(BUILD_STATIC_LIBS On CACHE BOOL "")
-+
-+set(WITH_DOC OFF CACHE BOOL "")
-+set(WITH_TESTS OFF CACHE BOOL "")
-+set(WITH_EXAMPLES OFF CACHE BOOL "")
-+set(WITH_DEFAULT_LOGGER OFF CACHE BOOL "")
-+set(MACHINE "template" CACHE STRING "")
-+
-+@_cmake_fragment@
-diff --git a/external/openamp/libmetal.cmake b/external/openamp/libmetal.cmake
-new file mode 100644
-index 000000000000..6e5004ff555c
---- /dev/null
-+++ b/external/openamp/libmetal.cmake
-@@ -0,0 +1,67 @@
-+#-------------------------------------------------------------------------------
-+# Copyright (c) 2022 Linaro Limited
-+# Copyright (c) 2022, Arm Limited. All rights reserved.
-+#
-+# SPDX-License-Identifier: BSD-3-Clause
-+#
-+#-------------------------------------------------------------------------------
-+
-+set (LIBMETAL_URL "https://github.com/OpenAMP/libmetal.git"
-+		    CACHE STRING "libmetal repository URL")
-+set (LIBMETAL_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/libmetal_install"
-+		    CACHE DIR "libmetal installation directory")
-+set(LIBMETAL_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_deps/libmetal"
-+		CACHE DIR "libmetal source-code")
-+set (LIBMETAL_PACKAGE_DIR "${LIBMETAL_INSTALL_DIR}/libmetal/cmake"
-+			    CACHE DIR "libmetal CMake package directory")
-+set (LIBMETAL_TARGET_NAME "libmetal")
-+set (LIBMETAL_REFSPEC "f252f0e007fbfb8b3a52b1d5901250ddac96baad"
-+			CACHE STRING "The version of libmetal to use")
-+set(LIBMETAL_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/_deps/libmetal-build")
-+
-+set(GIT_OPTIONS
-+    GIT_REPOSITORY ${LIBMETAL_URL}
-+    GIT_TAG ${LIBMETAL_REFSPEC}
-+    GIT_SHALLOW FALSE
-+)
-+
-+if(NOT LIBMETAL_DEBUG)
-+	set(LIBMETAL_BUILD_TYPE "Release")
-+else()
-+	set(LIBMETAL_BUILD_TYPE "Debug")
-+endif()
-+
-+include(FetchContent)
-+
-+# Checking git
-+find_program(GIT_COMMAND "git")
-+if (NOT GIT_COMMAND)
-+	message(FATAL_ERROR "Please install git")
-+endif()
-+
-+# Only pass libc settings to libmetal if needed. For environments where the
-+# standard library is not overridden, this is not needed.
-+if(TARGET stdlib::c)
-+	include(${TS_ROOT}/tools/cmake/common/PropertyCopy.cmake)
-+
-+	# Save libc settings
-+	save_interface_target_properties(TGT stdlib::c PREFIX LIBC)
-+	# Translate libc settings to cmake code fragment. Will be inserted into
-+	# libmetal-init-cache.cmake.in when LazyFetch configures the file.
-+	translate_interface_target_properties(PREFIX LIBC RES _cmake_fragment)
-+	unset_saved_properties(LIBC)
-+endif()
-+
-+include(${TS_ROOT}/tools/cmake/common/LazyFetch.cmake REQUIRED)
-+LazyFetch_MakeAvailable(DEP_NAME libmetal
-+    FETCH_OPTIONS "${GIT_OPTIONS}"
-+    INSTALL_DIR "${LIBMETAL_INSTALL_DIR}"
-+    CACHE_FILE "${TS_ROOT}/external/openamp/libmetal-init-cache.cmake.in"
-+    SOURCE_DIR "${LIBMETAL_SOURCE_DIR}"
-+)
-+unset(_cmake_fragment)
-+
-+#Create an imported target to have clean abstraction in the build-system.
-+add_library(libmetal STATIC IMPORTED)
-+set_property(TARGET libmetal PROPERTY IMPORTED_LOCATION "${LIBMETAL_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}metal${CMAKE_STATIC_LIBRARY_SUFFIX}")
-+set_property(TARGET libmetal PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${LIBMETAL_INSTALL_DIR}/include")
-diff --git a/external/openamp/openamp-init-cache.cmake.in b/external/openamp/openamp-init-cache.cmake.in
-new file mode 100644
-index 000000000000..302b80511bce
---- /dev/null
-+++ b/external/openamp/openamp-init-cache.cmake.in
-@@ -0,0 +1,20 @@
-+#-------------------------------------------------------------------------------
-+# Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
-+# Copyright (c) 2021-2022, Linaro. All rights reserved.
-+#
-+# SPDX-License-Identifier: BSD-3-Clause
-+#
-+#-------------------------------------------------------------------------------
-+
-+set(CMAKE_INSTALL_PREFIX "@BUILD_INSTALL_DIR@" CACHE STRING "")
-+set(CMAKE_TOOLCHAIN_FILE "@TS_EXTERNAL_LIB_TOOLCHAIN_FILE@" CACHE STRING "")
-+set(BUILD_SHARED_LIBS Off CACHE BOOL "")
-+set(BUILD_STATIC_LIBS On CACHE BOOL "")
-+
-+set(LIBMETAL_INCLUDE_DIR "@CMAKE_CURRENT_BINARY_DIR@/libmetal_install/include" CACHE
-+    STRING "")
-+set(LIBMETAL_LIB "@CMAKE_CURRENT_BINARY_DIR@/libmetal_install/lib" CACHE STRING "")
-+set(RPMSG_BUFFER_SIZE "512" CACHE STRING "")
-+set(MACHINE "template" CACHE STRING "")
-+
-+@_cmake_fragment@
-diff --git a/external/openamp/openamp.cmake b/external/openamp/openamp.cmake
-new file mode 100644
-index 000000000000..449f35f4fda4
---- /dev/null
-+++ b/external/openamp/openamp.cmake
-@@ -0,0 +1,66 @@
-+#-------------------------------------------------------------------------------
-+# Copyright (c) 2022 Linaro Limited
-+# Copyright (c) 2022, Arm Limited. All rights reserved.
-+#
-+# SPDX-License-Identifier: BSD-3-Clause
-+#
-+#-------------------------------------------------------------------------------
-+
-+set (OPENAMP_URL "https://github.com/OpenAMP/open-amp.git"
-+		    CACHE STRING "OpenAMP repository URL")
-+set (OPENAMP_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/openamp_install"
-+			    CACHE DIR "OpenAMP installation directory")
-+set (OPENAMP_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_deps/openamp"
-+			    CACHE DIR "OpenAMP source code directory")
-+set (OPENAMP_PACKAGE_DIR "${OPENAMP_INSTALL_DIR}/openamp/cmake"
-+			    CACHE DIR "OpenAMP CMake package directory")
-+set (OPENAMP_TARGET_NAME "openamp")
-+set (OPENAMP_REFSPEC "347397decaa43372fc4d00f965640ebde042966d"
-+			CACHE STRING "The version of openamp to use")
-+
-+set(GIT_OPTIONS
-+    GIT_REPOSITORY ${OPENAMP_URL}
-+    GIT_TAG ${OPENAMP_REFSPEC}
-+    GIT_SHALLOW FALSE
-+)
-+
-+if(NOT OPENAMP_DEBUG)
-+	set(OPENAMP_BUILD_TYPE "Release")
-+else()
-+	set(OPENAMP_BUILD_TYPE "Debug")
-+endif()
-+
-+include(FetchContent)
-+
-+# Checking git
-+find_program(GIT_COMMAND "git")
-+if (NOT GIT_COMMAND)
-+	message(FATAL_ERROR "Please install git")
-+endif()
-+
-+# Only pass libc settings to openamp if needed. For environments where the
-+# standard library is not overridden, this is not needed.
-+if(TARGET stdlib::c)
-+	include(${TS_ROOT}/tools/cmake/common/PropertyCopy.cmake)
-+
-+	# Save libc settings
-+	save_interface_target_properties(TGT stdlib::c PREFIX LIBC)
-+	# Translate libc settings to cmake code fragment. Will be inserted into
-+	# libmetal-init-cache.cmake.in when LazyFetch configures the file.
-+	translate_interface_target_properties(PREFIX LIBC RES _cmake_fragment)
-+	unset_saved_properties(LIBC)
-+endif()
-+
-+include(${TS_ROOT}/tools/cmake/common/LazyFetch.cmake REQUIRED)
-+LazyFetch_MakeAvailable(DEP_NAME openamp
-+    FETCH_OPTIONS "${GIT_OPTIONS}"
-+    INSTALL_DIR "${OPENAMP_INSTALL_DIR}"
-+    CACHE_FILE "${TS_ROOT}/external/openamp/openamp-init-cache.cmake.in"
-+    SOURCE_DIR "${OPENAMP_SOURCE_DIR}"
-+)
-+unset(_cmake_fragment)
-+
-+#Create an imported target to have clean abstraction in the build-system.
-+add_library(openamp STATIC IMPORTED)
-+set_property(TARGET openamp PROPERTY IMPORTED_LOCATION "${OPENAMP_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}open_amp${CMAKE_STATIC_LIBRARY_SUFFIX}")
-+set_property(TARGET openamp PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${OPENAMP_INSTALL_DIR}/include")
--- 
-2.38.1
-
meta-arm-bsp/recipes-security/trusted-services/corstone1000/0001-Add-stub-capsule-update-service-components.patch renamed from meta-arm-bsp/recipes-security/trusted-services/corstone1000/0013-Add-stub-capsule-update-service-components.patch +14 -74

116 lines not on this page · raw message

meta-arm-bsp/recipes-security/trusted-services/corstone1000/0002-Fixes-in-AEAD-for-psa-arch-test-54-and-58.patch renamed from meta-arm-bsp/recipes-security/trusted-services/corstone1000/0018-Fixes-in-AEAD-for-psa-arch-test-54-and-58.patch +4 -4
similarity index 96%
rename from meta-arm-bsp/recipes-security/trusted-services/corstone1000/0018-Fixes-in-AEAD-for-psa-arch-test-54-and-58.patch
rename to meta-arm-bsp/recipes-security/trusted-services/corstone1000/0002-Fixes-in-AEAD-for-psa-arch-test-54-and-58.patch
index c1598a9e..3f3800ce 100644
@@ -1,7 +1,7 @@
-From 1a4d46fdc0b5745b9cfb0789e4b778111bd6dbbb Mon Sep 17 00:00:00 2001
+From 51a7024967187644011c5043ef0f733cf81b26be Mon Sep 17 00:00:00 2001
 From: Satish Kumar <[email protected]>
 Date: Mon, 14 Feb 2022 08:22:25 +0000
-Subject: [PATCH 18/20] Fixes in AEAD for psa-arch test 54 and 58.
+Subject: [PATCH 2/6] Fixes in AEAD for psa-arch test 54 and 58.
 
 Upstream-Status: Pending [Not submitted to upstream yet]
 Signed-off-by: Emekcan Aras <[email protected]>
@@ -29,7 +29,7 @@ index c4ffb20cf7f8..a91f66c14008 100644
  
  	/* Mandatory input data parameter */
 diff --git a/components/service/crypto/include/psa/crypto_sizes.h b/components/service/crypto/include/psa/crypto_sizes.h
-index 4d7bf6e959b0..e3c4df2927b3 100644
+index 30aa102da581..130d27295878 100644
 --- a/components/service/crypto/include/psa/crypto_sizes.h
 +++ b/components/service/crypto/include/psa/crypto_sizes.h
 @@ -351,7 +351,7 @@
@@ -117,5 +117,5 @@ index 0be266b52403..435fd3b523ce 100644
  
  /* Variable length input parameter tags */
 -- 
-2.38.1
+2.40.0
 
meta-arm-bsp/recipes-security/trusted-services/corstone1000/0002-Implement-mhu-driver-and-the-OpenAmp-conversion-laye.patch deleted +0 -1091

1,091 lines not on this page · raw message

meta-arm-bsp/recipes-security/trusted-services/corstone1000/0003-Add-openamp-rpc-caller.patch deleted +0 -1196

1,196 lines not on this page · raw message

meta-arm-bsp/recipes-security/trusted-services/corstone1000/0003-FMP-Support-in-Corstone1000.patch renamed from meta-arm-bsp/recipes-security/trusted-services/corstone1000/0020-FMP-Support-in-Corstone1000.patch +3 -3
similarity index 99%
rename from meta-arm-bsp/recipes-security/trusted-services/corstone1000/0020-FMP-Support-in-Corstone1000.patch
rename to meta-arm-bsp/recipes-security/trusted-services/corstone1000/0003-FMP-Support-in-Corstone1000.patch
index ce40df0f..3d743d28 100644
@@ -1,7 +1,7 @@
-From 70cf374fb55f2d62ecbe28049253df33b42b6749 Mon Sep 17 00:00:00 2001
+From 5c8ac10337ac853d8a82992fb6e1d91b122b99d2 Mon Sep 17 00:00:00 2001
 From: Satish Kumar <[email protected]>
 Date: Fri, 8 Jul 2022 09:48:06 +0100
-Subject: [PATCH 20/20] FMP Support in Corstone1000.
+Subject: [PATCH 3/6] FMP Support in Corstone1000.
 
 The FMP support is used by u-boot to pupolate ESRT information
 for the kernel.
@@ -414,5 +414,5 @@ index 000000000000..95fba2a04d5c
 +
 +#endif /* CORSTONE1000_FMP_SERVICE_H */
 -- 
-2.38.1
+2.40.0
 
meta-arm-bsp/recipes-security/trusted-services/corstone1000/0004-TF-Mv1.7-alignment-Align-PSA-Crypto-SIDs.patch renamed from meta-arm-bsp/recipes-security/trusted-services/corstone1000/0024-TF-Mv1.7-alignment-Align-PSA-Crypto-SIDs.patch +13 -19
similarity index 95%
rename from meta-arm-bsp/recipes-security/trusted-services/corstone1000/0024-TF-Mv1.7-alignment-Align-PSA-Crypto-SIDs.patch
rename to meta-arm-bsp/recipes-security/trusted-services/corstone1000/0004-TF-Mv1.7-alignment-Align-PSA-Crypto-SIDs.patch
index 7e65de86..628d8682 100644
@@ -1,24 +1,25 @@
-From ca7d37502f9453125aead14c7ee5181336cbe8f4 Mon Sep 17 00:00:00 2001
+From c294197b17358b20c75757b9a06d628f43cd7884 Mon Sep 17 00:00:00 2001
 From: Mohamed Omar Asaker <[email protected]>
 Date: Thu, 9 Feb 2023 00:22:40 +0000
-Subject: [PATCH 1/3] TF-Mv1.7 alignment: Align PSA Crypto SIDs
+Subject: [PATCH 4/6] TF-Mv1.7 alignment: Align PSA Crypto SIDs
 
 This patch is to change the PSA Crypto SIDs to match the values of the
 PSA Crypto SID definitions in TF-M v1.7 running on the secure enclave
 
 Signed-off-by: Mohamed Omar Asaker <[email protected]>
 Upstream-Status: Pending [Not submitted yet]
+Signed-off-by: Rui Miguel Silva <[email protected]>
 ---
  .../service/common/include/psa/crypto_sid.h   | 241 ++++++++++++++++++
- components/service/common/include/psa/sid.h   |  78 +-----
+ components/service/common/include/psa/sid.h   |  76 +-----
  .../caller/psa_ipc/crypto_caller_sign_hash.h  |   4 +-
  .../psa_ipc/crypto_caller_verify_hash.h       |   4 +-
- 4 files changed, 249 insertions(+), 78 deletions(-)
+ 4 files changed, 248 insertions(+), 77 deletions(-)
  create mode 100644 components/service/common/include/psa/crypto_sid.h
 
 diff --git a/components/service/common/include/psa/crypto_sid.h b/components/service/common/include/psa/crypto_sid.h
 new file mode 100644
-index 00000000..5b05f46d
+index 000000000000..5b05f46d7d72
 --- /dev/null
 +++ b/components/service/common/include/psa/crypto_sid.h
 @@ -0,0 +1,241 @@
@@ -264,16 +265,9 @@ index 00000000..5b05f46d
 +
 +#endif /* __PSA_CRYPTO_SID_H__ */
 diff --git a/components/service/common/include/psa/sid.h b/components/service/common/include/psa/sid.h
-index 8103a9af..50ad070e 100644
+index 8e2c6bdf2919..5aaa659d49a0 100644
 --- a/components/service/common/include/psa/sid.h
 +++ b/components/service/common/include/psa/sid.h
-@@ -1,5 +1,5 @@
- /*
-- * Copyright (c) 2019-2021, Arm Limited. All rights reserved.
-+ * Copyright (c) 2019-2023, Arm Limited. All rights reserved.
-  *
-  * SPDX-License-Identifier: BSD-3-Clause
-  *
 @@ -12,6 +12,9 @@
  extern "C" {
  #endif
@@ -284,9 +278,9 @@ index 8103a9af..50ad070e 100644
  /******** TFM_SP_PS ********/
  #define TFM_PROTECTED_STORAGE_SERVICE_SID                          (0x00000060U)
  #define TFM_PROTECTED_STORAGE_SERVICE_VERSION                      (1U)
-@@ -43,79 +46,6 @@ extern "C" {
- #define TFM_PLATFORM_SERVICE_HANDLE       (0x40000105U)
- 
+@@ -37,79 +40,6 @@ extern "C" {
+ #define TFM_CRYPTO_VERSION                                         (1U)
+ #define TFM_CRYPTO_HANDLE                                          (0x40000100U)
  
 -/**
 - * \brief Define a progressive numerical value for each SID which can be used
@@ -365,7 +359,7 @@ index 8103a9af..50ad070e 100644
  #define TFM_SP_PLATFORM_SYSTEM_RESET_SID                           (0x00000040U)
  #define TFM_SP_PLATFORM_SYSTEM_RESET_VERSION                       (1U)
 diff --git a/components/service/crypto/client/caller/psa_ipc/crypto_caller_sign_hash.h b/components/service/crypto/client/caller/psa_ipc/crypto_caller_sign_hash.h
-index e4a2b167..9276748d 100644
+index 29bd56e60708..bebfe05c7c49 100644
 --- a/components/service/crypto/client/caller/psa_ipc/crypto_caller_sign_hash.h
 +++ b/components/service/crypto/client/caller/psa_ipc/crypto_caller_sign_hash.h
 @@ -37,7 +37,7 @@ static inline psa_status_t crypto_caller_sign_hash(struct service_client *contex
@@ -387,7 +381,7 @@ index e4a2b167..9276748d 100644
  		.alg = alg,
  	};
 diff --git a/components/service/crypto/client/caller/psa_ipc/crypto_caller_verify_hash.h b/components/service/crypto/client/caller/psa_ipc/crypto_caller_verify_hash.h
-index cc9279ee..bcd8e0e4 100644
+index 66281d588626..d0a3850678cb 100644
 --- a/components/service/crypto/client/caller/psa_ipc/crypto_caller_verify_hash.h
 +++ b/components/service/crypto/client/caller/psa_ipc/crypto_caller_verify_hash.h
 @@ -63,7 +63,7 @@ static inline psa_status_t crypto_caller_verify_hash(struct service_client *cont
@@ -409,5 +403,5 @@ index cc9279ee..bcd8e0e4 100644
  
  #ifdef __cplusplus
 -- 
-2.25.1
+2.40.0
 
meta-arm-bsp/recipes-security/trusted-services/corstone1000/0004-add-psa-client-definitions-for-ff-m.patch deleted +0 -298

191 lines not on this page · raw message

meta-arm-bsp/recipes-security/trusted-services/corstone1000/0005-Add-common-service-component-to-ipc-support.patch deleted +0 -295

295 lines not on this page · raw message

meta-arm-bsp/recipes-security/trusted-services/corstone1000/0005-TF-Mv1.7-alignment-Align-crypto-iovec-definition.patch renamed from meta-arm-bsp/recipes-security/trusted-services/corstone1000/0025-TF-Mv1.7-alignment-Align-crypto-iovec-definition.patch +68 -67

135 lines not on this page · raw message

meta-arm-bsp/recipes-security/trusted-services/corstone1000/0006-Add-secure-storage-ipc-backend.patch deleted +0 -523

523 lines not on this page · raw message

meta-arm-bsp/recipes-security/trusted-services/corstone1000/0006-TF-Mv1.7-alignment-PSA-crypto-client-in-out_vec.patch renamed from meta-arm-bsp/recipes-security/trusted-services/corstone1000/0026-TF-Mv1.7-alignment-PSA-crypto-client-in-out_vec.patch +20 -19
similarity index 80%
rename from meta-arm-bsp/recipes-security/trusted-services/corstone1000/0026-TF-Mv1.7-alignment-PSA-crypto-client-in-out_vec.patch
rename to meta-arm-bsp/recipes-security/trusted-services/corstone1000/0006-TF-Mv1.7-alignment-PSA-crypto-client-in-out_vec.patch
index 0dcdd5da..7a9bee6d 100644

Lines of this file are not shown. View the raw message.

meta-arm-bsp/recipes-security/trusted-services/corstone1000/0007-Use-secure-storage-ipc-and-openamp-for-se_proxy.patch deleted +0 -63

63 lines not on this page · raw message

meta-arm-bsp/recipes-security/trusted-services/corstone1000/0008-Run-psa-arch-test.patch deleted +0 -72

72 lines not on this page · raw message

meta-arm-bsp/recipes-security/trusted-services/corstone1000/0009-Use-address-instead-of-pointers.patch deleted +0 -168

168 lines not on this page · raw message

meta-arm-bsp/recipes-security/trusted-services/corstone1000/0010-Add-psa-ipc-attestation-to-se-proxy.patch deleted +0 -323

323 lines not on this page · raw message

meta-arm-bsp/recipes-security/trusted-services/corstone1000/0011-Setup-its-backend-as-openamp-rpc-using-secure-storag.patch deleted +0 -163

163 lines not on this page · raw message

meta-arm-bsp/recipes-security/trusted-services/corstone1000/0012-add-psa-ipc-crypto-backend.patch deleted +0 -2570

2,570 lines not on this page · raw message

meta-arm-bsp/recipes-security/trusted-services/corstone1000/0014-Configure-storage-size.patch deleted +0 -42

42 lines not on this page · raw message

meta-arm-bsp/recipes-security/trusted-services/corstone1000/0015-Fix-Crypto-interface-structure-aligned-with-tf-m-cha.patch deleted +0 -31
deleted file mode 100644
index 426f2ca5..00000000

Lines of this file are not shown. View the raw message.

meta-arm-bsp/recipes-security/trusted-services/corstone1000/0016-Integrate-remaining-psa-ipc-client-APIs.patch deleted +0 -494

494 lines not on this page · raw message

meta-arm-bsp/recipes-security/trusted-services/corstone1000/0017-Fix-update-psa_set_key_usage_flags-definition-to-the.patch deleted +0 -40
deleted file mode 100644
index 4adcd90a..00000000

Lines of this file are not shown. View the raw message.

meta-arm-bsp/recipes-security/trusted-services/corstone1000/0019-plat-corstone1000-change-default-smm-values.patch deleted +0 -37
deleted file mode 100644
index 02c89d89..00000000

Lines of this file are not shown. View the raw message.

meta-arm-bsp/recipes-security/trusted-services/corstone1000/0021-smm_gateway-add-checks-for-null-attributes.patch deleted +0 -35
deleted file mode 100644
index 87c053fc..00000000

Lines of this file are not shown. View the raw message.

meta-arm-bsp/recipes-security/trusted-services/corstone1000/0022-GetNextVariableName-Fix.patch deleted +0 -33
deleted file mode 100644
index ed4e6e27..00000000

Lines of this file are not shown. View the raw message.

meta-arm-bsp/recipes-security/trusted-services/corstone1000/0023-Use-the-stateless-platform-service.patch deleted +0 -140

140 lines not on this page · raw message

meta-arm-bsp/recipes-security/trusted-services/ts-arm-platforms.inc +6 -26
index 867bd66e..17c957e2 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.39.1.windows.1

Part of the diff is not shown here. View the raw message.

#9 lore raw

PATCH 10/17 trusted-services: update documentation

In reply to Gyorgy Szing

Add information related to SPMC tests and fix stale links.

---
 documentation/trusted-services.md | 40 ++++++++++++++++++++-----------
 1 file changed, 26 insertions(+), 14 deletions(-)
documentation/trusted-services.md +26 -14
index e3cee6b3..70826f68 100644
@@ -1,6 +1,6 @@
 # The Trusted Services: framework for developing root-of-trust services
 
-  meta-arm layer includes recipes for [Trusted Services][1] Secure Partitions and Normal World applications
+meta-arm layer includes recipes for [Trusted Services][^1] Secure Partitions and Normal World applications
 in `meta-arm/recipes-security/trusted-services`
 
 ## Secure Partitions recipes
@@ -12,7 +12,7 @@ These files are automatically included into optee-os image accordingly to define
 ### How to include TS SPs
 
 To include TS SPs into optee-os image you need to add into MACHINE_FEATURES
-features for each [Secure Partition][2] you would like to include:
+features for each [Secure Partition][^2] you would like to include:
 
 | Secure Partition  | MACHINE_FEATURE |
 | ----------------- | --------------- |
@@ -22,32 +22,44 @@ features for each [Secure Partition][2] you would like to include:
 | Protected Storage | ts-storage      |
 | se-proxy          | ts-se-proxy     |
 | smm-gateway       | ts-smm-gateway  |
+| spm-test[1-3]     | optee-spmc-test |
 
 Other steps depend on your machine/platform definition:
 
 1. For communications between Secure and Normal Words Linux kernel option `CONFIG_ARM_FFA_TRANSPORT=y`
-is required. If your platform doesn't include it already you can add `arm-ffa` into MACHINE_FEATURES.
+   is required. If your platform doesn't include it already you can add `arm-ffa` into MACHINE_FEATURES.
+   (Please see ` meta-arm/recipes-kernel/arm-ffa-tee`.)
+
+   For running the `uefi-test` or the `xtest -t ffa_spmc` tests under Linux the `arm-ffa-user` drivel is required. This is
+   enabled if the `ts-smm-gateway` and/or the `optee-spmc-test` machine features are enabled.
+   (Please see ` meta-arm/recipes-kernel/arm-ffa-user`.)
 
 2. optee-os might require platform specific OP-TEE build parameters (for example what SEL the SPM Core is implemented at).
-You can find examples in `meta-arm/recipes-security/optee/optee-os_%.bbappend` for qemuarm64-secureboot machine
-and in `meta-arm-bsp/recipes-security/optee/optee-os-n1sdp.inc` and `meta-arm-bsp/recipes-security/optee/optee-os-corstone1000-common.inc`
-for N1SDP and Corstone1000 platforms accordingly.
+   You can find examples in `meta-arm/recipes-security/optee/optee-os_%.bbappend` for qemuarm64-secureboot machine
+   and in `meta-arm-bsp/recipes-security/optee/optee-os-n1sdp.inc` and `meta-arm-bsp/recipes-security/optee/optee-os-corstone1000-common.inc`
+   for N1SDP and Corstone1000 platforms accordingly.
 
 3. trusted-firmware-a might require platform specific TF-A build parameters (SPD and SPMC details on the platform).
-See `meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a_%.bbappend` for qemuarm64-secureboot machine
-and in `meta-arm-bsp/recipes-bsp/trusted-firmware-a/trusted-firmware-a-n1sdp.inc` and
-`meta-arm-bsp/recipes-bsp/trusted-firmware-a/trusted-firmware-a-corstone1000.inc` for N1SDP and Corstone1000 platforms.
+   See `meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a_%.bbappend` for qemuarm64-secureboot machine
+   and in `meta-arm-bsp/recipes-bsp/trusted-firmware-a/trusted-firmware-a-n1sdp.inc` and
+   `meta-arm-bsp/recipes-bsp/trusted-firmware-a/trusted-firmware-a-corstone1000.inc` for N1SDP and Corstone1000 platforms.
 
 ## Normal World applications
 
-  Optionally for testing purposes you can add `packagegroup-ts-tests` and `packagegroup-ts-tests-psa` package groups into your image.
-They include [Trusted Services test and demo tools][3]
+Optionally for testing purposes you can add `packagegroup-ts-tests` into your image. It includes 
+[Trusted Services test and demo tools][^3] and [xtest][^4] configured to include the `ffa_spmc` tests.
 
 ## OEQA Trusted Services tests
 
   meta-arm also includes Trusted Service OEQA tests which can be used for automated testing.
 See `ci/trusted-services.yml` for an example how to include them into an image.
 
-[1] https://trusted-services.readthedocs.io/en/integration/overview/introduction.html
-[2] https://trusted-services.readthedocs.io/en/integration/developer/deployments/secure-partitions.html
-[3] https://trusted-services.readthedocs.io/en/integration/developer/deployments/test-executables.html
+
+------
+[^1]: https://trusted-services.readthedocs.io/en/integration/overview/index.html
+
+[^2]: https://trusted-services.readthedocs.io/en/integration/deployments/secure-partitions.html
+
+[^3]: https://trusted-services.readthedocs.io/en/integration/deployments/test-executables.html
+
+[^4]: https://optee.readthedocs.io/en/latest/building/gits/optee_test.html
\ No newline at end of file
Signature · 1 line
2.39.1.windows.1
#10 lore raw

PATCH 11/17 arm/trusted-services: disable psa-iat on qemuarm64-secureboot

In reply to Gyorgy Szing

TF-A v2.8 does not support measured boot and FF-A which is mandatory for PSA Initial Attestation SP to work correctly.

---
 ci/trusted-services.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
ci/trusted-services.yml +2 -2
index 433ec78b..5f28dd3c 100644
@@ -6,8 +6,8 @@ header:
 local_conf_header:
   trusted_services: |
     TEST_SUITES:append = " trusted_services"
-    # Include TS Crypto, Storage, ITS, Attestation and SMM-Gateway SPs into optee-os image
-    MACHINE_FEATURES:append = " arm-ffa ts-crypto ts-storage ts-its ts-attestation ts-smm-gateway"
+    # Include TS Crypto, TS Protected Storage, TS Internal Trusted Storage and SMM-Gateway SPs into optee-os image
+    MACHINE_FEATURES:append = " arm-ffa ts-crypto ts-storage ts-its ts-smm-gateway"
     # Include TS demo/test tools into image
     IMAGE_INSTALL:append = " packagegroup-ts-tests"
     # Include TS PSA Arch tests into image
Signature · 1 line
2.39.1.windows.1
#11 lore raw

PATCH 12/17 arm-bsp/trusted-services: remove merged patches for corstone1000

In reply to Gyorgy Szing

From: Rui Miguel Silva <[email protected]>

Patch related with the changes to support the in/out_vec modifications in TF-M v1.7 was merged in upstream trusted-services integration branch. So, drop this 3 out of tree patches not needed to be applied any more.

---
 ...v1.7-alignment-Align-PSA-Crypto-SIDs.patch | 407 -----------
 ...gnment-Align-crypto-iovec-definition.patch | 656 ------------------
 ...ignment-PSA-crypto-client-in-out_vec.patch | 118 ----
 .../trusted-services/ts-arm-platforms.inc     |   3 -
 4 files changed, 1184 deletions(-)
 delete mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0004-TF-Mv1.7-alignment-Align-PSA-Crypto-SIDs.patch
 delete mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0005-TF-Mv1.7-alignment-Align-crypto-iovec-definition.patch
 delete mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0006-TF-Mv1.7-alignment-PSA-crypto-client-in-out_vec.patch
meta-arm-bsp/recipes-security/trusted-services/corstone1000/0004-TF-Mv1.7-alignment-Align-PSA-Crypto-SIDs.patch deleted +0 -407
deleted file mode 100644
index 628d8682..00000000
@@ -1,407 +0,0 @@
-From c294197b17358b20c75757b9a06d628f43cd7884 Mon Sep 17 00:00:00 2001
-From: Mohamed Omar Asaker <[email protected]>
-Date: Thu, 9 Feb 2023 00:22:40 +0000
-Subject: [PATCH 4/6] TF-Mv1.7 alignment: Align PSA Crypto SIDs
-
-This patch is to change the PSA Crypto SIDs to match the values of the
-PSA Crypto SID definitions in TF-M v1.7 running on the secure enclave
-
-Signed-off-by: Mohamed Omar Asaker <[email protected]>
-Upstream-Status: Pending [Not submitted yet]
-Signed-off-by: Rui Miguel Silva <[email protected]>
----
- .../service/common/include/psa/crypto_sid.h   | 241 ++++++++++++++++++
- components/service/common/include/psa/sid.h   |  76 +-----
- .../caller/psa_ipc/crypto_caller_sign_hash.h  |   4 +-
- .../psa_ipc/crypto_caller_verify_hash.h       |   4 +-
- 4 files changed, 248 insertions(+), 77 deletions(-)
- create mode 100644 components/service/common/include/psa/crypto_sid.h
-
-diff --git a/components/service/common/include/psa/crypto_sid.h b/components/service/common/include/psa/crypto_sid.h
-new file mode 100644
-index 000000000000..5b05f46d7d72
---- /dev/null
-+++ b/components/service/common/include/psa/crypto_sid.h
-@@ -0,0 +1,241 @@
-+/*
-+ * Copyright (c) 2023, Arm Limited. All rights reserved.
-+ *
-+ * SPDX-License-Identifier: BSD-3-Clause
-+ *
-+ */
-+
-+#ifndef __PSA_CRYPTO_SID_H__
-+#define __PSA_CRYPTO_SID_H__
-+
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+#include <stdint.h>
-+
-+/**
-+ * \brief Type associated to the group of a function encoding. There can be
-+ *        nine groups (Random, Key management, Hash, MAC, Cipher, AEAD,
-+ *        Asym sign, Asym encrypt, Key derivation).
-+ */
-+enum tfm_crypto_group_id {
-+    TFM_CRYPTO_GROUP_ID_RANDOM = 0x0,
-+    TFM_CRYPTO_GROUP_ID_KEY_MANAGEMENT,
-+    TFM_CRYPTO_GROUP_ID_HASH,
-+    TFM_CRYPTO_GROUP_ID_MAC,
-+    TFM_CRYPTO_GROUP_ID_CIPHER,
-+    TFM_CRYPTO_GROUP_ID_AEAD,
-+    TFM_CRYPTO_GROUP_ID_ASYM_SIGN,
-+    TFM_CRYPTO_GROUP_ID_ASYM_ENCRYPT,
-+    TFM_CRYPTO_GROUP_ID_KEY_DERIVATION,
-+};
-+
-+/* X macro describing each of the available PSA Crypto APIs */
-+#define KEY_MANAGEMENT_FUNCS                       \
-+    X(TFM_CRYPTO_GET_KEY_ATTRIBUTES)               \
-+    X(TFM_CRYPTO_RESET_KEY_ATTRIBUTES)             \
-+    X(TFM_CRYPTO_OPEN_KEY)                         \
-+    X(TFM_CRYPTO_CLOSE_KEY)                        \
-+    X(TFM_CRYPTO_IMPORT_KEY)                       \
-+    X(TFM_CRYPTO_DESTROY_KEY)                      \
-+    X(TFM_CRYPTO_EXPORT_KEY)                       \
-+    X(TFM_CRYPTO_EXPORT_PUBLIC_KEY)                \
-+    X(TFM_CRYPTO_PURGE_KEY)                        \
-+    X(TFM_CRYPTO_COPY_KEY)                         \
-+    X(TFM_CRYPTO_GENERATE_KEY)
-+
-+#define HASH_FUNCS                                 \
-+    X(TFM_CRYPTO_HASH_COMPUTE)                     \
-+    X(TFM_CRYPTO_HASH_COMPARE)                     \
-+    X(TFM_CRYPTO_HASH_SETUP)                       \
-+    X(TFM_CRYPTO_HASH_UPDATE)                      \
-+    X(TFM_CRYPTO_HASH_CLONE)                       \
-+    X(TFM_CRYPTO_HASH_FINISH)                      \
-+    X(TFM_CRYPTO_HASH_VERIFY)                      \
-+    X(TFM_CRYPTO_HASH_ABORT)
-+
-+#define MAC_FUNCS                                  \
-+    X(TFM_CRYPTO_MAC_COMPUTE)                      \
-+    X(TFM_CRYPTO_MAC_VERIFY)                       \
-+    X(TFM_CRYPTO_MAC_SIGN_SETUP)                   \
-+    X(TFM_CRYPTO_MAC_VERIFY_SETUP)                 \
-+    X(TFM_CRYPTO_MAC_UPDATE)                       \
-+    X(TFM_CRYPTO_MAC_SIGN_FINISH)                  \
-+    X(TFM_CRYPTO_MAC_VERIFY_FINISH)                \
-+    X(TFM_CRYPTO_MAC_ABORT)
-+
-+#define CIPHER_FUNCS                               \
-+    X(TFM_CRYPTO_CIPHER_ENCRYPT)                   \
-+    X(TFM_CRYPTO_CIPHER_DECRYPT)                   \
-+    X(TFM_CRYPTO_CIPHER_ENCRYPT_SETUP)             \
-+    X(TFM_CRYPTO_CIPHER_DECRYPT_SETUP)             \
-+    X(TFM_CRYPTO_CIPHER_GENERATE_IV)               \
-+    X(TFM_CRYPTO_CIPHER_SET_IV)                    \
-+    X(TFM_CRYPTO_CIPHER_UPDATE)                    \
-+    X(TFM_CRYPTO_CIPHER_FINISH)                    \
-+    X(TFM_CRYPTO_CIPHER_ABORT)
-+
-+#define AEAD_FUNCS                                 \
-+    X(TFM_CRYPTO_AEAD_ENCRYPT)                     \
-+    X(TFM_CRYPTO_AEAD_DECRYPT)                     \
-+    X(TFM_CRYPTO_AEAD_ENCRYPT_SETUP)               \
-+    X(TFM_CRYPTO_AEAD_DECRYPT_SETUP)               \
-+    X(TFM_CRYPTO_AEAD_GENERATE_NONCE)              \
-+    X(TFM_CRYPTO_AEAD_SET_NONCE)                   \
-+    X(TFM_CRYPTO_AEAD_SET_LENGTHS)                 \
-+    X(TFM_CRYPTO_AEAD_UPDATE_AD)                   \
-+    X(TFM_CRYPTO_AEAD_UPDATE)                      \
-+    X(TFM_CRYPTO_AEAD_FINISH)                      \
-+    X(TFM_CRYPTO_AEAD_VERIFY)                      \
-+    X(TFM_CRYPTO_AEAD_ABORT)
-+
-+#define ASYMMETRIC_SIGN_FUNCS                      \
-+    X(TFM_CRYPTO_ASYMMETRIC_SIGN_MESSAGE)          \
-+    X(TFM_CRYPTO_ASYMMETRIC_VERIFY_MESSAGE)        \
-+    X(TFM_CRYPTO_ASYMMETRIC_SIGN_HASH)             \
-+    X(TFM_CRYPTO_ASYMMETRIC_VERIFY_HASH)
-+
-+#define AYSMMETRIC_ENCRYPT_FUNCS                   \
-+    X(TFM_CRYPTO_ASYMMETRIC_ENCRYPT)               \
-+    X(TFM_CRYPTO_ASYMMETRIC_DECRYPT)
-+
-+#define KEY_DERIVATION_FUNCS                       \
-+    X(TFM_CRYPTO_RAW_KEY_AGREEMENT)                \
-+    X(TFM_CRYPTO_KEY_DERIVATION_SETUP)             \
-+    X(TFM_CRYPTO_KEY_DERIVATION_GET_CAPACITY)      \
-+    X(TFM_CRYPTO_KEY_DERIVATION_SET_CAPACITY)      \
-+    X(TFM_CRYPTO_KEY_DERIVATION_INPUT_BYTES)       \
-+    X(TFM_CRYPTO_KEY_DERIVATION_INPUT_KEY)         \
-+    X(TFM_CRYPTO_KEY_DERIVATION_KEY_AGREEMENT)     \
-+    X(TFM_CRYPTO_KEY_DERIVATION_OUTPUT_BYTES)      \
-+    X(TFM_CRYPTO_KEY_DERIVATION_OUTPUT_KEY)        \
-+    X(TFM_CRYPTO_KEY_DERIVATION_ABORT)
-+
-+#define RANDOM_FUNCS                               \
-+    X(TFM_CRYPTO_GENERATE_RANDOM)
-+
-+/*
-+ * Define function IDs in each group. The function ID will be encoded into
-+ * tfm_crypto_func_sid below.
-+ * Each group is defined as a dedicated enum in case the total number of
-+ * PSA Crypto APIs exceeds 256.
-+ */
-+#define X(func_id)    func_id,
-+enum tfm_crypto_key_management_func_id {
-+    KEY_MANAGEMENT_FUNCS
-+};
-+enum tfm_crypto_hash_func_id {
-+    HASH_FUNCS
-+};
-+enum tfm_crypto_mac_func_id {
-+    MAC_FUNCS
-+};
-+enum tfm_crypto_cipher_func_id {
-+    CIPHER_FUNCS
-+};
-+enum tfm_crypto_aead_func_id {
-+    AEAD_FUNCS
-+};
-+enum tfm_crypto_asym_sign_func_id {
-+    ASYMMETRIC_SIGN_FUNCS
-+};
-+enum tfm_crypto_asym_encrypt_func_id {
-+    AYSMMETRIC_ENCRYPT_FUNCS
-+};
-+enum tfm_crypto_key_derivation_func_id {
-+    KEY_DERIVATION_FUNCS
-+};
-+enum tfm_crypto_random_func_id {
-+    RANDOM_FUNCS
-+};
-+#undef X
-+
-+#define FUNC_ID(func_id)    (((func_id) & 0xFF) << 8)
-+
-+/*
-+ * Numerical progressive value identifying a function API exposed through
-+ * the interfaces (S or NS). It's used to dispatch the requests from S/NS
-+ * to the corresponding API implementation in the Crypto service backend.
-+ *
-+ * Each function SID is encoded as uint16_t.
-+ *     |  Func ID  |  Group ID |
-+ *     15         8 7          0
-+ * Func ID is defined in each group func_id enum above
-+ * Group ID is defined in tfm_crypto_group_id.
-+ */
-+enum tfm_crypto_func_sid {
-+
-+#define X(func_id)      func_id ## _SID = (uint16_t)((FUNC_ID(func_id)) | \
-+                                   (TFM_CRYPTO_GROUP_ID_KEY_MANAGEMENT & 0xFF)),
-+
-+    KEY_MANAGEMENT_FUNCS
-+
-+#undef X
-+#define X(func_id)      func_id ## _SID = (uint16_t)((FUNC_ID(func_id)) | \
-+                                            (TFM_CRYPTO_GROUP_ID_HASH & 0xFF)),
-+    HASH_FUNCS
-+
-+#undef X
-+#define X(func_id)      func_id ## _SID = (uint16_t)((FUNC_ID(func_id)) | \
-+                                            (TFM_CRYPTO_GROUP_ID_MAC & 0xFF)),
-+    MAC_FUNCS
-+
-+#undef X
-+#define X(func_id)      func_id ## _SID = (uint16_t)((FUNC_ID(func_id)) | \
-+                                           (TFM_CRYPTO_GROUP_ID_CIPHER & 0xFF)),
-+    CIPHER_FUNCS
-+
-+#undef X
-+#define X(func_id)      func_id ## _SID = (uint16_t)((FUNC_ID(func_id)) | \
-+                                             (TFM_CRYPTO_GROUP_ID_AEAD & 0xFF)),
-+    AEAD_FUNCS
-+
-+#undef X
-+#define X(func_id)      func_id ## _SID = (uint16_t)((FUNC_ID(func_id)) | \
-+                                        (TFM_CRYPTO_GROUP_ID_ASYM_SIGN & 0xFF)),
-+    ASYMMETRIC_SIGN_FUNCS
-+
-+#undef X
-+#define X(func_id)      func_id ## _SID = (uint16_t)((FUNC_ID(func_id)) | \
-+                                     (TFM_CRYPTO_GROUP_ID_ASYM_ENCRYPT & 0xFF)),
-+    AYSMMETRIC_ENCRYPT_FUNCS
-+
-+#undef X
-+#define X(func_id)      func_id ## _SID = (uint16_t)((FUNC_ID(func_id)) | \
-+                                   (TFM_CRYPTO_GROUP_ID_KEY_DERIVATION & 0xFF)),
-+    KEY_DERIVATION_FUNCS
-+
-+#undef X
-+#define X(func_id)      func_id ## _SID = (uint16_t)((FUNC_ID(func_id)) | \
-+                                           (TFM_CRYPTO_GROUP_ID_RANDOM & 0xFF)),
-+    RANDOM_FUNCS
-+
-+};
-+#undef X
-+
-+/**
-+ * \brief Define an invalid value for an SID
-+ *
-+ */
-+#define TFM_CRYPTO_SID_INVALID (~0x0u)
-+
-+/**
-+ * \brief This value is used to mark an handle as invalid.
-+ *
-+ */
-+#define TFM_CRYPTO_INVALID_HANDLE (0x0u)
-+
-+/**
-+ * \brief Define miscellaneous literal constants that are used in the service
-+ *
-+ */
-+enum {
-+    TFM_CRYPTO_NOT_IN_USE = 0,
-+    TFM_CRYPTO_IN_USE = 1
-+};
-+
-+#ifdef __cplusplus
-+}
-+#endif
-+
-+#endif /* __PSA_CRYPTO_SID_H__ */
-diff --git a/components/service/common/include/psa/sid.h b/components/service/common/include/psa/sid.h
-index 8e2c6bdf2919..5aaa659d49a0 100644
---- a/components/service/common/include/psa/sid.h
-+++ b/components/service/common/include/psa/sid.h
-@@ -12,6 +12,9 @@
- extern "C" {
- #endif
- 
-+/******** PSA Crypto SIDs ********/
-+#include "crypto_sid.h"
-+
- /******** TFM_SP_PS ********/
- #define TFM_PROTECTED_STORAGE_SERVICE_SID                          (0x00000060U)
- #define TFM_PROTECTED_STORAGE_SERVICE_VERSION                      (1U)
-@@ -37,79 +40,6 @@ extern "C" {
- #define TFM_CRYPTO_VERSION                                         (1U)
- #define TFM_CRYPTO_HANDLE                                          (0x40000100U)
- 
--/**
-- * \brief Define a progressive numerical value for each SID which can be used
-- *        when dispatching the requests to the service
-- */
--enum {
--    TFM_CRYPTO_GET_KEY_ATTRIBUTES_SID = (0u),
--    TFM_CRYPTO_RESET_KEY_ATTRIBUTES_SID,
--    TFM_CRYPTO_OPEN_KEY_SID,
--    TFM_CRYPTO_CLOSE_KEY_SID,
--    TFM_CRYPTO_IMPORT_KEY_SID,
--    TFM_CRYPTO_DESTROY_KEY_SID,
--    TFM_CRYPTO_EXPORT_KEY_SID,
--    TFM_CRYPTO_EXPORT_PUBLIC_KEY_SID,
--    TFM_CRYPTO_PURGE_KEY_SID,
--    TFM_CRYPTO_COPY_KEY_SID,
--    TFM_CRYPTO_HASH_COMPUTE_SID,
--    TFM_CRYPTO_HASH_COMPARE_SID,
--    TFM_CRYPTO_HASH_SETUP_SID,
--    TFM_CRYPTO_HASH_UPDATE_SID,
--    TFM_CRYPTO_HASH_FINISH_SID,
--    TFM_CRYPTO_HASH_VERIFY_SID,
--    TFM_CRYPTO_HASH_ABORT_SID,
--    TFM_CRYPTO_HASH_CLONE_SID,
--    TFM_CRYPTO_MAC_COMPUTE_SID,
--    TFM_CRYPTO_MAC_VERIFY_SID,
--    TFM_CRYPTO_MAC_SIGN_SETUP_SID,
--    TFM_CRYPTO_MAC_VERIFY_SETUP_SID,
--    TFM_CRYPTO_MAC_UPDATE_SID,
--    TFM_CRYPTO_MAC_SIGN_FINISH_SID,
--    TFM_CRYPTO_MAC_VERIFY_FINISH_SID,
--    TFM_CRYPTO_MAC_ABORT_SID,
--    TFM_CRYPTO_CIPHER_ENCRYPT_SID,
--    TFM_CRYPTO_CIPHER_DECRYPT_SID,
--    TFM_CRYPTO_CIPHER_ENCRYPT_SETUP_SID,
--    TFM_CRYPTO_CIPHER_DECRYPT_SETUP_SID,
--    TFM_CRYPTO_CIPHER_GENERATE_IV_SID,
--    TFM_CRYPTO_CIPHER_SET_IV_SID,
--    TFM_CRYPTO_CIPHER_UPDATE_SID,
--    TFM_CRYPTO_CIPHER_FINISH_SID,
--    TFM_CRYPTO_CIPHER_ABORT_SID,
--    TFM_CRYPTO_AEAD_ENCRYPT_SID,
--    TFM_CRYPTO_AEAD_DECRYPT_SID,
--    TFM_CRYPTO_AEAD_ENCRYPT_SETUP_SID,
--    TFM_CRYPTO_AEAD_DECRYPT_SETUP_SID,
--    TFM_CRYPTO_AEAD_GENERATE_NONCE_SID,
--    TFM_CRYPTO_AEAD_SET_NONCE_SID,
--    TFM_CRYPTO_AEAD_SET_LENGTHS_SID,
--    TFM_CRYPTO_AEAD_UPDATE_AD_SID,
--    TFM_CRYPTO_AEAD_UPDATE_SID,
--    TFM_CRYPTO_AEAD_FINISH_SID,
--    TFM_CRYPTO_AEAD_VERIFY_SID,
--    TFM_CRYPTO_AEAD_ABORT_SID,
--    TFM_CRYPTO_SIGN_MESSAGE_SID,
--    TFM_CRYPTO_VERIFY_MESSAGE_SID,
--    TFM_CRYPTO_SIGN_HASH_SID,
--    TFM_CRYPTO_VERIFY_HASH_SID,
--    TFM_CRYPTO_ASYMMETRIC_ENCRYPT_SID,
--    TFM_CRYPTO_ASYMMETRIC_DECRYPT_SID,
--    TFM_CRYPTO_KEY_DERIVATION_SETUP_SID,
--    TFM_CRYPTO_KEY_DERIVATION_GET_CAPACITY_SID,
--    TFM_CRYPTO_KEY_DERIVATION_SET_CAPACITY_SID,
--    TFM_CRYPTO_KEY_DERIVATION_INPUT_BYTES_SID,
--    TFM_CRYPTO_KEY_DERIVATION_INPUT_KEY_SID,
--    TFM_CRYPTO_KEY_DERIVATION_KEY_AGREEMENT_SID,
--    TFM_CRYPTO_KEY_DERIVATION_OUTPUT_BYTES_SID,
--    TFM_CRYPTO_KEY_DERIVATION_OUTPUT_KEY_SID,
--    TFM_CRYPTO_KEY_DERIVATION_ABORT_SID,
--    TFM_CRYPTO_RAW_KEY_AGREEMENT_SID,
--    TFM_CRYPTO_GENERATE_RANDOM_SID,
--    TFM_CRYPTO_GENERATE_KEY_SID,
--    TFM_CRYPTO_SID_MAX,
--};
--
- /******** TFM_SP_PLATFORM ********/
- #define TFM_SP_PLATFORM_SYSTEM_RESET_SID                           (0x00000040U)
- #define TFM_SP_PLATFORM_SYSTEM_RESET_VERSION                       (1U)
-diff --git a/components/service/crypto/client/caller/psa_ipc/crypto_caller_sign_hash.h b/components/service/crypto/client/caller/psa_ipc/crypto_caller_sign_hash.h
-index 29bd56e60708..bebfe05c7c49 100644
---- a/components/service/crypto/client/caller/psa_ipc/crypto_caller_sign_hash.h
-+++ b/components/service/crypto/client/caller/psa_ipc/crypto_caller_sign_hash.h
-@@ -37,7 +37,7 @@ static inline psa_status_t crypto_caller_sign_hash(struct service_client *contex
- 	struct rpc_caller *caller = ipc->caller;
- 	psa_status_t status;
- 	struct psa_ipc_crypto_pack_iovec iov = {
--		.sfn_id = TFM_CRYPTO_SIGN_HASH_SID,
-+		.sfn_id = TFM_CRYPTO_ASYMMETRIC_SIGN_HASH_SID,
- 		.key_id = id,
- 		.alg = alg,
- 	};
-@@ -70,7 +70,7 @@ static inline psa_status_t crypto_caller_sign_message(struct service_client *con
- 	struct rpc_caller *caller = ipc->caller;
- 	psa_status_t status;
- 	struct psa_ipc_crypto_pack_iovec iov = {
--		.sfn_id = TFM_CRYPTO_SIGN_MESSAGE_SID,
-+		.sfn_id = TFM_CRYPTO_ASYMMETRIC_SIGN_MESSAGE_SID,
- 		.key_id = id,
- 		.alg = alg,
- 	};
-diff --git a/components/service/crypto/client/caller/psa_ipc/crypto_caller_verify_hash.h b/components/service/crypto/client/caller/psa_ipc/crypto_caller_verify_hash.h
-index 66281d588626..d0a3850678cb 100644
---- a/components/service/crypto/client/caller/psa_ipc/crypto_caller_verify_hash.h
-+++ b/components/service/crypto/client/caller/psa_ipc/crypto_caller_verify_hash.h
-@@ -63,7 +63,7 @@ static inline psa_status_t crypto_caller_verify_hash(struct service_client *cont
- {
- 
- 	return crypto_caller_common(context,id,alg,hash,hash_length,
--			signature,signature_length, TFM_CRYPTO_VERIFY_HASH_SID);
-+			signature,signature_length, TFM_CRYPTO_ASYMMETRIC_VERIFY_HASH_SID);
- }
- 
- static inline psa_status_t crypto_caller_verify_message(struct service_client *context,
-@@ -76,7 +76,7 @@ static inline psa_status_t crypto_caller_verify_message(struct service_client *c
- {
- 
- 	return crypto_caller_common(context,id,alg,hash,hash_length,
--			signature,signature_length, TFM_CRYPTO_VERIFY_MESSAGE_SID);
-+			signature,signature_length, TFM_CRYPTO_ASYMMETRIC_VERIFY_MESSAGE_SID);
- }
- 
- #ifdef __cplusplus
--- 
-2.40.0
-
meta-arm-bsp/recipes-security/trusted-services/corstone1000/0005-TF-Mv1.7-alignment-Align-crypto-iovec-definition.patch deleted +0 -656

656 lines not on this page · raw message

meta-arm-bsp/recipes-security/trusted-services/corstone1000/0006-TF-Mv1.7-alignment-PSA-crypto-client-in-out_vec.patch deleted +0 -118

118 lines not on this page · raw message

meta-arm-bsp/recipes-security/trusted-services/ts-arm-platforms.inc +0 -3
index 17c957e2..e601539a 100644
@@ -5,9 +5,6 @@ SRC_URI:append:corstone1000  = " \
     file://0001-Add-stub-capsule-update-service-components.patch;patchdir=../trusted-services \
     file://0002-Fixes-in-AEAD-for-psa-arch-test-54-and-58.patch;patchdir=../trusted-services \
     file://0003-FMP-Support-in-Corstone1000.patch;patchdir=../trusted-services \
-    file://0004-TF-Mv1.7-alignment-Align-PSA-Crypto-SIDs.patch;patchdir=../trusted-services \
-    file://0005-TF-Mv1.7-alignment-Align-crypto-iovec-definition.patch;patchdir=../trusted-services \
-    file://0006-TF-Mv1.7-alignment-PSA-crypto-client-in-out_vec.patch;patchdir=../trusted-services \
     "
 
 
Signature · 1 line
2.39.1.windows.1
#12 lore raw

PATCH 13/17 arm/trusted-services: fix nanopb build error

In reply to Gyorgy Szing

The nanopb build step randomly fails in the yocto CI due to a race condition. This change adds a patch file to disable parallel build for nanopb. This is a temporary workaround and a proper fix will be up-streamed int he future.

---
 ...Limit-nanopb-build-to-single-process.patch | 41 +++++++++++++++++++
 .../trusted-services/trusted-services-src.inc |  6 +++
 2 files changed, 47 insertions(+)
 create mode 100644 meta-arm/recipes-security/trusted-services/files/0001-Limit-nanopb-build-to-single-process.patch
meta-arm/recipes-security/trusted-services/files/0001-Limit-nanopb-build-to-single-process.patch new file +41 -0
new file mode 100644
index 00000000..28e041bc
@@ -0,0 +1,41 @@
+From aca9f9ae26235e9da2bc9adef49f9f5578f3e1e7 Mon Sep 17 00:00:00 2001
+From: Gyorgy Szing <[email protected]>
+Date: Tue, 25 Apr 2023 15:03:46 +0000
+Subject: [PATCH 1/1] Limit nanopb build to single process
+
+Sometimes in yocto the nanopb build step fails. The reason seems
+to be a race condition. This fix disables parallel build as
+a workaround.
+
+Upstream-Status: Inappropriate [yocto specific]
+
+Signed-off-by: Gyorgy Szing <[email protected]>
+---
+ external/nanopb/nanopb.cmake | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/external/nanopb/nanopb.cmake b/external/nanopb/nanopb.cmake
+index 36465f61..94f8048c 100644
+--- a/external/nanopb/nanopb.cmake
++++ b/external/nanopb/nanopb.cmake
+@@ -65,6 +65,8 @@ if(TARGET stdlib::c)
+ 	unset_saved_properties(LIBC)
+ endif()
+ 
++set(_PROCESSOR_COUNT ${PROCESSOR_COUNT})
++set(PROCESSOR_COUNT 1)
+ include(${TS_ROOT}/tools/cmake/common/LazyFetch.cmake REQUIRED)
+ LazyFetch_MakeAvailable(DEP_NAME nanopb
+ 	FETCH_OPTIONS ${GIT_OPTIONS}
+@@ -73,6 +75,8 @@ LazyFetch_MakeAvailable(DEP_NAME nanopb
+ 	CACHE_FILE "${TS_ROOT}/external/nanopb/nanopb-init-cache.cmake.in"
+ 	SOURCE_DIR "${NANOPB_SOURCE_DIR}"
+   )
++set(PROCESSOR_COUNT ${_PROCESSOR_COUNT})
++
+ unset(_cmake_fragment)
+ 
+ if(TARGET stdlib::c)
+-- 
+2.34.1
+
meta-arm/recipes-security/trusted-services/trusted-services-src.inc +6 -0
index c3ab7867..34827e5d 100644
@@ -5,6 +5,12 @@ LICENSE = "Apache-2.0 & BSD-3-Clause & BSD-2-Clause & Zlib"
 SRC_URI = "git://git.trustedfirmware.org/TS/trusted-services.git;protocol=https;branch=integration;name=trusted-services;destsuffix=git/trusted-services \
 "
 
+FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
+
+SRC_URI:append = "\
+	file://0001-Limit-nanopb-build-to-single-process.patch \
+"
+
 #Latest on 2023 April 25
 SRCREV="0d292e7c879076ea36cc39e30e0ac930b71e8cd8"
 LIC_FILES_CHKSUM = "file://${S}/license.rst;md5=ea160bac7f690a069c608516b17997f4"
Signature · 1 line
2.39.1.windows.1
#13 lore raw

PATCH 14/17 optee-os: unblock NWd interrupts

In reply to Gyorgy Szing

Update Trusted Services and backport an OP-TEE update which allows interrupting the SPs by NWd interrupts. This solves the kernel stall problems which are due to long cryptographic operations being executed in the SWd.

---
 ...re-spmc-handle-non-secure-interrupts.patch | 279 ++++++++++++++++++
 ...ure-SP-s-NS-interrupt-action-based-o.patch | 150 ++++++++++
 .../recipes-security/optee/optee-os_3.20.0.bb |   2 +
 .../trusted-services/trusted-services-src.inc |   4 +-
 4 files changed, 433 insertions(+), 2 deletions(-)
 create mode 100644 meta-arm/recipes-security/optee/optee-os-3.20.0/0007-core-spmc-handle-non-secure-interrupts.patch
 create mode 100644 meta-arm/recipes-security/optee/optee-os-3.20.0/0008-core-spmc-configure-SP-s-NS-interrupt-action-based-o.patch
meta-arm/recipes-security/optee/optee-os-3.20.0/0007-core-spmc-handle-non-secure-interrupts.patch new file +279 -0
new file mode 100644
index 00000000..a0377aba
@@ -0,0 +1,279 @@
+From f4b4f5bccc1be9a709008cc8e6107302745796c8 Mon Sep 17 00:00:00 2001
+From: Imre Kis <[email protected]>
+Date: Tue, 18 Apr 2023 16:41:51 +0200
+Subject: [PATCH] core: spmc: handle non-secure interrupts
+
+Add FFA_INTERRUPT and FFA_RUN support for signaling non-secure
+interrupts and for resuming to the secure world. If a secure partition
+is preempted by a non-secure interrupt OP-TEE saves the SP's state and
+sends an FFA_INTERRUPT to the normal world. After handling the interrupt
+the normal world should send an FFA_RUN to OP-TEE so it can continue
+running the SP.
+If OP-TEE is the active FF-A endpoint (i.e. it is running TAs) the
+non-secure interrupts are signaled by the existing
+OPTEE_FFA_YIELDING_CALL_RETURN_INTERRUPT message instead of
+FFA_INTERRUPT.
+
+Upstream-Status: Pending
+
+Signed-off-by: Imre Kis <[email protected]>
+Change-Id: I577ebe86d416ee494963216a66a3bfc8206921b4
+
+---
+ core/arch/arm/include/ffa.h                   |  2 +-
+ .../arch/arm/include/kernel/spmc_sp_handler.h | 11 +++++++
+ core/arch/arm/kernel/secure_partition.c       | 17 ++++++++++
+ core/arch/arm/kernel/spmc_sp_handler.c        | 26 ++++++++++++++++
+ core/arch/arm/kernel/thread.c                 |  7 +++++
+ core/arch/arm/kernel/thread_spmc.c            | 31 ++++++++++++++++++-
+ core/arch/arm/kernel/thread_spmc_a64.S        | 30 ++++++++++++++++++
+ 7 files changed, 122 insertions(+), 2 deletions(-)
+
+diff --git a/core/arch/arm/include/ffa.h b/core/arch/arm/include/ffa.h
+index 5a19fb0c..b3d1d354 100644
+--- a/core/arch/arm/include/ffa.h
++++ b/core/arch/arm/include/ffa.h
+@@ -50,7 +50,7 @@
+ #define FFA_ID_GET			U(0x84000069)
+ #define FFA_MSG_WAIT			U(0x8400006B)
+ #define FFA_MSG_YIELD			U(0x8400006C)
+-#define FFA_MSG_RUN			U(0x8400006D)
++#define FFA_RUN				U(0x8400006D)
+ #define FFA_MSG_SEND			U(0x8400006E)
+ #define FFA_MSG_SEND_DIRECT_REQ_32	U(0x8400006F)
+ #define FFA_MSG_SEND_DIRECT_REQ_64	U(0xC400006F)
+diff --git a/core/arch/arm/include/kernel/spmc_sp_handler.h b/core/arch/arm/include/kernel/spmc_sp_handler.h
+index f5bda7bf..30c1e469 100644
+--- a/core/arch/arm/include/kernel/spmc_sp_handler.h
++++ b/core/arch/arm/include/kernel/spmc_sp_handler.h
+@@ -25,6 +25,8 @@ void spmc_sp_start_thread(struct thread_smc_args *args);
+ int spmc_sp_add_share(struct ffa_rxtx *rxtx,
+ 		      size_t blen, uint64_t *global_handle,
+ 		      struct sp_session *owner_sp);
++void spmc_sp_set_to_preempted(struct ts_session *ts_sess);
++int spmc_sp_resume_from_preempted(uint16_t endpoint_id);
+ #else
+ static inline void spmc_sp_start_thread(struct thread_smc_args *args __unused)
+ {
+@@ -37,6 +39,15 @@ static inline int spmc_sp_add_share(struct ffa_rxtx *rxtx __unused,
+ {
+ 	return FFA_NOT_SUPPORTED;
+ }
++
++static inline void spmc_sp_set_to_preempted(struct ts_session *ts_sess __unused)
++{
++}
++
++static inline int spmc_sp_resume_from_preempted(uint16_t endpoint_id __unused)
++{
++	return FFA_NOT_SUPPORTED;
++}
+ #endif
+ 
+ #endif /* __KERNEL_SPMC_SP_HANDLER_H */
+diff --git a/core/arch/arm/kernel/secure_partition.c b/core/arch/arm/kernel/secure_partition.c
+index 1d36e90b..6e351e43 100644
+--- a/core/arch/arm/kernel/secure_partition.c
++++ b/core/arch/arm/kernel/secure_partition.c
+@@ -999,6 +999,8 @@ static TEE_Result sp_enter_invoke_cmd(struct ts_session *s,
+ 	struct sp_session *sp_s = to_sp_session(s);
+ 	struct ts_session *sess = NULL;
+ 	struct thread_ctx_regs *sp_regs = NULL;
++	uint32_t thread_id = THREAD_ID_INVALID;
++	uint32_t rpc_target_info = 0;
+ 	uint32_t panicked = false;
+ 	uint32_t panic_code = 0;
+ 
+@@ -1011,8 +1013,23 @@ static TEE_Result sp_enter_invoke_cmd(struct ts_session *s,
+ 	sp_regs->cpsr = read_daif() & (SPSR_64_DAIF_MASK << SPSR_64_DAIF_SHIFT);
+ 
+ 	exceptions = thread_mask_exceptions(THREAD_EXCP_ALL);
++
++	/*
++	 * Store endpoint ID and thread ID in rpc_target_info. This will be used
++	 * as w1 in FFA_INTERRUPT in case of a NWd interrupt.
++	 */
++	rpc_target_info = thread_get_tsd()->rpc_target_info;
++	thread_id = thread_get_id();
++	assert((thread_id & ~0xffff) == 0);
++	thread_get_tsd()->rpc_target_info = (sp_s->endpoint_id << 16) |
++					    (thread_id & 0xffff);
++
+ 	__thread_enter_user_mode(sp_regs, &panicked, &panic_code);
++
+ 	sp_regs->cpsr = cpsr;
++	/* Restore rpc_target_info */
++	thread_get_tsd()->rpc_target_info = rpc_target_info;
++
+ 	thread_unmask_exceptions(exceptions);
+ 
+ 	thread_user_clear_vfp(&ctx->uctx);
+diff --git a/core/arch/arm/kernel/spmc_sp_handler.c b/core/arch/arm/kernel/spmc_sp_handler.c
+index 5d3326fc..f4c7ff81 100644
+--- a/core/arch/arm/kernel/spmc_sp_handler.c
++++ b/core/arch/arm/kernel/spmc_sp_handler.c
+@@ -366,6 +366,32 @@ cleanup:
+ 	return res;
+ }
+ 
++void spmc_sp_set_to_preempted(struct ts_session *ts_sess)
++{
++	if (ts_sess && is_sp_ctx(ts_sess->ctx)) {
++		struct sp_session *sp_sess = to_sp_session(ts_sess);
++
++		assert(sp_sess->state == sp_busy);
++
++		sp_sess->state = sp_preempted;
++	}
++}
++
++int spmc_sp_resume_from_preempted(uint16_t endpoint_id)
++{
++	struct sp_session *sp_sess = sp_get_session(endpoint_id);
++
++	if (!sp_sess)
++		return FFA_INVALID_PARAMETERS;
++
++	if (sp_sess->state != sp_preempted)
++		return FFA_DENIED;
++
++	sp_sess->state = sp_busy;
++
++	return FFA_OK;
++}
++
+ static bool check_rxtx(struct ffa_rxtx *rxtx)
+ {
+ 	return rxtx && rxtx->rx && rxtx->tx && rxtx->size > 0;
+diff --git a/core/arch/arm/kernel/thread.c b/core/arch/arm/kernel/thread.c
+index 1e7f9f96..8cd4dc96 100644
+--- a/core/arch/arm/kernel/thread.c
++++ b/core/arch/arm/kernel/thread.c
+@@ -531,6 +531,13 @@ int thread_state_suspend(uint32_t flags, uint32_t cpsr, vaddr_t pc)
+ 		core_mmu_set_user_map(NULL);
+ 	}
+ 
++	if (IS_ENABLED(CFG_SECURE_PARTITION)) {
++		struct ts_session *ts_sess =
++			TAILQ_FIRST(&threads[ct].tsd.sess_stack);
++
++		spmc_sp_set_to_preempted(ts_sess);
++	}
++
+ 	l->curr_thread = THREAD_ID_INVALID;
+ 
+ 	if (IS_ENABLED(CFG_VIRTUALIZATION))
+diff --git a/core/arch/arm/kernel/thread_spmc.c b/core/arch/arm/kernel/thread_spmc.c
+index 3b4ac0b4..bc4e7687 100644
+--- a/core/arch/arm/kernel/thread_spmc.c
++++ b/core/arch/arm/kernel/thread_spmc.c
+@@ -45,7 +45,7 @@ struct mem_frag_state {
+ #endif
+ 
+ /* Initialized in spmc_init() below */
+-static uint16_t my_endpoint_id;
++uint16_t my_endpoint_id;
+ 
+ /*
+  * If struct ffa_rxtx::size is 0 RX/TX buffers are not mapped or initialized.
+@@ -437,6 +437,32 @@ out:
+ 		      FFA_PARAM_MBZ, FFA_PARAM_MBZ);
+ 	cpu_spin_unlock(&rxtx->spinlock);
+ }
++
++static void spmc_handle_run(struct thread_smc_args *args)
++{
++	uint16_t endpoint = (args->a1 >> 16) & 0xffff;
++	uint16_t thread_id = (args->a1 & 0xffff);
++	uint32_t rc = 0;
++
++	if (endpoint != my_endpoint_id) {
++		/*
++		 * The endpoint should be an SP, try to resume the SP from
++		 * preempted into busy state.
++		 */
++		rc = spmc_sp_resume_from_preempted(endpoint);
++		if (rc)
++			goto out;
++	}
++
++	thread_resume_from_rpc(thread_id, 0, 0, 0, 0);
++
++	/* thread_resume_from_rpc return only of the thread_id is invalid */
++	rc = FFA_INVALID_PARAMETERS;
++
++out:
++	spmc_set_args(args, FFA_ERROR, FFA_PARAM_MBZ, rc, FFA_PARAM_MBZ,
++		      FFA_PARAM_MBZ, FFA_PARAM_MBZ);
++}
+ #endif /*CFG_CORE_SEL1_SPMC*/
+ 
+ static void handle_yielding_call(struct thread_smc_args *args)
+@@ -970,6 +996,9 @@ void thread_spmc_msg_recv(struct thread_smc_args *args)
+ 	case FFA_PARTITION_INFO_GET:
+ 		spmc_handle_partition_info_get(args, &nw_rxtx);
+ 		break;
++	case FFA_RUN:
++		spmc_handle_run(args);
++		break;
+ #endif /*CFG_CORE_SEL1_SPMC*/
+ 	case FFA_INTERRUPT:
+ 		itr_core_handler();
+diff --git a/core/arch/arm/kernel/thread_spmc_a64.S b/core/arch/arm/kernel/thread_spmc_a64.S
+index 21cb6251..7297005a 100644
+--- a/core/arch/arm/kernel/thread_spmc_a64.S
++++ b/core/arch/arm/kernel/thread_spmc_a64.S
+@@ -14,6 +14,20 @@
+ #include <kernel/thread.h>
+ #include <optee_ffa.h>
+ 
++#if CFG_SECURE_PARTITION
++LOCAL_FUNC thread_ffa_interrupt , :
++	mov_imm	x0, FFA_INTERRUPT		/* FID */
++	/* X1: Endpoint/vCPU IDs is set by caller */
++	mov	x2, #FFA_PARAM_MBZ		/* Param MBZ */
++	mov	x3, #FFA_PARAM_MBZ		/* Param MBZ */
++	mov	x4, #FFA_PARAM_MBZ		/* Param MBZ */
++	mov	x5, #FFA_PARAM_MBZ		/* Param MBZ */
++	mov	x6, #FFA_PARAM_MBZ		/* Param MBZ */
++	mov	x7, #FFA_PARAM_MBZ		/* Param MBZ */
++	b	.ffa_msg_loop
++END_FUNC thread_ffa_msg_wait
++#endif /* CFG_SECURE_PARTITION */
++
+ FUNC thread_ffa_msg_wait , :
+ 	mov_imm	x0, FFA_MSG_WAIT		/* FID */
+ 	mov	x1, #FFA_TARGET_INFO_MBZ	/* Target info MBZ */
+@@ -171,6 +185,14 @@ END_FUNC thread_rpc
+  * The current thread as indicated by @thread_index has just been
+  * suspended.  The job here is just to inform normal world the thread id to
+  * resume when returning.
++ * If the active FF-A endpoint is OP-TEE (or a TA) then an this function send an
++ * OPTEE_FFA_YIELDING_CALL_RETURN_INTERRUPT message to the normal world via the
++ * FFA_MSG_SEND_DIRECT_RESP interface. This is handled by the OP-TEE
++ * driver in Linux so it can schedule task to the thread.
++ * If the active endpoint is an SP the function sends an FFA_INTERRUPT. This is
++ * handled by the FF-A driver and after taking care of the NWd interrupts it
++ * returns via an FFA_RUN call.
++ * The active endpoint is determined by the upper 16 bits of rpc_target_info.
+  */
+ FUNC thread_foreign_intr_exit , :
+ 	/* load threads[w0].tsd.rpc_target_info into w1 */
+@@ -178,6 +200,14 @@ FUNC thread_foreign_intr_exit , :
+ 	adr_l	x2, threads
+ 	madd	x1, x1, x0, x2
+ 	ldr	w1, [x1, #THREAD_CTX_TSD_RPC_TARGET_INFO]
++#if CFG_SECURE_PARTITION
++	adr_l	x2, my_endpoint_id
++	ldrh	w2, [x2]
++	lsr	w3, w1, #16
++	cmp	w2, w3
++	/* (threads[w0].tsd.rpc_target_info >> 16) != my_endpoint_id */
++	bne	thread_ffa_interrupt
++#endif /* CFG_SECURE_PARTITION */
+ 	mov	x2, #FFA_PARAM_MBZ
+ 	mov	w3, #FFA_PARAM_MBZ
+ 	mov	w4, #OPTEE_FFA_YIELDING_CALL_RETURN_INTERRUPT
+
+-- 
+2.17.1
meta-arm/recipes-security/optee/optee-os-3.20.0/0008-core-spmc-configure-SP-s-NS-interrupt-action-based-o.patch new file +150 -0

150 lines not on this page · raw message

meta-arm/recipes-security/optee/optee-os_3.20.0.bb +2 -0
index 661a807d..2d4d6d6d 100644
@@ -9,5 +9,7 @@ SRC_URI:append = " \
     file://0004-core-Define-section-attributes-for-clang.patch \
     file://0005-core-arm-S-EL1-SPMC-boot-ABI-update.patch \
     file://0006-core-ffa-add-TOS_FW_CONFIG-handling.patch \
+    file://0007-core-spmc-handle-non-secure-interrupts.patch \
+    file://0008-core-spmc-configure-SP-s-NS-interrupt-action-based-o.patch \
    "
 EXTRA_OEMAKE += " CFG_MAP_EXT_DT_SECURE=y"
meta-arm/recipes-security/trusted-services/trusted-services-src.inc +2 -2
index 34827e5d..2bb4a8a1 100644
@@ -11,8 +11,8 @@ SRC_URI:append = "\
 	file://0001-Limit-nanopb-build-to-single-process.patch \
 "
 
-#Latest on 2023 April 25
-SRCREV="0d292e7c879076ea36cc39e30e0ac930b71e8cd8"
+#Latest on 2023 April 28
+SRCREV="08b3d39471f4914186bd23793dc920e83b0e3197"
 LIC_FILES_CHKSUM = "file://${S}/license.rst;md5=ea160bac7f690a069c608516b17997f4"
 
 S = "${WORKDIR}/git/trusted-services"
Signature · 1 line
2.39.1.windows.1
#14 lore raw

PATCH 15/17 arm-bps/corstone1000: setup trusted service proxy configuration

In reply to Gyorgy Szing

From: Rui Miguel Silva <[email protected]>

Make sure we setup the new variable for the configuration of the SE-Proxy service for our machine. This will trigger the right configuration building trusted services and all psa-arch test pass as before.

---
 meta-arm-bsp/conf/machine/include/corstone1000.inc | 1 +
 1 file changed, 1 insertion(+)
meta-arm-bsp/conf/machine/include/corstone1000.inc +1 -0
index 3915d18b..198c7ec8 100644
@@ -43,6 +43,7 @@ OPTEE_BINARY = "tee-pager_v2.bin"
 # Include smm-gateway and se-proxy SPs into optee-os binary
 MACHINE_FEATURES += "ts-smm-gateway ts-se-proxy"
 TS_PLATFORM = "arm/corstone1000"
+TS_SP_SE_PROXY_CONFIG = "corstone1000"
 
 # External System(Cortex-M3)
 EXTRA_IMAGEDEPENDS += "external-system"
Signature · 1 line
2.39.1.windows.1
#15 lore raw

PATCH 16/17 CI: Platform specific Trusted Services config

In reply to Gyorgy Szing

From: Adam Johnston <[email protected]>

Split trusted-services.xml into qemuarm64-secureboot-ts.yml and n1sdp-ts.yml as collection of Trusted Services which can be tested on each platform has diverged.

---
 .gitlab-ci.yml                                     |  4 ++--
 ci/n1sdp-ts.yml                                    | 14 ++++++++++++++
 ...ed-services.yml => qemuarm64-secureboot-ts.yml} |  0
 3 files changed, 16 insertions(+), 2 deletions(-)
 create mode 100644 ci/n1sdp-ts.yml
 rename ci/{trusted-services.yml => qemuarm64-secureboot-ts.yml} (100%)
.gitlab-ci.yml +2 -2
index df1f0f5a..4ee75fcc 100644
@@ -150,7 +150,7 @@ n1sdp:
   parallel:
     matrix:
       - TOOLCHAINS: [gcc, armgcc]
-        TS: [none, trusted-services]
+        TS: [none, n1sdp-ts]
 
 qemu-generic-arm64:
   extends: .build
@@ -167,7 +167,7 @@ qemuarm64-secureboot:
       - KERNEL: [linux-yocto, linux-yocto-dev, linux-yocto-rt]
         TOOLCHAINS: [gcc, clang]
         TCLIBC: [glibc, musl]
-        TS: [none, trusted-services]
+        TS: [none, qemuarm64-secureboot-ts]
         TESTING: testimage
 
 qemuarm64:
ci/n1sdp-ts.yml new file +14 -0
new file mode 100644
index 00000000..e8e9298d
@@ -0,0 +1,14 @@
+header:
+  version: 11
+  includes:
+    - ci/meta-openembedded.yml
+
+local_conf_header:
+  trusted_services: |
+    TEST_SUITES:append = " trusted_services"
+    # Include TS Crypto, TS Protected Storage, TS Internal and Trusted Storage SPs into optee-os image
+    MACHINE_FEATURES:append = " arm-ffa ts-crypto ts-storage ts-its"
+    # Include TS demo/test tools into image
+    IMAGE_INSTALL:append = " packagegroup-ts-tests"
+    # Include TS PSA Arch tests into image
+    IMAGE_INSTALL:append = " packagegroup-ts-tests-psa"
ci/qemuarm64-secureboot-ts.yml renamed from ci/trusted-services.yml +0 -0
similarity index 100%
rename from ci/trusted-services.yml
rename to ci/qemuarm64-secureboot-ts.yml
Signature · 1 line
2.39.1.windows.1
#16 lore raw

PATCH 17/17 optee-os: do not explicitly set CFG_MAP_EXT_DT_SECURE=y

In reply to Gyorgy Szing

From: Denys Dmytriyenko <[email protected]>

CFG_MAP_EXT_DT_SECURE=y should be set per platform, as it requires CFG_DT=y to also be set, which is not the case for all the platforms out there using optee-os. Moreover CFG_MAP_EXT_DT_SECURE is already being set conditionally in optee-os-ts.

---
 meta-arm/recipes-security/optee/optee-os_3.20.0.bb | 1 -
 1 file changed, 1 deletion(-)
meta-arm/recipes-security/optee/optee-os_3.20.0.bb +0 -1
index 2d4d6d6d..2fdfbb5a 100644
@@ -12,4 +12,3 @@ SRC_URI:append = " \
     file://0007-core-spmc-handle-non-secure-interrupts.patch \
     file://0008-core-spmc-configure-SP-s-NS-interrupt-action-based-o.patch \
    "
-EXTRA_OEMAKE += " CFG_MAP_EXT_DT_SECURE=y"
Signature · 1 line
2.39.1.windows.1