[PATCH RFC v3 0/9] tee: optee: add RPMI backend support on RISC-V
Amirreza Zarrabi
amirreza.zarrabi at oss.qualcomm.com
Mon Oct 12 22:41:27 PDT 2026
This series adds an RPMI backend to the OP-TEE driver for RISC-V.
It builds on the separately posted RPMI TEE transport series [1],
which provides service discovery, synchronous calls, memory parcels
and asynchronous signals.
This revision is effectively a full rewrite of the original RFC.
The generic RPMI transport has been separated from the OP-TEE backend,
and the backend has been reworked around the service bus and a new
OP-TEE control ABI.
Unlike v1, the OP-TEE backend no longer manages SBI MPXY mailbox
channels or implements RPMI TEE service-group operations directly.
It binds to the OP-TEE service UUID on the RPMI TEE bus and uses the
transport's public operations. No additional OP-TEE device-tree node
is required.
The backend reuses the common OP-TEE session, shared-memory, argument
cache, call queue and RPC infrastructure. Shared memory is represented
by RPMI parcel IDs and nonces. Yielding calls pass command and RPC
buffer ranges within a parcel and resume suspended execution using
an opaque token returned by OP-TEE.
The OP-TEE control ABI uses fixed-width little-endian messages carried
in TEE_CALL payloads rather than reproducing FF-A's register-based
message layout. Asynchronous notifications use an allocated TEE-to-REE
signal as a bottom-half doorbell, while ordinary logical notifications
continue through the common RPC path.
Matching OP-TEE OS support has been implemented locally. OpenSBI
integration and end-to-end validation remain pending. This remains an
RFC for review of the backend integration and Linux-to-OP-TEE protocol.
This series depends on:
- The RPMI TEE transport series [1].
- The OP-TEE notification bitmap fix, which allocates space for the
inclusive maximum notification key [2].
[1] https://lore.kernel.org/op-tee/20261007-riscv-rpmi-tee-abi-v2-0-45939a13d223@oss.qualcomm.com/
[2] https://lore.kernel.org/op-tee/20261009-fix-tee-max-keys-v1-1-1462d96bf438@oss.qualcomm.com/
Signed-off-by: Amirreza Zarrabi <amirreza.zarrabi at oss.qualcomm.com>
---
Changes in v3:
- Use GlobalPlatform TEE result codes for OP-TEE control responses,
keeping them separate from RPMI transport errors.
- Combine the parcel ID and nonce into a single 64-bit global_id.
- Make resume tokens opaque 32-bit values and track initial versus
resumed calls separately.
- Remove unnecessary __packed annotations from the OP-TEE ABI structures.
- Share the global-ID-to-SHM mapping implementation between the FF-A
and RPMI backends.
- Replace the fixed SHM nonce with a per-instance IDA allocator; reuse
nonces after successful reclamation.
- Report the maximum notification key instead of a notification count,
and use the negotiated maximum during initialization.
- Consume capability-exchange results during probe.
- Remove cleanup macros and use explicit resource-management paths.
- Use rc consistently for Linux error returns.
- Replace unnecessary unaligned accesses with endian conversions for
naturally aligned ABI fields.
- Link to v2: https://lore.kernel.org/r/20261005-rpmi-tee-service-grp-dev-v2-0-72f222e23ec1@oss.qualcomm.com
Changes in v2:
- Effectively rewrite the backend around the separately posted RPMI
TEE transport and a new OP-TEE control ABI.
- Remove backend-owned per-hart mailbox channels and the OP-TEE-specific
device-tree binding.
- Replace the register-like control payload with fixed-width messages,
explicit command/RPC buffer ranges and opaque resume tokens.
- Add a parcel-reference parameter layout carrying the parcel ID,
nonce, and 64-bit offset and size without changing parameter size.
- Make argument-offset support part of the baseline ABI and retain
the common shared argument cache.
- Use a transport-allocated signal for asynchronous bottom-half
notifications.
- Link to v1: https://lore.kernel.org/r/20260912-rpmi-tee-service-grp-dev-v1-0-1d1d35c2a859@oss.qualcomm.com
---
Amirreza Zarrabi (9):
tee: optee: share the global shared-memory ID mapping
tee: optee: allow RPMI transport builds on RISC-V
tee: optee: define the RPMI control and parcel-reference ABI
tee: optee: add RPMI shared-memory and parameter support
tee: optee: add RPMI dynamic shared-memory pool
tee: optee: add RPMI RPC handling
tee: optee: execute yielding RPMI calls
tee: optee: bind RPMI services and negotiate backend capabilities
tee: optee: support RPMI asynchronous notification doorbells
drivers/tee/Kconfig | 3 +-
drivers/tee/optee/Kconfig | 3 +-
drivers/tee/optee/Makefile | 2 +
drivers/tee/optee/call.c | 2 +
drivers/tee/optee/core.c | 10 +-
drivers/tee/optee/ffa_abi.c | 133 +----
drivers/tee/optee/optee_msg.h | 23 +-
drivers/tee/optee/optee_private.h | 73 ++-
drivers/tee/optee/optee_rpmi.h | 263 ++++++++++
drivers/tee/optee/rpmi_abi.c | 972 +++++++++++++++++++++++++++++++++++++
drivers/tee/optee/shm_handle_map.c | 138 ++++++
11 files changed, 1498 insertions(+), 124 deletions(-)
---
base-commit: bf1ee2bd5c2da8992f33c8950ef194aaff74ed6c
change-id: 20260912-rpmi-tee-service-grp-dev-b2ce2f63e0df
Best regards,
--
Amirreza Zarrabi <amirreza.zarrabi at oss.qualcomm.com>
More information about the linux-riscv
mailing list