This RFC adds initial support for communicating with OP-TEE on RISC-V using the RPMI TEE service group [1] over the SBI MPXY [2] mailbox framework.
The intention is to provide a transport for RISC-V systems similar in purpose to the FF-A transport currently used by OP-TEE on Arm systems. Linux and OP-TEE act as endpoints of the RPMI TEE service group, while the RPMI framework in machine-mode firmware mediates communication between them.
The implementation closely follows the existing OP-TEE FF-A backend in drivers/tee/optee/ffa_abi.c. Where possible, the same overall design and lifetime rules are preserved, with FF-A operations mapped to equivalent RPMI TEE services.
For shared memory, FF-A memory handles are replaced by RPMI memory parcel identifiers. Linux creates an RPMI memory parcel for shared memory and makes OP-TEE a receiver of that parcel. The parcel identifier is then used in OP-TEE message parameters in a similar way to the FF-A global memory handle.
RPMI TEE_CALL is used as the entry mechanism into OP-TEE, serving a role similar to the FF-A direct-message path. The request and response contain a small register-like payload carrying the OP-TEE call information and state required to resume yielding calls. The existing OP-TEE call queue, RPC handling and shared-memory infrastructure are reused as much as possible.
The transport uses one SBI MPXY mailbox channel per hart. A TEE call is issued using the channel corresponding to the CPU on which the call is running. This preserves the execution model where entering OP-TEE on a hart results in secure-world execution associated with that hart.
Shared memory is implemented using RPMI TEE memory parcels. The driver maintains a mapping between parcel identifiers and struct tee_shm objects and uses parcel create and reclaim operations to manage the lifetime of memory shared with OP-TEE.
Asynchronous notifications are implemented using the RPMI TEE signal bus. The RPMI TEE service group does not provide framework notification events corresponding directly to the OP-TEE asynchronous notification mechanism, so the signal bus is used to carry notification values from OP-TEE to Linux.
This is an early RFC and the implementation is not complete. There may still be functional bugs, incorrect assumptions, missing pieces, or interfaces that need to change.
The series is being posted at this stage primarily to get feedback on the overall architecture and on how the OP-TEE ABI is mapped onto the RPMI TEE service group.
The implementation deliberately follows the FF-A backend and ffa_abi.c closely. This allows the existing OP-TEE driver design to be reused and keeps the RISC-V and FF-A transports as consistent as possible. Some of these abstractions may need to be adjusted where the RPMI execution, notification, or memory model differs from FF-A, while others may eventually be shared between the transports.
[1] https://github.com/riscv-non-isa/riscv-rpmi/commits/main/src/srvgrp-tee.adoc [2] https://github.com/riscv-non-isa/riscv-sbi-doc/releases
Signed-off-by: Amirreza Zarrabi amirreza.zarrabi@oss.qualcomm.com --- Amirreza Zarrabi (5): optee: riscv: add RPMI TEE service group transport optee: riscv: add shared memory and scheduled calls optee: riscv: enable persistent shared argument cache optee: riscv: add asynchronous notifications over the signal bus dt-bindings: tee: add RISC-V RPMI TEE transport
.../bindings/tee/riscv,rpmi-mpxy-tee.yaml | 65 + MAINTAINERS | 1 + drivers/tee/optee/Makefile | 1 + drivers/tee/optee/core.c | 8 +- drivers/tee/optee/optee_private.h | 47 + drivers/tee/optee/optee_riscv.c | 1621 ++++++++++++++++++++ drivers/tee/optee/optee_riscv.h | 334 ++++ include/linux/mailbox/riscv-rpmi-message.h | 1 + 8 files changed, 2076 insertions(+), 2 deletions(-) --- base-commit: 68142f986ff04b2b70b31db00f719bf690f64a9a change-id: 20260912-rpmi-tee-service-grp-dev-b2ce2f63e0df
Best regards,