Calling OPTEE_SMC_CALL_GET_OS_UUID from driver code

Sumit Garg sumit.garg at linaro.org
Tue Feb 20 23:40:28 PST 2024


Hi Marc,

On Tue, 20 Feb 2024 at 22:59, Marc Gonzalez <mgonzalez at freebox.fr> wrote:
>
> 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...?
>

Can you describe your use-case to require direct
OPTEE_SMC_CALL_GET_OS_UUID invocation?

> $ 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?

The TEE driver API documentation is here [1] and you can refer to the
existing OP-TEE RNG driver here for reference.

[1] https://docs.kernel.org/driver-api/tee.html
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/char/hw_random/optee-rng.c

-Sumit



More information about the linux-arm-kernel mailing list