Main updates from version V7[1]
Update the series based on Mathieu Poirier's comments.
Details of the updates are listed in the commit messages of the patches.
[1] https://lore.kernel.org/linux-arm-kernel/20240611073904.475019-1-arnaud.pou…
base-commit: 1613e604df0cd359cf2a7fbd9be7a0bcfacfabd0
Description of the feature:
--------------------------
This series proposes the implementation of a remoteproc tee driver to
communicate with a TEE trusted application responsible for authenticating
and loading the remoteproc firmware image in an Arm secure context.
1) Principle:
The remoteproc tee driver provides services to communicate with the OP-TEE
trusted application running on the Trusted Execution Context (TEE).
The trusted application in TEE manages the remote processor lifecycle:
- authenticating and loading firmware images,
- isolating and securing the remote processor memories,
- supporting multi-firmware (e.g., TF-M + Zephyr on a Cortex-M33),
- managing the start and stop of the firmware by the TEE.
2) Format of the signed image:
Refer to:
https://github.com/OP-TEE/optee_os/blob/master/ta/remoteproc/src/remoteproc…
3) OP-TEE trusted application API:
Refer to:
https://github.com/OP-TEE/optee_os/blob/master/ta/remoteproc/include/ta_rem…
4) OP-TEE signature script
Refer to:
https://github.com/OP-TEE/optee_os/blob/master/scripts/sign_rproc_fw.py
Example of usage:
sign_rproc_fw.py --in <fw1.elf> --in <fw2.elf> --out <signed_fw.sign> --key ${OP-TEE_PATH}/keys/default.pem
5) Impact on User space Application
No sysfs impact.the user only needs to provide the signed firmware image
instead of the ELF image.
For more information about the implementation, a presentation is available here
(note that the format of the signed image has evolved between the presentation
and the integration in OP-TEE).
https://resources.linaro.org/en/resource/6c5bGvZwUAjX56fvxthxds
Arnaud Pouliquen (5):
remoteproc: core: Introduce rproc_pa_to_va helper
remoteproc: Add TEE support
dt-bindings: remoteproc: Add compatibility for TEE support
remoteproc: stm32: Create sub-functions to request shutdown and
release
remoteproc: stm32: Add support of an OP-TEE TA to load the firmware
.../bindings/remoteproc/st,stm32-rproc.yaml | 58 ++-
drivers/remoteproc/Kconfig | 10 +
drivers/remoteproc/Makefile | 1 +
drivers/remoteproc/remoteproc_core.c | 46 ++
drivers/remoteproc/remoteproc_tee.c | 446 ++++++++++++++++++
drivers/remoteproc/stm32_rproc.c | 147 ++++--
include/linux/remoteproc.h | 5 +
include/linux/remoteproc_tee.h | 100 ++++
8 files changed, 769 insertions(+), 44 deletions(-)
create mode 100644 drivers/remoteproc/remoteproc_tee.c
create mode 100644 include/linux/remoteproc_tee.h
base-commit: 1613e604df0cd359cf2a7fbd9be7a0bcfacfabd0
--
2.25.1
[BCC all OP-TEE maintainers]
Hi OP-TEE maintainers & contributors,
OP-TEE v4.3.0 is scheduled to be released on 2024-07-12. So, now is
a good time to start testing the master branch on the various platforms
and report/fix any bugs.
The GitHub pull request for collecting Tested-by tags or any other
comments is https://github.com/OP-TEE/optee_os/pull/6906.
As usual, we will create a release candidate tag one week before the
release date for final testing.
In addition to that you can find some additional information related to
releases here: https://optee.readthedocs.io/en/latest/general/releases.html
Thanks,
Jens
Hello arm-soc maintainers,
Please pull this small patch fixing a few missing-field-initializers warnings
in the optee driver.
Thanks,
Jens
The following changes since commit a38297e3fb012ddfa7ce0321a7e5a8daeb1872b6:
Linux 6.9 (2024-05-12 14:12:29 -0700)
are available in the Git repository at:
https://git.linaro.org/people/jens.wiklander/linux-tee.git/ tags/optee-fix-for-v6.11
for you to fetch changes up to e0556255a53d6d3d406a28362dffd972018a997c:
tee: optee: ffa: Fix missing-field-initializers warning (2024-06-27 10:27:31 +0200)
----------------------------------------------------------------
Fix optee missing-field-initializers warning
----------------------------------------------------------------
Mark-PK Tsai (1):
tee: optee: ffa: Fix missing-field-initializers warning
drivers/tee/optee/ffa_abi.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
Hello arm-soc maintainers,
Please pull this small patch to the OP-TEE driver that adds a timemout
parameter when OP-TEE is waiting for a notification via RPC.
Thanks,
Jens
The following changes since commit a38297e3fb012ddfa7ce0321a7e5a8daeb1872b6:
Linux 6.9 (2024-05-12 14:12:29 -0700)
are available in the Git repository at:
https://git.linaro.org/people/jens.wiklander/linux-tee.git/ tags/optee-notif-wait-timeout-for-v6.11
for you to fetch changes up to 14ca6401d8703725c7297dcc4bf8de73323411ac:
optee: add timeout value to optee_notif_wait() to support timeout (2024-05-30 10:19:28 +0200)
----------------------------------------------------------------
optee: add timeout parameter for notification wait
----------------------------------------------------------------
Gavin Liu (1):
optee: add timeout value to optee_notif_wait() to support timeout
drivers/tee/optee/notif.c | 9 +++++++--
drivers/tee/optee/optee_private.h | 5 ++++-
drivers/tee/optee/optee_rpc_cmd.h | 1 +
drivers/tee/optee/rpc.c | 10 ++++++++--
4 files changed, 20 insertions(+), 5 deletions(-)
Hi Guys,
I am working on enabling BTI (and PAC) in trusted-services and I have a question about the topic.
If BTI is disabled in OPTEE, but someone tries to load an SP which was compiled with BTI (contains the related gnu note property) it will be successful.
This seems to be a security rish and I am thinking of either panicking or at least sending an error message to remind the user that the requested protection will not be enabled.
As I know there are common parts between TA-s and SP-s loaded by ldelf so I am not sure whether panicking in this scenario will result in any problems or not.
What do you think of this proposal?
Do you know of any reasons why BTI protected SP-s should be loadable by BTI disabled OPTEE?
Thanks in advance!
Gábor
Main updates from version V6:
------------------------------------------
- Fix kernel robot build report on in tee_rproc_find_loaded_rsc_table() inline
default definition.
Main updates from version V5[1][2]:
------------------------------------------
1) Rework resource table management
- Rework tee_rproc_parse_fw to temporary map the resource table address
to create a cached_table (similar to what is done in
rproc_elf_load_rsc_table()).
- Rename tee_rproc_get_loaded_rsc_table to tee_rproc_find_loaded_rsc_table
- Introduce rproc_pa_to_va() allowing to translate the resource table
physical address to virtual address based on remoteproc carveouts.
2) Merge the 2 "st,stm32-rproc.yaml" bindings patch in one
As the st,rproc-id" is linked to the introduction of the
"st,stm32mp1-m4-tee" compatible, merge following patches to address
Krzysztof concern.
- [PATCH v5 2/7] dt-bindings: remoteproc: Add compatibility for TEE support
- [PATCH v5 3/7] dt-bindings: remoteproc: Add processor identifier property
More details on updates are listed in commits messages.
[1] https://lore.kernel.org/lkml/Zlil4YSjHxb0FRgf@p14s/T/
[2] https://lore.kernel.org/lkml/20240521122458.3517054-1-arnaud.pouliquen@foss…
base-commit: 1613e604df0cd359cf2a7fbd9be7a0bcfacfabd0
Description of the feature:
--------------------------
This series proposes the implementation of a remoteproc tee driver to
communicate with a TEE trusted application responsible for authenticating
and loading the remoteproc firmware image in an Arm secure context.
1) Principle:
The remoteproc tee driver provides services to communicate with the OP-TEE
trusted application running on the Trusted Execution Context (TEE).
The trusted application in TEE manages the remote processor lifecycle:
- authenticating and loading firmware images,
- isolating and securing the remote processor memories,
- supporting multi-firmware (e.g., TF-M + Zephyr on a Cortex-M33),
- managing the start and stop of the firmware by the TEE.
2) Format of the signed image:
Refer to:
https://github.com/OP-TEE/optee_os/blob/master/ta/remoteproc/src/remoteproc…
3) OP-TEE trusted application API:
Refer to:
https://github.com/OP-TEE/optee_os/blob/master/ta/remoteproc/include/ta_rem…
4) OP-TEE signature script
Refer to:
https://github.com/OP-TEE/optee_os/blob/master/scripts/sign_rproc_fw.py
Example of usage:
sign_rproc_fw.py --in <fw1.elf> --in <fw2.elf> --out <signed_fw.sign> --key ${OP-TEE_PATH}/keys/default.pem
5) Impact on User space Application
No sysfs impact.the user only needs to provide the signed firmware image
instead of the ELF image.
For more information about the implementation, a presentation is available here
(note that the format of the signed image has evolved between the presentation
and the integration in OP-TEE).
https://resources.linaro.org/en/resource/6c5bGvZwUAjX56fvxthxds
Arnaud Pouliquen (5):
remoteproc: core: Introduce rproc_pa_to_va helper
remoteproc: Add TEE support
dt-bindings: remoteproc: Add compatibility for TEE support
remoteproc: stm32: Create sub-functions to request shutdown and
release
remoteproc: stm32: Add support of an OP-TEE TA to load the firmware
.../bindings/remoteproc/st,stm32-rproc.yaml | 58 ++-
drivers/remoteproc/Kconfig | 10 +
drivers/remoteproc/Makefile | 1 +
drivers/remoteproc/remoteproc_core.c | 74 ++-
drivers/remoteproc/stm32_rproc.c | 147 ++++--
drivers/remoteproc/tee_remoteproc.c | 451 ++++++++++++++++++
include/linux/remoteproc.h | 7 +
include/linux/tee_remoteproc.h | 100 ++++
8 files changed, 802 insertions(+), 46 deletions(-)
create mode 100644 drivers/remoteproc/tee_remoteproc.c
create mode 100644 include/linux/tee_remoteproc.h
base-commit: 1613e604df0cd359cf2a7fbd9be7a0bcfacfabd0
--
2.25.1
Hi,
Next week on Tuesday, it's time for another LOC monthly meeting. For
time and connection details see the calendar at
https://www.trustedfirmware.org/meetings/
We discussed fTPM last time with some actions (see notes at
http://bit.ly/loc-notes):
- Jan to get approval for sharing code using the new crypto API
We have an upcoming OP-TEE release, 4.3.0, July 12th.
Any other topics?
Cheers,
Jens
Hi,
This patch set introduces a new RPMB subsystem, based on patches from [1],
[2], and [3]. The RPMB subsystem aims at providing access to RPMB
partitions to other kernel drivers, in particular the OP-TEE driver. A new
user space ABI isn't needed, we can instead continue using the already
present ABI when writing the RPMB key during production.
I've added and removed things to keep only what is needed by the OP-TEE
driver. Since the posting of [3], there has been major changes in the MMC
subsystem so "mmc: block: register RPMB partition with the RPMB subsystem"
is in practice completely rewritten.
With this OP-TEE can access RPMB during early boot instead of having to
wait for user space to become available as in the current design [4].
This will benefit the efi variables [5] since we won't rely on userspace as
well as some TPM issues [6] that were solved.
The OP-TEE driver finds the correct RPMB device to interact with by
iterating over available devices until one is found with a programmed
authentication matching the one OP-TEE is using. This enables coexisting
users of other RPMBs since the owner can be determined by who knows the
authentication key.
The corresponding secure world OP-TEE patches are available at [7].
I've put myself as a maintainer for the RPMB subsystem as I have an
interest in the OP-TEE driver to keep this in good shape. However, if you'd
rather see someone else taking the maintainership that's fine too. I'll
help keep the subsystem updated regardless.
[1] https://lore.kernel.org/lkml/20230722014037.42647-1-shyamsaini@linux.micros…
[2] https://lore.kernel.org/lkml/20220405093759.1126835-2-alex.bennee@linaro.or…
[3] https://lore.kernel.org/linux-mmc/1478548394-8184-2-git-send-email-tomas.wi…
[4] https://optee.readthedocs.io/en/latest/architecture/secure_storage.html#rpm…
[5] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?…
[6] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?…
[7] https://github.com/jenswi-linaro/optee_os/tree/rpmb_probe_v7
Thanks,
Jens
Changes since v6:
* Add Tested-by: Manuel Traut <manut(a)mecka.net> provided for the v6
* Add a new patch "tee: add tee_device_set_dev_groups()" needed later in
the patch set
* Reintroduce the rpmb_class as requested by Greg, this affects the patches
"rpmb: add Replay Protected Memory Block (RPMB) subsystem" and
"optee: probe RPMB device using RPMB subsystem"
* "rpmb: add Replay Protected Memory Block (RPMB) subsystem":
- rpmb_interface_{,un}register() are now based on
class_interface_{,un}register()
- Embed a separate device in struct rpmb_dev for life cycle
management etc
* "optee: probe RPMB device using RPMB subsystem"
- Add an internal blocking_notifier to deal with the struct
class_interface callback
- Add a rpmb_routing_model variable in sysfs to help integration with
systemd, requested by Mikko Rapeli
- Add an RPMB probe capability flag in the ABI shared with the secure
world, both SMC and FF-A ABI, needed to support the rpmb_routing_model
variable
- optee_rpc_cmd() is strict whether an RPMB RPC request should be
forwarded to tee-supplicant or routed via the RPMB subsystem, depending
on the reported RPMB routing model
Changes since v5:
Manuel Traut reported and investigated an error on an i.MX8MM, the root
cause was identified as insufficient alignment on frames sent to the RPMB
device. Fixed in the OP-TEE driver as described below.
* "rpmb: add Replay Protected Memory Block (RPMB) subsystem"
- Adding a missing EXPORT_SYMBOL_GPL()
* "optee: probe RPMB device using RPMB subsystem"
- Replacing the old OPTEE_RPC_CMD_RPMB ABI with OPTEE_RPC_CMD_RPMB_FRAMES
to get rid of the small header struct rpmb_req (now removed) causing
the problem.
- Matching changes on the secure side + support for re-initializing
RPMB in case a boot stage has used RPMB, the latter also reported by
Manuel Traut.
Changes since v4:
* "rpmb: add Replay Protected Memory Block (RPMB) subsystem"
- Describing struct rpmb_descr as RPMB description instead of descriptor
* "mmc: block: register RPMB partition with the RPMB subsystem"
- Addressing review comments
- Adding more comments for struct rpmb_frame
- Fixing assignment of reliable_wr_count and capacity in mmc_blk_rpmb_add()
* "optee: probe RPMB device using RPMB subsystem"
- Updating struct rpmb_dev_info to match changes in "rpmb: add Replay
Protected Memory Block (RPMB) subsystem"
Changes since v3:
* Move struct rpmb_frame into the MMC driver since the format of the RPMB
frames depend on the implementation, one format for eMMC, another for
UFS, and so on
* "rpmb: add Replay Protected Memory Block (RPMB) subsystem"
- Adding Reviewed-by: Linus Walleij <linus.walleij(a)linaro.org>
- Adding more description of the API functions
- Removing the set_dev_info() op from struct rpmb_ops, the needed information
is supplied in the arguments to rpmb_dev_register() instead.
- Getting rid of struct rpmb_ops since only the route_frames() op was
remaining, store that op directly in struct rpmb_dev
- Changed rpmb_interface_register() and rpmb_interface_unregister() to use
notifier_block instead of implementing the same thing ourselves
* "mmc: block: register RPMB partition with the RPMB subsystem"
- Moving the call to rpmb_dev_register() to be done at the end of
mmc_blk_probe() when the device is fully available
* "optee: probe RPMB device using RPMB subsystem"
- Use IS_REACHABLE(CONFIG_RPMB) to determine if the RPMB subsystem is
available
- Translate TEE_ERROR_STORAGE_NOT_AVAILABLE if encountered in get_devices()
to recognize the error in optee_rpmb_scan()
- Simplified optee_rpmb_scan() and optee_rpmb_intf_rdev()
Changes since v2:
* "rpmb: add Replay Protected Memory Block (RPMB) subsystem"
- Fixing documentation issues
- Adding a "depends on MMC" in the Kconfig
- Removed the class-device and the embedded device, struct rpmb_dev now
relies on the parent device for reference counting as requested
- Removed the now unneeded rpmb_ops get_resources() and put_resources()
since references are already taken in mmc_blk_alloc_rpmb_part() before
rpmb_dev_register() is called
- Added rpmb_interface_{,un}register() now that
class_interface_{,un}register() can't be used ay longer
* "mmc: block: register RPMB partition with the RPMB subsystem"
- Adding the missing error cleanup in alloc_idata()
- Taking the needed reference to md->disk in mmc_blk_alloc_rpmb_part()
instead of in mmc_rpmb_chrdev_open() and rpmb_op_mmc_get_resources()
* "optee: probe RPMB device using RPMB subsystem"
- Registering to get a notification when an RPMB device comes online
- Probes for RPMB devices each time an RPMB device comes online, until
a usable device is found
- When a usable RPMB device is found, call
optee_enumerate_devices(PTA_CMD_GET_DEVICES_RPMB)
- Pass type of rpmb in return value from OPTEE_RPC_CMD_RPMB_PROBE_NEXT
Changes since Shyam's RFC:
* Removed the remaining leftover rpmb_cdev_*() function calls
* Refactored the struct rpmb_ops with all the previous ops replaced, in
some sense closer to [3] with the route_frames() op
* Added rpmb_route_frames()
* Added struct rpmb_frame, enum rpmb_op_result, and enum rpmb_type from [3]
* Removed all functions not needed in the OP-TEE use case
* Added "mmc: block: register RPMB partition with the RPMB subsystem", based
on the commit with the same name in [3]
* Added "optee: probe RPMB device using RPMB subsystem" for integration
with OP-TEE
* Moved the RPMB driver into drivers/misc/rpmb-core.c
* Added my name to MODULE_AUTHOR() in rpmb-core.c
* Added an rpmb_mutex to serialize access to the IDA
* Removed the target parameter from all rpmb_*() functions since it's
currently unused
Jens Wiklander (4):
rpmb: add Replay Protected Memory Block (RPMB) subsystem
mmc: block: register RPMB partition with the RPMB subsystem
tee: add tee_device_set_dev_groups()
optee: probe RPMB device using RPMB subsystem
Documentation/ABI/testing/sysfs-class-tee | 15 ++
MAINTAINERS | 8 +
drivers/misc/Kconfig | 10 +
drivers/misc/Makefile | 1 +
drivers/misc/rpmb-core.c | 232 +++++++++++++++++++++
drivers/mmc/core/block.c | 241 +++++++++++++++++++++-
drivers/tee/optee/core.c | 96 ++++++++-
drivers/tee/optee/device.c | 7 +
drivers/tee/optee/ffa_abi.c | 14 ++
drivers/tee/optee/optee_ffa.h | 2 +
drivers/tee/optee/optee_private.h | 26 ++-
drivers/tee/optee/optee_rpc_cmd.h | 35 ++++
drivers/tee/optee/optee_smc.h | 2 +
drivers/tee/optee/rpc.c | 177 ++++++++++++++++
drivers/tee/optee/smc_abi.c | 14 ++
drivers/tee/tee_core.c | 19 +-
include/linux/rpmb.h | 123 +++++++++++
include/linux/tee_drv.h | 12 ++
18 files changed, 1024 insertions(+), 10 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-class-tee
create mode 100644 drivers/misc/rpmb-core.c
create mode 100644 include/linux/rpmb.h
--
2.34.1