Skip to content

Commit 3a701ec

Browse files
committed
tee: optee: report OP-TEE revision information
When the driver initializes, report the following information about the OP-TEE OS: - major and minor version, - build identifier (if available). Signed-off-by: Jerome Forissier <[email protected]>
1 parent eae92bd commit 3a701ec

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

drivers/tee/optee/core.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,27 @@ static bool optee_msg_api_uid_is_optee_api(optee_invoke_fn *invoke_fn)
357357
return false;
358358
}
359359

360+
static void optee_msg_get_os_revision(optee_invoke_fn *invoke_fn)
361+
{
362+
union {
363+
struct arm_smccc_res smccc;
364+
struct optee_smc_call_get_os_revision_result result;
365+
} res = {
366+
.result = {
367+
.build_id = 0
368+
}
369+
};
370+
371+
invoke_fn(OPTEE_SMC_CALL_GET_OS_REVISION, 0, 0, 0, 0, 0, 0, 0,
372+
&res.smccc);
373+
374+
if (res.result.build_id)
375+
pr_info("revision %lu.%lu (%08lx)", res.result.major,
376+
res.result.minor, res.result.build_id);
377+
else
378+
pr_info("revision %lu.%lu", res.result.major, res.result.minor);
379+
}
380+
360381
static bool optee_msg_api_revision_is_compatible(optee_invoke_fn *invoke_fn)
361382
{
362383
union {
@@ -548,6 +569,8 @@ static struct optee *optee_probe(struct device_node *np)
548569
return ERR_PTR(-EINVAL);
549570
}
550571

572+
optee_msg_get_os_revision(invoke_fn);
573+
551574
if (!optee_msg_api_revision_is_compatible(invoke_fn)) {
552575
pr_warn("api revision mismatch\n");
553576
return ERR_PTR(-EINVAL);

0 commit comments

Comments
 (0)