This series introduces a TEE driver for Trusted Services [1].
Trusted Services is a TrustedFirmware.org project that provides a
framework for developing and deploying device Root of Trust services in
FF-A [2] Secure Partitions. The project hosts the reference
implementation of Arm Platform Security Architecture [3] for Arm
A-profile devices.
The FF-A Secure Partitions are accessible through the FF-A driver in
Linux. However, the FF-A driver doesn't have a user space interface so
user space clients currently cannot access Trusted Services. The goal of
this TEE driver is to bridge this gap and make Trusted Services
functionality accessible from user space.
Changelog:
v1[5] -> v2:
- Refactor session handling to use XArray instead of IDR and linked
list (the linked list was redundant as pointed out by Jens, and IDR
is now deprecated in favor of XArray)
- Refactor tstee_probe() to not call tee_device_unregister() before
calling tee_device_register()
- Address comments from Krzysztof and Jens
- Address documentation comments from Randy
- Use module_ffa_driver() macro instead of separate module init / exit
functions
- Reformat max line length 100 -> 80
RFC[4] -> v1:
- Add patch for moving pool_op helper functions to the TEE subsystem,
as suggested by Jens
- Address comments from Sumit, add patch for documentation
[1] https://www.trustedfirmware.org/projects/trusted-services/
[2] https://developer.arm.com/documentation/den0077/
[3] https://www.arm.com/architecture/security-features/platform-security
[4] https://lore.kernel.org/linux-arm-kernel/20230927152145.111777-1-balint.dob…
[5] https://lore.kernel.org/lkml/20240213145239.379875-1-balint.dobszay@arm.com/
Balint Dobszay (3):
tee: optee: Move pool_op helper functions
tee: tstee: Add Trusted Services TEE driver
Documentation: tee: Add TS-TEE driver
Documentation/tee/index.rst | 1 +
Documentation/tee/ts-tee.rst | 71 +++++
drivers/tee/Kconfig | 1 +
drivers/tee/Makefile | 1 +
drivers/tee/optee/core.c | 64 ----
drivers/tee/optee/ffa_abi.c | 6 +-
drivers/tee/optee/optee_private.h | 12 -
drivers/tee/optee/smc_abi.c | 11 +-
drivers/tee/tee_shm.c | 65 ++++
drivers/tee/tstee/Kconfig | 11 +
drivers/tee/tstee/Makefile | 3 +
drivers/tee/tstee/core.c | 490 ++++++++++++++++++++++++++++++
drivers/tee/tstee/tstee_private.h | 94 ++++++
include/linux/tee_drv.h | 11 +
include/uapi/linux/tee.h | 1 +
15 files changed, 758 insertions(+), 84 deletions(-)
create mode 100644 Documentation/tee/ts-tee.rst
create mode 100644 drivers/tee/tstee/Kconfig
create mode 100644 drivers/tee/tstee/Makefile
create mode 100644 drivers/tee/tstee/core.c
create mode 100644 drivers/tee/tstee/tstee_private.h
--
2.34.1
Hello arm-soc maitainers,
Please pull this small patch making tee_bus_type const.
Thanks,
Jens
The following changes since commit 41bccc98fb7931d63d03f326a746ac4d429c1dd3:
Linux 6.8-rc2 (2024-01-28 17:01:12 -0800)
are available in the Git repository at:
https://git.linaro.org/people/jens.wiklander/linux-tee.git/ tags/tee-bus-type-for-v6.9
for you to fetch changes up to 1d044941d53855ca06e4fa34936ff7273c8641dd:
tee: make tee_bus_type const (2024-02-15 08:28:24 +0100)
----------------------------------------------------------------
tee: make tee_bus_type const
----------------------------------------------------------------
Ricardo B. Marliere (1):
tee: make tee_bus_type const
drivers/tee/tee_core.c | 2 +-
include/linux/tee_drv.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Hello arm-soc maintainers,
Please pull this small fix for a panic in the OP-TEE driver that can occur
in the error path when registering devices on the TEE bus.
Thanks,
Jens
The following changes since commit 41bccc98fb7931d63d03f326a746ac4d429c1dd3:
Linux 6.8-rc2 (2024-01-28 17:01:12 -0800)
are available in the Git repository at:
https://git.linaro.org/people/jens.wiklander/linux-tee.git tags/optee-fix-for-v6.8
for you to fetch changes up to 95915ba4b987cf2b222b0f251280228a1ff977ac:
tee: optee: Fix kernel panic caused by incorrect error handling (2024-03-04 09:49:03 +0100)
----------------------------------------------------------------
Fix kernel panic in OP-TEE driver
----------------------------------------------------------------
Sumit Garg (1):
tee: optee: Fix kernel panic caused by incorrect error handling
drivers/tee/optee/device.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Updates from the previous version [1]:
This version proposes another approach based on an alternate load and boot
of the coprocessor. Therefore, the constraint introduced by tee_remoteproc
is that the firmware has to be authenticated and loaded before the resource
table can be obtained.
The existing boot sequence is:
1) Get the resource table and store it in a cache,
calling rproc->ops->parse_fw().
2) Parse the resource table and handle resources,
calling rproc_handle_resources.
3) Load the firmware, calling rproc->ops->load().
4) Start the firmware, calling rproc->ops->start().
=> Steps 1 and 2 are executed in rproc_fw_boot(), while steps 3 and 4 are
executed in rproc_start().
=> the use of rproc->ops->load() ops is mandatory
The boot sequence needed for TEE boot is:
1) Load the firmware.
2) Get the loaded resource, no cache.
3) Parse the resource table and handle resources.
4) Start the firmware.
Then the crash recovery also has to be managed.For recovery, the cache is
used to temporarily save the resource table and then reapply it on
restart:
1) Stop the remote processor, calling rproc->ops->stop().
2) Load the firmware, calling rproc->ops->load().
3) Copy cached resource table.
4) Start the remote processor, calling rproc->ops->start().
=> This sequence is also needed when TEE manages the boot of the remote
processor.
=> The rproc->ops->load() is also used in recovery sequence.
Based on the sequences described above, the proposal is to:
- Rework tee_rproc API to better match the rproc_ops structure.
This allows to simply map the function to implement the load ops, which
is not optional. The tee_rproc_load_fw() is updated in consequence.
- Remove the call of rproc_load_segments from rproc_start() to dissociate
the load and the start. This is necessary to implement the boot sequence
requested for the TEE remote proc support.
- Introduce an rproc_alt_fw_boot() function that is an alternative boot
sequence, which implements the sequence requested for the TEE remoteproc
support.
[1] https://lore.kernel.org/lkml/20240118100433.3984196-1-arnaud.pouliquen@foss…
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 (7):
remoteproc: Add TEE support
remoteproc: Extract the firmware load from the start
remoteproc: core: Add check on cached_table pointer
remoteproc: core: Implement the support of an alternative boot
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 | 51 ++-
drivers/remoteproc/Kconfig | 9 +
drivers/remoteproc/Makefile | 1 +
drivers/remoteproc/remoteproc_core.c | 109 ++++-
drivers/remoteproc/stm32_rproc.c | 169 ++++++--
drivers/remoteproc/tee_remoteproc.c | 397 ++++++++++++++++++
include/linux/remoteproc.h | 2 +
include/linux/tee_remoteproc.h | 102 +++++
8 files changed, 784 insertions(+), 56 deletions(-)
create mode 100644 drivers/remoteproc/tee_remoteproc.c
create mode 100644 include/linux/tee_remoteproc.h
--
2.25.1
Hi,
Tomorrow, Tuesday, February 27 it's time for another LOC monthly meeting. For
time and connection details see the calendar at
https://www.trustedfirmware.org/meetings/
Moving the RPMB part of tee-supplicant processing into the kernel is
making progress. The last patchset [1] got some constructive feedback
and I'm preparing a new version based on that.
[1] https://lore.kernel.org/lkml/20240131174347.510961-1-jens.wiklander@linaro.…
Any other topics?
Thanks,
Jens
This series introduces a TEE driver for Trusted Services [1].
Trusted Services is a TrustedFirmware.org project that provides a
framework for developing and deploying device Root of Trust services in
FF-A [2] Secure Partitions. The project hosts the reference
implementation of Arm Platform Security Architecture [3] for Arm
A-profile devices.
The FF-A Secure Partitions are accessible through the FF-A driver in
Linux. However, the FF-A driver doesn't have a user space interface so
user space clients currently cannot access Trusted Services. The goal of
this TEE driver is to bridge this gap and make Trusted Services
functionality accessible from user space.
Changelog:
RFC[4] -> v1:
- Add patch for moving pool_op helper functions to the TEE subsystem,
as suggested by Jens
- Address comments from Sumit, add patch for documentation
[1] https://www.trustedfirmware.org/projects/trusted-services/
[2] https://developer.arm.com/documentation/den0077/
[3] https://www.arm.com/architecture/security-features/platform-security
[4] https://lore.kernel.org/linux-arm-kernel/20230927152145.111777-1-balint.dob…
Balint Dobszay (3):
tee: optee: Move pool_op helper functions
tee: tstee: Add Trusted Services TEE driver
Documentation: tee: Add TS-TEE driver
Documentation/tee/index.rst | 1 +
Documentation/tee/ts-tee.rst | 70 +++++
drivers/tee/Kconfig | 1 +
drivers/tee/Makefile | 1 +
drivers/tee/optee/core.c | 64 ----
drivers/tee/optee/ffa_abi.c | 6 +-
drivers/tee/optee/optee_private.h | 12 -
drivers/tee/optee/smc_abi.c | 10 +-
drivers/tee/tee_shm.c | 65 ++++
drivers/tee/tstee/Kconfig | 11 +
drivers/tee/tstee/Makefile | 3 +
drivers/tee/tstee/core.c | 501 ++++++++++++++++++++++++++++++
drivers/tee/tstee/tstee_private.h | 92 ++++++
include/linux/tee_drv.h | 11 +
include/uapi/linux/tee.h | 1 +
15 files changed, 765 insertions(+), 84 deletions(-)
create mode 100644 Documentation/tee/ts-tee.rst
create mode 100644 drivers/tee/tstee/Kconfig
create mode 100644 drivers/tee/tstee/Makefile
create mode 100644 drivers/tee/tstee/core.c
create mode 100644 drivers/tee/tstee/tstee_private.h
--
2.34.1
Hello,
The driver code I'm working on hard-codes
#define TEE_SMC_FAST_CALL_VAL(func_num) \
ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, ARM_SMCCC_SMC_32, \
ARM_SMCCC_OWNER_TRUSTED_OS, (func_num))
#define TEE_SMC_FUNCID_CALLS_UID 0xFF01
#define TEE_SMC_CALLS_UID \
ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, ARM_SMCCC_SMC_32, \
ARM_SMCCC_OWNER_TRUSTED_OS_END, \
TEE_SMC_FUNCID_CALLS_UID)
arm_smccc_smc(TEE_SMC_CALLS_UID,
0, 0, 0/*is_swap*/, 0, 0, 0, 0, &res);
dev_err(dev, "TEE UID %x %x %x %x\n", res.a0, res.a1, res.a2, res.a3);
but it seems I would be required to somehow use
OPTEE_SMC_CALL_GET_OS_UUID
But it's not exported, and no code seems to use it...?
$ git grep OPTEE_SMC_CALL_GET_OS_UUID
Documentation/tee/op-tee.rst:- OPTEE_SMC_CALL_GET_OS_UUID returns the particular OP-TEE implementation, used
drivers/tee/optee/optee_smc.h:#define OPTEE_SMC_CALL_GET_OS_UUID \
How do I make calls to OP-TEE from driver code?
Regards,
Marc Gonzalez
On Sun, Feb 18, 2024 at 12:24 PM murali selvaraj <
muraliselvaraj2020(a)gmail.com> wrote:
> Hi Team,
>
> We would like to know the support of OP-TEE support for RPI4.
> If we have the support, can you please share the details.
>
> Thankx
> Murali.S
>