On 1/9/26 11:24, Sumit Garg wrote:
On Thu, Jan 08, 2026 at 05:19:32PM +0100, [email protected] wrote:
On 12/29/25 12:43, Sumit Garg wrote:
From: Sumit Garg <[email protected]>

Add support for OP-TEE live tree DT fixup support which enables U-Boot
OP-TEE driver to be probed. As well as the EFI DT fixup protocol allows
the live tree fixup to be carried over to the OS for the OP-TEE driver
in the OS to probe as well.

Note that this fixup only gets applied if CONFIG_OPTEE gets enabled.

Can't the presence of OP-TEE be detected dynamically via scm calls ?

SCM calls aren't present in case of TF-A/OP-TEE flow.

exact, but SMC calls are.

first thing optee driver does is calling OPTEE_SMC_CALLS_UID:

-> optee_probe()
-> is_optee_api()

Please investigate how this SMC would behave when QSEECOM or QTEE none are
present.

SMC calls are mandatory to be implemented for PSCI, so they should simply
return an error.

Neil


-Sumit


Thanks,
Neil


Signed-off-by: Sumit Garg <[email protected]>
---
   arch/arm/mach-snapdragon/of_fixup.c | 34 +++++++++++++++++++++++++++++
   1 file changed, 34 insertions(+)

diff --git a/arch/arm/mach-snapdragon/of_fixup.c 
b/arch/arm/mach-snapdragon/of_fixup.c
index eec2c0c757e..29a99f73cf3 100644
--- a/arch/arm/mach-snapdragon/of_fixup.c
+++ b/arch/arm/mach-snapdragon/of_fixup.c
@@ -146,6 +146,37 @@ static void fixup_power_domains(struct device_node *root)
        }
   }
+static void add_optee_node(struct device_node *root)
+{
+       struct device_node *fw = NULL, *optee = NULL;
+       int ret;
+
+       fw = of_find_node_by_path("/firmware");
+       if (!fw) {
+               log_err("Failed to find /firmware node\n");
+               return;
+       }
+
+       ret = of_add_subnode(fw, "optee", strlen("optee") + 1, &optee);
+       if (ret) {
+               log_err("Failed to add 'maximum-speed' property: %d\n", ret);
+               return;
+       }
+
+       ret = of_write_prop(optee, "compatible", strlen("linaro,optee-tz") + 1,
+                           "linaro,optee-tz");
+       if (ret) {
+               log_err("Failed to optee 'compatible' property: %d\n", ret);
+               return;
+       }
+
+       ret = of_write_prop(optee, "method", strlen("smc") + 1, "smc");
+       if (ret) {
+               log_err("Failed to optee 'method' property: %d\n", ret);
+               return;
+       }
+}
+
   #define time_call(func, ...) \
        do { \
                u64 start = timer_get_us(); \
@@ -160,6 +191,9 @@ static int qcom_of_fixup_nodes(void * __maybe_unused ctx, 
struct event *event)
        time_call(fixup_usb_nodes, root);
        time_call(fixup_power_domains, root);
+       if (IS_ENABLED(CONFIG_OPTEE))
+               time_call(add_optee_node, root);
+
        return 0;
   }


Reply via email to