[PATCH RFC v2 7/8] tee: optee: bind RPMI services and negotiate backend capabilities
Jens Wiklander
jens.wiklander at oss.qualcomm.com
Fri Oct 9 07:43:17 PDT 2026
Hi Amir,
On Fri, Oct 9, 2026 at 1:10 AM Amirreza Zarrabi
<amirreza.zarrabi at oss.qualcomm.com> wrote:
>
> Hi jens,
>
> On 10/8/2026 7:20 PM, Jens Wiklander wrote:
> > Hi Amir,
> >
> > On Tue, Oct 6, 2026 at 2:40 AM Amirreza Zarrabi
> > <amirreza.zarrabi at oss.qualcomm.com> wrote:
> >>
> >> Register an RPMI service driver matching the OP-TEE service UUID and
> >> integrate it with OP-TEE module initialization and removal.
> >>
> >> Check the service API version, query the trusted OS revision, and
> >> obtain the RPC parameter and logical notification counts. Initialize
> >> shared-memory tracking, the call queue, supplicant state and internal
> >> context before publishing the client and supplicant TEE devices.
> >>
> >> Connect the RPMI backend to the common OP-TEE operations and enumerate
> >> trusted application devices. Enable in-kernel RPMB routing when the
> >> RPMB subsystem is reachable.
> >>
> >> Add removal and probe failure cleanup for the backend resources.
> >>
> >> Signed-off-by: Amirreza Zarrabi <amirreza.zarrabi at oss.qualcomm.com>
> >> ---
[snip]
> >> +
> >> +/* Query and store secure-world capabilities and buffer limits. */
> >> +static int optee_rpmi_exchange_caps(struct optee *optee)
> >> +{
> >> + struct optee_rpmi_probe_req req = {
> >> + .op = cpu_to_le32(OPTEE_RPMI_EXCHANGE_CAPABILITIES),
> >> + };
> >> + struct optee_rpmi_caps_resp caps;
> >> + u32 rpc_count, sec_caps, notif_count;
> >> + int ret;
> >> +
> >> + ret = optee_rpmi_call(optee, &req, sizeof(req), &caps, sizeof(caps));
> >> + if (ret)
> >> + return ret;
> >> +
> >> + sec_caps = get_unaligned_le32(&caps.secure_caps);
> >> + rpc_count = get_unaligned_le32(&caps.rpc_param_count);
> >> + notif_count = get_unaligned_le32(&caps.notification_count);
> >> + if (!notif_count || !rpc_count)
> >> + return -EPROTO;
> >> +
> >> + optee->rpc_param_count = rpc_count;
> >> + optee->rpmi.sec_caps = sec_caps;
> >> + optee->rpmi.notification_count = notif_count;
> >> + optee->in_kernel_rpmb_routing = IS_REACHABLE(CONFIG_RPMB);
> >
> > What if OP-TEE is built without RPMB support?
> >
>
> I discussed this with Sumit, and the intention was to make RPMB probing
> part of the baseline for the new ABI rather than negotiate it separately.
> I can enable the capability bit if it should remain optional.
You have a point. Let's keep it, but we may want to move the
assignment down into optee_rpmi_probe(), as the other probe functions
have it.
Cheers,
Jens
More information about the linux-riscv
mailing list