Version 5 vs 65
Version 5 vs 65
Edits
Edits
- Edit by gyuri-szing, Version 65
- Oct 18 2023 12:55 PM
- Edit by jellesels-arm, Version 5
- Feb 22 2022 3:19 PM
Edit Older Version 5... | Edit Current Version 65... |
Content Changes
Content Changes
OP-TEE SPMC implementation
==========================
Introduction
------------
### OP-TEE SPMC implementation
This document describes the OP-TEE SPMC implementation. This
implementation is used to support the Trusted Services PSA SPs. The PSA
SPs are based on the Arm FF-A specifications. The OP-TEE SPMC can be
used as a reference S-EL1 implementation and the Trusted Service can be
used a reference S-EL0 SP implementations.
### FF-A
Arm Firmware Framework for Arm A-profile (FF-A) is a framework designed
to standardize the communication between the various software images.
Including the communication between the various software images in the
Secure world and Normal world. The current release of the OP-TEE SPMC is
based around the [FF-A v1.0
spec](https://developer.arm.com/documentation/den0077/latest.)
### OP-TEE
OP-TEE is an open source Trusted Execution Environment (TEE)
implementing the Arm TrustZone technology. More information can be found
at [readthedocs](https://optee.readthedocs.io/en/latest/) OP-TEE can run
both as a S-EL1 SP or as the S-EL1 SPMC. This document describes OP-TEE
as a S-El1 SPMC. The current mainline OP-TEE version can be found
[here](https://github.com/OP-TEE/optee_os)
### Trusted Services
The Trusted Services project provides a framework for developing and
deploying device Root Of Trust (RoT) services across a range of secure
processing environments such as those provided by OP-TEE and Hafnium.
More information about Trusted Service can be found at
[Trusted-Services](https://trusted-services.readthedocs.io/en/latest/)
Current Status
--------------
Currently the mainline OP-TEE SPMC is not yet fully compliant with the
FF-A V1.0 spec. It also doesn\'t support all of the Trusted Services
SPs.
### SPMC status
OP-TEE mainline SPMC FF-A status:
------------------- ---------------
SP loading Supported
SP messaging Supported
Manifest file Not Supported
Memory management Supported
Interrupts Not supported
------------------- ---------------
OP-TEE mainline SPMC FF-A messages status:
------------------------------ -------------------------
FFA\_ERROR Supported
FFA\_SUCCESS Supported
FFA\_INTERRUPT Not supported
FFA\_VERSION Supported
FFA\_FEATURES Supported
FFA\_RX\_RELEASE Supported
FFA\_RXTX\_MAP Supported
FFA\_RXTX\_UNMAP Supported
FFA\_PARTITION\_INFO\_GET Supported
FFA\_ID\_GET Supported
FFA\_MSG\_WAIT Supported
FFA\_YIELD Not supported
FFA\_RUN Not supported
FFA\_NORMAL\_WORLD\_RESUME Not supported
FFA\_MSG\_SEND Not supported
FFA\_MSG\_SEND\_DIRECT\_REQ Supported
FFA\_MSG\_SEND\_DIRECT\_RESP Supported
FFA\_MSG\_POLL Not supported
FFA\_MEM\_DONATE Not supported
FFA\_MEM\_LEND Not supported
FFA\_MEM\_SHARE Partially supported[^1]
FFA\_MEM\_RETRIEVE\_REQ Supported
FFA\_MEM\_RETRIEVE\_RESP Supported
FFA\_MEM\_RELINQUISH Supported
FFA\_MEM\_RECLAIM Supported
------------------------------ -------------------------
### Trusted Service status
Currently not all Trusted Service functionality is supported when using
the OP-TEE SPMC. We are planning to support all functionality over time.
Currently the OP-TEE SPMC supports the following PSA Trusted Services
SPs:
--------------------------- --------------------------------------------------------------------
internal-trusted-storage: Supported
protected-storage: Supported
crypto: Supported with mock backend. A hardware trngs is not yet supported
attestation: Not yet supported
smm-gateway: Not yet supported
--------------------------- --------------------------------------------------------------------
Build
-----
The build process is based around the [OP-TEE build
process](https://optee.readthedocs.io/en/latest/building/gits/build.html)
with some extra steps.
### Requirements:
- The Trusted Services project has some extra
[requirements](https://trusted-services.readthedocs.io/en/latest/developer/software-requirements.html)
from OP-TEE. It mainly depends on cmake.
- The current system uses the Arm FVP to run the test environment. The
latest version can be found at
[developer.arm.com](https://developer.arm.com/-/media/Files/downloads/ecosystem-models/FVP_Base_RevC-2xAEMvA_11.16_16.tgz)
The default path for FVP in the build scripts is set to
/opt/fvp/latest
### Build steps
Get the manifest file:
rm -rf optee_test
mkdir optee_test
cd optee_test
repo init -u https://review.trustedfirmware.org/OP-TEE/manifest -m psa-sp-fvp.xml -b refs/changes/91/10991/30
repo sync -j4 --no-clone-bundle
Build the OP-TEE image:
The OP-TEE build will default be configure to use mainline OP-TEE SPMC.
To be able to build OP-TEE mainline version, it might be needed to
change the SPMC\_VERSION to SPMC\_VERSION=github in build/fvp\_ffa.mk.
Build OP-TEE:
cd build
make toolchains
make
cd ..
Build TS apps:
make -C trusted-services/tools/b-test r-ts-service-test-arm-linux
cp -r trusted-services/tools/b-test/install/arm-linux/bin/ts-service-test shared
make -C trusted-services/tools/b-test r-libts-arm-linux
cp -r trusted-services/tools/b-test/install/arm-linux/lib/libts.so.1.0.0 shared/libts.so.1
More info about building TS-apps can be found at the [Trusted Services
build
instructions](https://trusted-services.readthedocs.io/en/latest/developer/build-instructions.html)
Run fvp:
cd build
make run
Set up the [fvp
environment](https://trusted-services.readthedocs.io/en/latest/environments/deployment-guides/fvp-deployment-guide.html?highlight=ts-service-test#deploying-service-level-tests):
cd /mnt/
sh load_module.sh
cp libts.so.1 /usr/lib/.
Run the PSA ServiceTests:
./ts-service-test -v -sg ItsServiceTests
./ts-service-test -v -sg PsServiceTests
./ts-service-test -v -sg CryptoKeyDerivationServicePackedcTests
./ts-service-test -v -sg CryptoMacServicePackedcTests
./ts-service-test -v -sg CryptoCipherServicePackedcTests
./ts-service-test -v -sg CryptoHashServicePackedcTests
./ts-service-test -v -sg CryptoServiceProtobufTests
./ts-service-test -v -sg CryptoServiceLimitTests
./ts-service-test -v -sg DiscoveryServiceTests
./ts-service-test -v -sg CryptoServicePackedcTests
Currently the attestation and fail due the lack of the attestation SP
support.
[^1]: Device memory is not yet supported.
= OP-TEE SPMC implementation
== Introduction
==== OP-TEE SPMC implementation
This document describes the OP-TEE SPMC (Secure Partition Manager Core) implementation. This implementation is used to support the Trusted Services PSA Secure Partitions (SPs). The PSA SPs are implemented based on the Arm FF-A specification. The OP-TEE SPMC can be used as a reference S-EL1 implementation and the Trusted Services can be used a reference S-EL0 SP implementations.
==== FF-A
Arm Firmware Framework for Arm A-profile (FF-A) is a framework designed to standardize the communication between the various software images.
Including the communication between the various software images in the Secure world and Normal world. The current release of the OP-TEE SPMC is based around the [FF-A v1.0 spec](https://developer.arm.com/documentation/den0077/latest).
==== OP-TEE
OP-TEE is an open source Trusted Execution Environment (TEE) relying on the Arm TrustZone technology. More information can be found at [readthedocs](https://optee.readthedocs.io/en/latest/). OP-TEE can run both as a S-EL1 SP or as the S-EL1 SPMC.
This document describes OP-TEE as a S-EL1 SPMC. The current mainline OP-TEE version can be found [here](https://github.com/OP-TEE/optee_os).
==== Trusted Services
The Trusted Services project provides a framework for developing and deploying device Root of Trust (RoT) services across a range of secure processing environments such as those provided by OP-TEE and Hafnium.
More information about Trusted Services can be found at [Trusted-Services](https://trusted-services.readthedocs.io/en/latest/).
== Current Status
Limited support for OP-TEE SPMC aligning with FF-A 1.0 is available since OP-TEE v3.19. Complete support for FF-A 1.0 and TS is planned for upcoming releases. See below for status.
For the OP-TEE release specific testing and results please see the following page:
- [[ https://developer.trustedfirmware.org/w/trusted-services/op-tee-spmc/release-testing-3-19/ | OP-TEE 3.19 release ]]
- [[ https://developer.trustedfirmware.org/w/trusted-services/op-tee-spmc/release-testing-3-20/ | OP-TEE 3.20 release ]]
- [[ https://developer.trustedfirmware.org/w/trusted-services/op-tee-spmc/release-testing-3-21/ | OP-TEE 3.21 release ]]
- [[ https://developer.trustedfirmware.org/w/trusted-services/op-tee-spmc/release-testing-3-22/ | OP-TEE 3.22 release ]]
- [[ https://developer.trustedfirmware.org/w/trusted-services/op-tee-spmc/release-testing-3-22/ | OP-TEE 3.22 release ]]
- [[ https://developer.trustedfirmware.org/w/trusted-services/op-tee-spmc/release-testing-4-0/ | OP-TEE 4.0.0 release ]]
== Important Changes of v4.0.0 release ==
- Added support for the `boot-order` property of the SP manifest. Earlier the boot order was determined by the linking order when using embedded packaging or by the order of SP entries in the FIP package when using FIP packaging. In case the `boot-order` property is not set for an SP, loading will fall back to the old method.
- The SPMC has been updated to allow the XEN Hypervisor being executed in the NWd. All Trusted Services tests from DOM0 and DOMU virtual machines are passing.
- Bug fixes:
- The SPMC was accepting direct messages targeting yet to be initialized SPs, and could jumping to an invalid address as a result.
- The SPMC was clearing MBZ registers when making FFA_ERROR calls. This could result in incorrect operation.
- In some scenarios the destination of FFA_ERROR calls were set incorrectly.
- Code handling the FFA_MEM_RECLAIM calls incorrectly assumed the NWd endpoint being 0. This resulted in a crash when a hypervisor is present in the NWd.
==== SPMC status
For a list of supported FF-A features please see: https://optee.readthedocs.io/en/latest/architecture/spmc.html
==== Trusted Services status
All Trusted Services Secure Partitions are supported with OP-TEE SPMC v4.0.0
Trusted Services SP support status:
| Name | Status |
|--------------------------|-----------|
| internal-trusted-storage | Supported |
| protected-storage | Supported |
| crypto | Supported |
| attestation | Supported |
| firmware-update | Supported |
| block-storage | Supported |
| smm-gateway | Supported |
== Build
The build process follows the [OP-TEE build process](https://optee.readthedocs.io/en/latest/building/gits/build.html#get-and-build-the-solution). Additional information is needed for some steps:
- [Step 1](https://optee.readthedocs.io/en/latest/building/gits/build.html#step-1-prerequisites): The Trusted Services project has some extra requirements described on [this page](https://trusted-services.readthedocs.io/en/latest/developer/software-requirements.html), please install these.
- [Step 2](https://optee.readthedocs.io/en/latest/building/gits/build.html#step-2-install-android-repo): -
- [Step 3](https://optee.readthedocs.io/en/latest/building/gits/build.html#step-3-get-the-source-code): Use the manifest file for Trusted Services integration and use the 4.0.0 tagged version.
`repo init -u https://github.com/OP-TEE/manifest.git -m fvp-ts.xml -b 4.0.0`
- [Step 4](https://optee.readthedocs.io/en/latest/building/gits/build.html#step-4-get-the-toolchains): -
- [Step 5](https://optee.readthedocs.io/en/latest/building/gits/build.html#step-5-build-the-solution): -
- [Step 6 and onwards](https://optee.readthedocs.io/en/latest/building/gits/build.html#step-6-flash-the-device): Since we're running on models instead of real hardware, these steps are not necessary.
== Boot
The current system uses the Arm AEMv-A Base Platform FVP to run the test environment. The latest version can be found at [Arm Architecture Models](https://developer.arm.com/downloads/-/arm-ecosystem-models). The downloaded FVP should be extracted at the project root (`<project root>/Base_RevC_AEMvA_pkg`).
Boot the system on the FVP:
make -C build run-only
Two console windows should appear, one for the Secure World and one for the Normal World. When the boot is complete, login as root. Then run these commands to load the necessary kernel modules and install the TS test applications and libraries:
/mnt/host/out/linux-arm-ffa-tee/load_module.sh
/mnt/host/out/linux-arm-ffa-user/load_module.sh
cp -at /usr /mnt/host/out/ts-install/arm-linux/bin /mnt/host/out/ts-install/arm-linux/lib
To run the SPMC tests built into xtest (OP-TEE test suite):
xtest -t ffa_spmc
= OP-TEE SPMC implementation
==========================
== Introduction
------------
###==== OP-TEE SPMC implementation
This document describes the OP-TEE SPMC (Secure Partition Manager Core) implementation. This
implementation is used to support the Trusted Services PSA SPsSecure Partitions (SPs). The PSA
SPs aree implemented based on the Arm FF-A specifications. The OP-TEE SPMC can be
be used as a reference S-EL1 implementation and the Trusted Services can be
used a reference S-EL0 SP implementations.
###==== FF-A
Arm Firmware Framework for Arm A-profile (FF-A) is a framework designed
to standardize the communication between the various software images.
Includinge the communication between the various software images in the
Secure world and Normal world. The current release of the OP-TEE SPMC is
based around the [FF-A v1.0.
spec](https://developer.arm.com/documentation/den0077/latest.)Including the communication between the various software images in the Secure world and Normal world. The current release of the OP-TEE SPMC is based around the [FF-A v1.0 spec](https://developer.arm.com/documentation/den0077/latest).
###==== OP-TEE
OP-TEE is an open source Trusted Execution Environment (TEE) relying on the Arm TrustZone technology. More information can be found at [readthedocs](https://optee.readthedocs.io/en/latest/). OP-TEE can run both as a S-EL1 SP or as the S-EL1 SPMC.
implementing the Arm TrustZone technology. More information can be found
at [readthedocs](https://optee.readthedocs.io/en/latest/) OP-TEE can run
both as a S-EL1 SP or as the S-EL1 SPMC. This document describes OP-TEE
as a S-ElThis document describes OP-TEE as a S-EL1 SPMC. The current mainline OP-TEE version can be found
[here](https://github.com/OP-TEE/optee_os).
###==== Trusted Services
The Trusted Services project provides a framework for developing and
and deploying device Root Ofof Trust (RoT) services across a range of secure processing environments such as those provided by OP-TEE and Hafnium.
processing environments such as those provided by OP-TEE and Hafnium.
More information about Trusted Services can be found at
[Trusted-Services](https://trusted-services.readthedocs.io/en/latest/).
== Current Status
--------------
Currently the mainline OP-TEE SPMC is not yet fully compliant with the
FF-A V1.0 specLimited support for OP-TEE SPMC aligning with FF-A 1.0 is available since OP-TEE v3.19. Complete support for FF-A 1.0 and TS is planned for upcoming releases. It also doesn\'t support all of the Trusted ServicesSee below for status.
SPs.For the OP-TEE release specific testing and results please see the following page:
### SPMC status
OP-TEE mainline SPMC FF-A status:
------------------- ---------------
SP loading Supported- [[ https://developer.trustedfirmware.org/w/trusted-services/op-tee-spmc/release-testing-3-19/ | OP-TEE 3.19 release ]]
SP messaging Supported- [[ https://developer.trustedfirmware.org/w/trusted-services/op-tee-spmc/release-testing-3-20/ | OP-TEE 3.20 release ]]
Manifest file Not Supported- [[ https://developer.trustedfirmware.org/w/trusted-services/op-tee-spmc/release-testing-3-21/ | OP-TEE 3.21 release ]]
Memory management Supported- [[ https://developer.trustedfirmware.org/w/trusted-services/op-tee-spmc/release-testing-3-22/ | OP-TEE 3.22 release ]]
Interrupts Not supported- [[ https://developer.trustedfirmware.org/w/trusted-services/op-tee-spmc/release-testing-3-22/ | OP-TEE 3.22 release ]]
------------------- ---------------- [[ https://developer.trustedfirmware.org/w/trusted-services/op-tee-spmc/release-testing-4-0/ | OP-TEE 4.0.0 release ]]
OP-TEE mainline SPMC FF-A messages status:== Important Changes of v4.0.0 release ==
------------------------------ -------------------------
FFA\_ERROR Supported
FFA\_SUCCESS Supported
FFA\_INTERRUPT Not supported
FFA\_VERSION Supported- Added support for the `boot-order` property of the SP manifest. Earlier the boot order was determined by the linking order when using embedded packaging or by the order of SP entries in the FIP package when using FIP packaging. In case the `boot-order` property is not set for an SP, loading will fall back to the old method.
- The SPMC has been updated to allow the XEN Hypervisor being executed in the NWd. All Trusted Services tests from DOM0 and DOMU virtual machines are passing.
- Bug fixes:
FFA\_FEATURES Supported- The SPMC was accepting direct messages targeting yet to be initialized SPs, and could jumping to an invalid address as a result.
FFA\_RX\_RELEASE Supported- The SPMC was clearing MBZ registers when making FFA_ERROR calls. This could result in incorrect operation.
FFA\_RXTX\_MAP Supported- In some scenarios the destination of FFA_ERROR calls were set incorrectly.
FFA\_RXTX\_UNMAP Supported
FFA\_PARTITION\_INFO\_GET Supported
FFA\_ID\_GET Supported
FFA\_MSG\_WAIT Supported
FFA\_YIELD Not supported
FFA\_RUN Not supported
FFA\_NORMAL\_WORLD\_RESUME Not supported
FFA\_MSG\_SEND Not supported
FFA\_MSG\_SEND\_DIRECT\_REQ Supported
FFA\_MSG\_SEND\_DIRECT\_RESP Supported
FFA\_MSG\_POLL Not supported
FFA\_MEM\_DONATE Not supported
FFA\_MEM\_LEND Not supported
FFA\_MEM\_SHARE Partially supported[^1]
FFA\_MEM\_RETRIEVE\_REQ Supported
FFA\_MEM\_RETRIEVE\_RESP Supported
FFA\_MEM\_RELINQUISH Supported
FFA\_MEM\_RECLAIM Supported
------------------------------ -------------------------- Code handling the FFA_MEM_RECLAIM calls incorrectly assumed the NWd endpoint being 0. This resulted in a crash when a hypervisor is present in the NWd.
==== SPMC status
### Trusted ServiceFor a list of supported FF-A features please see: https://optee.readthedocs.io/en/latest/architecture/spmc.html
==== Trusted Services status
Currently not all Trusted Service functionality is supported when using
the OP-TEE SPMC. We are planning to support all functionality over time.All Trusted Services Secure Partitions are supported with OP-TEE SPMC v4.0.0
Currently the OP-TEE SPMCTrusted Services SP supports the following PSA Trusted Services
SPs:t status:
--------------------------- --------------------------------------------------------------------| Name | Status |
internal-trusted-storage: Supported|--------------------------|-----------|
protected-storage: Supported
crypto: Supported with mock backend. A hardware trngs is not yet supported| internal-trusted-storage | Supported |
attestation: | protected-storage Not yet s | Supported |
smm-gateway:| crypto Not yet s | Supported |
--------------------------- --------------------------------------------------------------------
Build| attestation | Supported |
-----
The build process is based around the [OP-TEE build| firmware-update | Supported |
process](https://optee.readthedocs.io/en/latest/building/gits/build.html)| block-storage | Supported |
with some extra steps.| smm-gateway | Supported |
### Requirements:== Build
- The Trusted Services project has some extra
[requirementbuild process follows the [OP-TEE build process](https://trusted-servicesoptee.readthedocs.io/en/latest/developer/software-requirements.html)
from OP-TEE. It mainly depends on cmake.
- The current system uses the Arm FVP to run the test environmentbuilding/gits/build.html#get-and-build-the-solution). The
latest version can be found at
[developer.arm.com](https://developer.arm.com/-/media/Files/downloads/ecosystem-models/FVP_Base_RevC-2xAEMvA_11.16_16.tgz)
The default path for FVP in the build scripts is set to
/opt/fvp/latestAdditional information is needed for some steps:
### Build steps- [Step 1](https://optee.readthedocs.io/en/latest/building/gits/build.html#step-1-prerequisites): The Trusted Services project has some extra requirements described on [this page](https://trusted-services.readthedocs.io/en/latest/developer/software-requirements.html), please install these.
Get the manifest file:- [Step 2](https://optee.readthedocs.io/en/latest/building/gits/build.html#step-2-install-android-repo): -
rm -rf optee_test- [Step 3](https://optee.readthedocs.io/en/latest/building/gits/build.html#step-3-get-the-source-code): Use the manifest file for Trusted Services integration and use the 4.0.0 tagged version.
mkdir optee_test
cd optee_test
repo init -u https://review.trustedfirmware.org/OP-TEE/manifest -m psa-sp-fvp.xml -b refs/changes/91/10991/30
repo sync -j4 --no-clone-bundle`repo init -u https://github.com/OP-TEE/manifest.git -m fvp-ts.xml -b 4.0.0`
B- [Step 4](https://optee.readthedocs.io/en/latest/build the OP-TEE image:ing/gits/build.html#step-4-get-the-toolchains): -
The OP-TEE build will default be configure to use mainline OP-TEE SPMC.
To be able to build OP-TEE mainline version, it might be needed to
change the SPMC\_VERSION to SPMC\_VERSION=github in build/fvp\_ffa.mk.- [Step 5](https://optee.readthedocs.io/en/latest/building/gits/build.html#step-5-build-the-solution): -
Build OP-TEE:- [Step 6 and onwards](https://optee.readthedocs.io/en/latest/building/gits/build.html#step-6-flash-the-device): Since we're running on models instead of real hardware, these steps are not necessary.
cd build
make toolchains
make
cd ..== Boot
Build TS apps:The current system uses the Arm AEMv-A Base Platform FVP to run the test environment. The latest version can be found at [Arm Architecture Models](https://developer.arm.com/downloads/-/arm-ecosystem-models). The downloaded FVP should be extracted at the project root (`<project root>/Base_RevC_AEMvA_pkg`).
make -C trusted-services/tools/b-test r-ts-service-test-arm-linux
cp -r trusted-services/tools/b-test/install/arm-linux/bin/ts-service-test shared
make -C trusted-services/tools/b-test r-libts-arm-linux
cp -r trusted-services/tools/b-test/install/arm-linux/lib/libts.so.1.0.0 shared/libts.so.1Boot the system on the FVP:
More info about building TS-apps can be found at the [Trusted Services
build
instructions](https://trusted-services.readthedocs.io/en/latest/developer/build-instructions.html)
Run fvp:
cd build
make run-C build run-only
Set up the [fvp
environment](https://trusted-services.readthedocs.io/en/latest/environments/deployment-guides/fvp-deployment-guide.html?highlight=ts-service-test#deploying-service-level-tests)Two console windows should appear, one for the Secure World and one for the Normal World. When the boot is complete, login as root. Then run these commands to load the necessary kernel modules and install the TS test applications and libraries:
cd /mnt//mnt/host/out/linux-arm-ffa-tee/load_module.sh
sh /mnt/host/out/linux-arm-ffa-user/load_module.sh
cp libts.so.1 /usr/lib/.cp -at /usr /mnt/host/out/ts-install/arm-linux/bin /mnt/host/out/ts-install/arm-linux/lib
RTo run the PSA ServiceTests:SPMC tests built into xtest (OP-TEE test suite):
./ts-service-test -v -sg ItsServiceTests
./ts-service-test -v -sg PsServiceTests
./ts-service-test -v -sg CryptoKeyDerivationServicePackedcTests
./ts-service-test -v -sg CryptoMacServicePackedcTests
./ts-service-test -v -sg CryptoCipherServicePackedcTests
./ts-service-test -v -sg CryptoHashServicePackedcTests
./ts-service-test -v -sg CryptoServiceProtobufTests
./ts-service-test -v -sg CryptoServiceLimitTests
./ts-service-test -v -sg DiscoveryServiceTests
./ts-service-test -v -sg CryptoServicePackedcTests
Currently the attestation and fail due the lack of the attestation SP
support.
[^1]: Device memory is not yet supported.xtest -t ffa_spmc