blob: e3648397a642f7015f1d1402bae58d8f4a26f87c [file] [log] [blame]
Julian Hallc6268b02022-03-10 10:31:09 +00001Running user-space programs on FVP
2==================================
3
4This page explains how to load and run user space programs on a Linux image running in FVP simulation.
5The loaded programs may use any trusted services that are available as part of the image firmware.
6
7To prepare and run an image that includes trusted services running in S-EL0 secure partitions under
8OP-TEE see: :ref:`Deploying trusted services in S-EL0 Secure Partitions under OP-TEE`
9
10The example assumes that the FVP model has been installed in the following
11directory relative to the OP-TEE build directory::
12
13 ../Base_RevC_AEMvA_pkg/models/Linux64_GCC-9.3
14
15
16Shared directory
17----------------
18
19The AEM FVP supports directory sharing between the target and the host OS. This provides a
20convenient way to transfer files between the host and the device simulation. When the FVP is run
21using the *run-only* target from the *op-tee/build* repository, the shared directory is set-up
22automatically. The whole "workspace" is shared to the FVP and mounted under ``/mnt/host``.
23
24
25Running service level tests
26---------------------------
27
28Most test and demo applications are integrated into the OP-TEE build flow, and can be build using
29the makefiles in the ``op-tee/build`` repository.
30
31To build all such binaries build the ``ffa-test-all`` target. For available targets please refer to
32fvp-psa-sp.mk_. As an example to build the ``ts-service-test`` application execute the following
33commands from the root of the workspace::
34
35 make -C build ffa-ts-service-test
36
37The executable includes service level test cases that exercise trusted services via their
38standard interfaces. Test cases use *libts* for locating services and establishing RPC
39sessions. *ts-service-test* provides a useful reference for understanding how *libts* may
40be used for accessing trusted services.
41
42Build output will be copied to ``out/ts-install``.
43
44To build the applications without using the ``op-tee/build`` files refer to the instructions here:
45:ref:`Build Instructions`
46
47Run *ts-service-test*
48'''''''''''''''''''''
49
50To start the FVP, from the root directory of the workspace, enter::
51
52 FVP_PATH=../Base_RevC_AEMvA_pkg/models/Linux64_GCC-9.3 make -C build run-only
53
54Once it boots to the login prompt, log in as root and from the FVP terminal, enter::
55
56 # Enter the mount target for the shared directory
57 cd /mnt/host
58
59 # Install the shared library and executables
60 cp -vat /usr out/ts-install/arm-linux/lib out/ts-install/arm-linux/bin
61
62 # Load the kernel modules
63 out/linux-arm-ffa-tee/load_module.sh
64 out/linux-arm-ffa-user/load_module.sh
65
66 # Run the test application
67 ts-service-test -v
68
69Use the same flow for other user-space programs. Check the output of the ``cp`` command executed to see
70executables copied under ``/usr/bin``.
71
72If all is well, you should see something like::
73
74 TEST(PsServiceTests, createAndSetExtended) - 0 ms
75 TEST(PsServiceTests, createAndSet) - 0 ms
76 TEST(PsServiceTests, storeNewItem) - 0 ms
77 TEST(ItsServiceTests, storeNewItem) - 0 ms
78 TEST(AttestationProvisioningTests, provisionedIak) - 1 ms
79 TEST(AttestationProvisioningTests, selfGeneratedIak) - 1 ms
80 TEST(AttestationServiceTests, repeatedOperation) - 75 ms
81 TEST(AttestationServiceTests, invalidChallengeLen) - 0 ms
82 TEST(AttestationServiceTests, checkTokenSize) - 2 ms
83 TEST(CryptoKeyDerivationServicePackedcTests, deriveAbort) - 0 ms
84 TEST(CryptoKeyDerivationServicePackedcTests, hkdfDeriveBytes) - 0 ms
85 TEST(CryptoKeyDerivationServicePackedcTests, hkdfDeriveKey) - 0 ms
86 TEST(CryptoMacServicePackedcTests, macAbort) - 0 ms
87 TEST(CryptoMacServicePackedcTests, signAndVerify) - 1 ms
88 TEST(CryptoCipherServicePackedcTests, cipherAbort) - 0 ms
89 TEST(CryptoCipherServicePackedcTests, encryptDecryptRoundtrip) - 0 ms
90 TEST(CryptoHashServicePackedcTests, hashAbort) - 0 ms
91 TEST(CryptoHashServicePackedcTests, hashAndVerify) - 0 ms
92 TEST(CryptoHashServicePackedcTests, calculateHash) - 0 ms
93 TEST(CryptoServicePackedcTests, generateRandomNumbers) - 0 ms
94 TEST(CryptoServicePackedcTests, asymEncryptDecryptWithSalt) - 14 ms
95 TEST(CryptoServicePackedcTests, asymEncryptDecrypt) - 1 ms
96 TEST(CryptoServicePackedcTests, signAndVerifyEat) - 4 ms
97 TEST(CryptoServicePackedcTests, signAndVerifyMessage) - 4 ms
98 TEST(CryptoServicePackedcTests, signAndVerifyHash) - 4 ms
99 TEST(CryptoServicePackedcTests, exportAndImportKeyPair) - 1 ms
100 TEST(CryptoServicePackedcTests, exportPublicKey) - 1 ms
101 TEST(CryptoServicePackedcTests, purgeKey) - 0 ms
102 TEST(CryptoServicePackedcTests, copyKey) - 1 ms
103 TEST(CryptoServicePackedcTests, generatePersistentKeys) - 1 ms
104 TEST(CryptoServicePackedcTests, generateVolatileKeys) - 0 ms
105 TEST(CryptoServiceProtobufTests, generateRandomNumbers) - 1 ms
106 TEST(CryptoServiceProtobufTests, asymEncryptDecryptWithSalt) - 15 ms
107 TEST(CryptoServiceProtobufTests, asymEncryptDecrypt) - 1 ms
108 TEST(CryptoServiceProtobufTests, signAndVerifyMessage) - 4 ms
109 TEST(CryptoServiceProtobufTests, signAndVerifyHash) - 4 ms
110 TEST(CryptoServiceProtobufTests, exportAndImportKeyPair) - 1 ms
111 TEST(CryptoServiceProtobufTests, exportPublicKey) - 0 ms
112 TEST(CryptoServiceProtobufTests, generatePersistentKeys) - 1 ms
113 TEST(CryptoServiceProtobufTests, generateVolatileKeys) - 1 ms
114 TEST(CryptoServiceLimitTests, volatileRsaKeyPairLimit) - 99 ms
115 TEST(CryptoServiceLimitTests, volatileEccKeyPairLimit) - 22 ms
116 TEST(DiscoveryServiceTests, checkServiceInfo) - 0 ms
117 TEST(SmmVariableAttackTests, getCheckPropertyWithMaxSizeName) - 0 ms
118 TEST(SmmVariableAttackTests, getCheckPropertyWithOversizeName) - 0 ms
119 TEST(SmmVariableAttackTests, setCheckPropertyWithMaxSizeName) - 0 ms
120 TEST(SmmVariableAttackTests, setCheckPropertyWithOversizeName) - 0 ms
121 TEST(SmmVariableAttackTests, enumerateWithSizeMaxNameSize) - 0 ms
122 TEST(SmmVariableAttackTests, enumerateWithOversizeName) - 0 ms
123 TEST(SmmVariableAttackTests, setAndGetWithSizeMaxNameSize) - 0 ms
124 TEST(SmmVariableAttackTests, setAndGetWithOversizeName) - 0 ms
125 TEST(SmmVariableAttackTests, setWithSizeMaxNameSize) - 0 ms
126 TEST(SmmVariableAttackTests, setWithOversizeName) - 0 ms
127 TEST(SmmVariableAttackTests, setWithSizeMaxDataSize) - 0 ms
128 TEST(SmmVariableAttackTests, setWithOversizeData) - 0 ms
129 TEST(SmmVariableServiceTests, checkMaxVariablePayload) - 0 ms
130 TEST(SmmVariableServiceTests, setSizeConstraint) - 0 ms
131 TEST(SmmVariableServiceTests, enumerateStoreContents) - 0 ms
132 TEST(SmmVariableServiceTests, getVarSizeNv) - 0 ms
133 TEST(SmmVariableServiceTests, getVarSize) - 0 ms
134 TEST(SmmVariableServiceTests, setAndGetNv) - 1 ms
135 TEST(SmmVariableServiceTests, setAndGet) - 0 ms
136 TEST(TestRunnerServiceTests, runSpecificTest) - 0 ms
137 TEST(TestRunnerServiceTests, runConfigTests) - 0 ms
138 TEST(TestRunnerServiceTests, listPlatformTests) - 0 ms
139 TEST(TestRunnerServiceTests, runAllTests) - 0 ms
140 TEST(TestRunnerServiceTests, listAllTests) - 0 ms
141
142 OK (67 tests, 67 ran, 977 checks, 0 ignored, 0 filtered out, 261 ms)
143
144--------------
145
146.. _fvp-psa-sp.mk :https://github.com/OP-TEE/build/blob/master/fvp-psa-sp.mk
147
148*Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.*
149
150SPDX-License-Identifier: BSD-3-Clause