Skip to content

Commit 3abcc19

Browse files
joerchancarlescufi
authored andcommitted
tfm: Add option to enable the SFN model
Add option to enable the SFN model when building TF-M. The SFN model will eventually replace the Library model. Change the default model to be IPC, which follows the default configuration of TF-M. Signed-off-by: Joakim Andersson <[email protected]>
1 parent 63e45c8 commit 3abcc19

File tree

3 files changed

+58
-12
lines changed

3 files changed

+58
-12
lines changed

modules/trusted-firmware-m/CMakeLists.txt

+9-4
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,17 @@ set(TFM_CRYPTO_MODULES
3131

3232

3333
if (CONFIG_BUILD_WITH_TFM)
34-
if (CONFIG_TFM_IPC)
34+
if (CONFIG_TFM_LIBRARY)
35+
list(APPEND TFM_CMAKE_ARGS -DTFM_LIB_MODEL=ON)
36+
else()
3537
list(APPEND TFM_CMAKE_ARGS -DTFM_LIB_MODEL=OFF)
3638
# PSA API awareness for the Non-Secure application
3739
target_compile_definitions(app PRIVATE "TFM_PSA_API")
38-
else()
39-
list(APPEND TFM_CMAKE_ARGS -DTFM_LIB_MODEL=ON)
40+
if (CONFIG_TFM_SFN)
41+
list(APPEND TFM_CMAKE_ARGS -DCONFIG_TFM_SPM_BACKEND="SFN")
42+
else() # CONFIG_TFM_IPC
43+
list(APPEND TFM_CMAKE_ARGS -DCONFIG_TFM_SPM_BACKEND="IPC")
44+
endif()
4045
endif()
4146
if (CONFIG_TFM_REGRESSION_S)
4247
list(APPEND TFM_CMAKE_ARGS -DTEST_S=ON)
@@ -372,7 +377,7 @@ if (CONFIG_BUILD_WITH_TFM)
372377
endif()
373378

374379
if(NOT CONFIG_TFM_BUILD_NS)
375-
if(CONFIG_TFM_IPC)
380+
if(CONFIG_TFM_IPC OR CONFIG_TFM_SFN)
376381
zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_PLATFORM ${TFM_INTERFACE_SOURCE_DIR}/tfm_platform_ipc_api.c)
377382
zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_PROTECTED_STORAGE ${TFM_INTERFACE_SOURCE_DIR}/tfm_ps_ipc_api.c)
378383
zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_INTERNAL_TRUSTED_STORAGE ${TFM_INTERFACE_SOURCE_DIR}/tfm_its_ipc_api.c)

modules/trusted-firmware-m/Kconfig.tfm

+42-6
Original file line numberDiff line numberDiff line change
@@ -276,14 +276,50 @@ config TFM_MCUBOOT_DATA_SHARING
276276

277277
endif # TFM_BL2
278278

279+
choice TFM_MODEL
280+
prompt "TF-M Firmware Framework model"
281+
default TFM_IPC
282+
help
283+
The Firmware Framework M (FF-M) provides different programming models
284+
for Secure Partitions.
285+
286+
config TFM_LIBRARY
287+
bool "Library Model"
288+
help
289+
Use the library model instead of PSA API.
290+
291+
The library model conforms to the PSA Firmware Framework for M (FF-M)
292+
v1.0.
293+
294+
NOTE: The Library Model will be removed and replaced by the SFN model.
295+
279296
config TFM_IPC
280-
bool "IPC" if TFM_PROFILE_TYPE_NOT_SET
281-
default y if (TFM_PROFILE_TYPE_MEDIUM || TFM_PROFILE_TYPE_LARGE)
297+
bool "IPC Model"
282298
help
283-
When enabled, this option signifies that the TF-M build supports
284-
the PSA API (IPC mode) instead of the secure library mode. When
285-
TF-M Profile option is supplied, do not allow manual setting of
286-
the IPC mode, as it is determined by the profile setting.
299+
Use the IPC Model as the SPM backend for the PSA API.
300+
The IPC model supports the IPC and SFN Partition models, and
301+
isolation levels 1, 2 and 3.
302+
303+
In this model each Secure Partition processes signals in any order,
304+
and can defer responding to a message while continuing to process
305+
other signals.
306+
307+
The IPC model conforms to the PSA Firmware Framework for M (FF-M)
308+
v1.1.
309+
310+
config TFM_SFN
311+
bool "SFN model"
312+
help
313+
Use the SFN Model as the SPM backend for the PSA API.
314+
The SFN model supports the SFN Partition model, and isolation level 1.
315+
316+
In this model each Secure Partition is made up of a collection of
317+
callback functions which implement secure services.
318+
319+
The SFN model conforms to the PSA Firmware Framework for M (FF-M)
320+
v1.1.
321+
322+
endchoice # TFM_MODEL
287323

288324
config TFM_REGRESSION_S
289325
bool "TF-M Secure Regression tests"

modules/trusted-firmware-m/Kconfig.tfm.partitions

+7-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ if BUILD_WITH_TFM
77

88
config TFM_PARTITION_PROTECTED_STORAGE
99
bool "Secure partition 'Protected Storage'"
10+
depends on TFM_PARTITION_PLATFORM # Specfically TFM_SP_PLATFORM_NV_COUNTER service
11+
depends on TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
12+
depends on TFM_PARTITION_CRYPTO
1013
default y
1114
help
1215
Setting this option will cause '-DTFM_PARTITION_PROTECTED_STORAGE'
@@ -40,6 +43,7 @@ config TFM_PARTITION_CRYPTO
4043

4144
config TFM_PARTITION_INITIAL_ATTESTATION
4245
bool "Secure partition 'Initial Attestation'"
46+
depends on TFM_PARTITION_CRYPTO
4347
default y
4448
help
4549
Setting this option will cause '-DTFM_PARTITION_INITIAL_ATTESTATION'
@@ -52,6 +56,7 @@ config TFM_PARTITION_INITIAL_ATTESTATION
5256
config TFM_PARTITION_PLATFORM
5357
bool "Secure partition 'Platform'"
5458
default y
59+
depends on !TFM_SFN # Currently using PSA Framework version 1.0
5560
help
5661
Setting this option will cause '-DTFM_PARTITION_PLATFORM'
5762
to be passed to the TF-M build system. Look at 'config_default.cmake'
@@ -61,8 +66,8 @@ config TFM_PARTITION_PLATFORM
6166
repository.
6267

6368
config TFM_PARTITION_AUDIT_LOG
64-
bool "Secure partition 'Audit Log'" if !TFM_IPC
65-
depends on !TFM_IPC
69+
bool "Secure partition 'Audit Log'"
70+
depends on TFM_LIBRARY
6671
default y
6772
help
6873
Setting this option will cause '-DTFM_PARTITION_AUDIT_LOG'

0 commit comments

Comments
 (0)