OP-TEE update for v7.4
Hello soc maintainers,
Please pull this patch to only build the SMC and FF-A code where supported. The OP-TEE driver is still only built for Arm, but that will change in a not too distant future.
Thanks,
Jens
The following changes since commit 8d3ae59288f1e7d58d76558a6ee96d533bc5019f:
Linux 7.2 (2026-08-16 14:32:26 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jenswi/linux-tee.git tags/optee-for-v7.4
for you to fetch changes up to ccd4b23398acaf2139cf04f1ba0a66150cbf2663:
tee: optee: build the Arm-specific code only on Arm (2026-10-02 16:28:41 +0200)
----------------------------------------------------------------
Build the OP-TEE driver's SMC and FF-A code only where supported
----------------------------------------------------------------
Marouene Boubakri (1):
tee: optee: build the Arm-specific code only on Arm
drivers/tee/optee/Kconfig | 1 + drivers/tee/optee/Makefile | 4 ++-- drivers/tee/optee/ffa_abi.c | 8 ++------ drivers/tee/optee/notif.c | 1 - drivers/tee/optee/optee_private.h | 39 ++++++++++++++++++++++++++++++++++++++- 5 files changed, 43 insertions(+), 10 deletions(-)
Quoted 11 lines · Jens Wiklander
for you to fetch changes up to
ccd4b23398acaf2139cf04f1ba0a66150cbf2663:tee: optee: build the Arm-specific code only on Arm (2026-10-02
16:28:41 +0200)----------------------------------------------------------------
Build the OP-TEE driver's SMC and FF-A code only where supported----------------------------------------------------------------
Marouene Boubakri (1):
tee: optee: build the Arm-specific code only on Arm
I had a look at the contents and saw that it keeps the IS_REACHABLE() checks that are notoriously error-prone. E.g. this part just looks broken:
@@ -257,8 +266,12 @@ struct optee {
const struct optee_ops *ops;
struct tee_context *ctx;
union {
+#ifdef CONFIG_HAVE_ARM_SMCCC
struct optee_smc smc;
+#endif
+#if IS_REACHABLE(CONFIG_ARM_FFA_TRANSPORT)
struct optee_ffa ffa;
+#endif
};
struct optee_shm_arg_cache shm_arg_cache;
struct optee_call_queue call_queue;The presence of the 'ffa' member in the union is conditional on whether the driver that includes the header is a loadable module or built-in, and this changes the entire structure layout if both types of users are present.
The intention of the patch does make a lot of sense, but as far as I can tell, only the Kconfig change is actually required, while the added preprocessor checks only make it harder to read and it should have been sufficient to change the existing IS_REACHABLE() to IS_ENABLED() for consistency.
Sorry I did not notice this one earlier as I was travelling, but I think I can't pull this version, please respin.
Arnd
Hi Arnd,
Quoted 44 lines · Arnd Bergmann
Quoted 11 lines · Jens Wiklander
for you to fetch changes up to
ccd4b23398acaf2139cf04f1ba0a66150cbf2663:tee: optee: build the Arm-specific code only on Arm (2026-10-02
16:28:41 +0200)----------------------------------------------------------------
Build the OP-TEE driver's SMC and FF-A code only where supported----------------------------------------------------------------
Marouene Boubakri (1):
tee: optee: build the Arm-specific code only on ArmI had a look at the contents and saw that it keeps the
IS_REACHABLE()checks that are notoriously error-prone. E.g. this part just looks broken:(quoted diff) +4
-0@@ -257,8 +266,12 @@ struct optee { const struct optee_ops *ops; struct tee_context *ctx; union { +#ifdef CONFIG_HAVE_ARM_SMCCC struct optee_smc smc; +#endif +#if IS_REACHABLE(CONFIG_ARM_FFA_TRANSPORT) struct optee_ffa ffa; +#endif }; struct optee_shm_arg_cache shm_arg_cache; struct optee_call_queue call_queue;The presence of the 'ffa' member in the union is conditional on whether the driver that includes the header is a loadable module or built-in, and this changes the entire structure layout if both types of users are present.
The intention of the patch does make a lot of sense, but as far as I can tell, only the
Kconfigchange is actually required, while the added preprocessor checks only make it harder to read and it should have been sufficient to change the existingIS_REACHABLE()toIS_ENABLED()for consistency.
Quoted 2 lines
Sorry I did not notice this one earlier as I was travelling, but I think I can't pull this version, please respin.
Thanks for catching this. We'll repin.
Cheers,
Jens
Hi Marouene,
Can you make a v5 of "[PATCH v4] tee: optee: build the Arm-specific code only on Arm" addressing Arnd's comments, please? That is, replacing IS_REACHABLE() with IS_ENABLED() in the patch. As Arnd points out, with OPTEE depending on ARM_FFA_TRANSPORT || !ARM_FFA_TRANSPORT, the code is always reachable if enabled.
Thanks,
Jens
Quoted 55 lines · Jens Wiklander
Hi Arnd,
Quoted 44 lines · Arnd Bergmann
Quoted 11 lines · Jens Wiklander
for you to fetch changes up to
ccd4b23398acaf2139cf04f1ba0a66150cbf2663:tee: optee: build the Arm-specific code only on Arm (2026-10-02
16:28:41 +0200)----------------------------------------------------------------
Build the OP-TEE driver's SMC and FF-A code only where supported----------------------------------------------------------------
Marouene Boubakri (1):
tee: optee: build the Arm-specific code only on ArmI had a look at the contents and saw that it keeps the
IS_REACHABLE()checks that are notoriously error-prone. E.g. this part just looks broken:(quoted diff) +4
-0@@ -257,8 +266,12 @@ struct optee { const struct optee_ops *ops; struct tee_context *ctx; union { +#ifdef CONFIG_HAVE_ARM_SMCCC struct optee_smc smc; +#endif +#if IS_REACHABLE(CONFIG_ARM_FFA_TRANSPORT) struct optee_ffa ffa; +#endif }; struct optee_shm_arg_cache shm_arg_cache; struct optee_call_queue call_queue;The presence of the 'ffa' member in the union is conditional on whether the driver that includes the header is a loadable module or built-in, and this changes the entire structure layout if both types of users are present.
The intention of the patch does make a lot of sense, but as far as I can tell, only the
Kconfigchange is actually required, while the added preprocessor checks only make it harder to read and it should have been sufficient to change the existingIS_REACHABLE()toIS_ENABLED()for consistency.Quoted 2 lines
Sorry I did not notice this one earlier as I was travelling, but I think I can't pull this version, please respin.
Thanks for catching this. We'll repin.
Cheers,
Jens
Hi Jens,
NXP Confidential
Quoted 5 lines · On Tue, Nov 3, 2026 Jens Wiklander wrote:
Can you make a v5 of "[PATCH v4] tee: optee: build the Arm-specific code only on Arm" addressing Arnd's comments, please? That is, replacing
IS_REACHABLE()withIS_ENABLED()in the patch. As Arnd points out, with OPTEE depending onARM_FFA_TRANSPORT|| !ARM_FFA_TRANSPORT, the code is always reachable if enabled.
Sure, I just sent v here https://lore.kernel.org/all/[email protected]/which replaces IS_REACHABLE(CONFIG_ARM_FFA_TRANSPORT) with IS_ENABLED(CONFIG_ARM_FFA_TRANSPORT) in optee_private.h, so the
layout of struct optee no longer depends on whether the includer is
built-in or modular. The rest of the patch is unchanged from v4.
Arnd, thanks for catching this, and sorry for the noise.
Thanks,
Marouene
-----Original Message-----
From: Jens Wiklander <[email protected]>
Sent: Tuesday, November 3, 2026 4:24 PM
To: Marouene Boubakri (OSS) <[email protected]>
Cc: arm <[email protected]>; [email protected]; [email protected]; [email protected]; Arnd Bergmann <[email protected]>
Subject: Re: [GIT PULL] OP-TEE update for v7.4
Hi Marouene,
Can you make a v5 of "[PATCH v4] tee: optee: build the Arm-specific code only on Arm" addressing Arnd's comments, please? That is, replacing IS_REACHABLE() with IS_ENABLED() in the patch. As Arnd points out, with OPTEE depending on ARM_FFA_TRANSPORT || !ARM_FFA_TRANSPORT, the code is always reachable if enabled.
Thanks,
Jens
Quoted 54 lines · Jens Wiklander
Hi Arnd,
Quoted 37 lines · Arnd Bergmann
Quoted 11 lines · Jens Wiklander
for you to fetch changes up to
ccd4b23398acaf2139cf04f1ba0a66150cbf2663:tee: optee: build the Arm-specific code only on Arm (2026-10-02
16:28:41 +0200)----------------------------------------------------------------
Build the OP-TEE driver's SMC and FF-A code only where supported----------------------------------------------------------------
Marouene Boubakri (1):
tee: optee: build the Arm-specific code only on ArmI had a look at the contents and saw that it keeps the
IS_REACHABLE()checks that are notoriously error-prone. E.g. this part just looks broken:(quoted diff) +4
-0@@ -257,8 +266,12 @@ struct optee { const struct optee_ops *ops; struct tee_context *ctx; union { +#ifdef CONFIG_HAVE_ARM_SMCCC struct optee_smc smc; +#endif +#if IS_REACHABLE(CONFIG_ARM_FFA_TRANSPORT) struct optee_ffa ffa; +#endif }; struct optee_shm_arg_cache shm_arg_cache; struct optee_call_queue call_queue;The presence of the 'ffa' member in the union is conditional on whether the driver that includes the header is a loadable module or built-in, and this changes the entire structure layout if both types of users are present.
Quoted 8 lines
The intention of the patch does make a lot of sense, but as far as I can tell, only the
Kconfigchange is actually required, while the added preprocessor checks only make it harder to read and it should have been sufficient to change the existingIS_REACHABLE()toIS_ENABLED()for consistency.Sorry I did not notice this one earlier as I was travelling, but I think I can't pull this version, please respin.
Thanks for catching this. We'll repin.
Cheers,
Jens