Skip to contentSkip to conversation

optee: Add support for enumerating RPMB-dependent services

PATCH Superseded Jan Kiszka 4 participants 24 messages Aug 23 – Sep 8

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

v2 cover optee: Add support for enumerating RPMB-dependent services

This allows to find firmware TPM again with recent OP-TEE versions, possibly also other services. The StMM service was not affected because it is directly invoked by efi_variable_tee when needed, and that is late enough so that all dependencies are available by then.

See patches for further details.

Changes in v2:
- fix build breakages with disabled CONFIGs
- structure code differently between optee core and rpmb
- debug() -> dev_dbg()

Jan

Jan Kiszka (5):
tee: optee: Factor out service enumeration and binding functions
tee: optee: Add support for enumerating services that only need RPMB
tee: optee: Do not warn about TEE_ERROR_STORAGE_NOT_AVAILABLE
mmc: Call back to optee after a successful mmc_init
mmc: Make "MMC Device not found" a debug output

 drivers/mmc/mmc-uclass.c          |  2 +-
 drivers/mmc/mmc.c                 |  4 +++
 drivers/mmc/mmc_legacy.c          |  2 +-
 drivers/tee/optee/core.c          | 58 +++++++++++++++----------------
 drivers/tee/optee/optee_private.h | 24 +++++++++++++
 drivers/tee/optee/rpmb.c          | 19 ++++++++++
 include/tee/optee.h               |  6 ++++
 7 files changed, 83 insertions(+), 32 deletions(-)
Signature · 1 line
2.47.3
author
#1 lore raw

PATCH v2 1/5 tee: optee: Factor out service enumeration and binding functions

From: Jan Kiszka <[email protected]>

This already avoids code duplication between the different enumeration commands. It will furthermore allow to implement a third one for services with RPMB needs.

---
 drivers/tee/optee/core.c          | 33 +++++++++++++++++--------------
 drivers/tee/optee/optee_private.h |  3 +++
 2 files changed, 21 insertions(+), 15 deletions(-)
drivers/tee/optee/core.c +18 -15
index 4d67c948ec1..2871760a7b7 100644
@@ -156,7 +156,7 @@ static int enum_services(struct udevice *dev, struct tee_shm **shm, size_t *coun
 	return ret;
 }
 
-static int open_enum_session(struct udevice *dev, u32 *tee_sess)
+int optee_open_enum_session(struct udevice *dev, u32 *tee_sess)
 {
 	const struct tee_optee_ta_uuid pta_uuid = PTA_DEVICE_ENUM;
 	struct tee_open_session_arg arg = { };
@@ -176,31 +176,34 @@ static int open_enum_session(struct udevice *dev, u32 *tee_sess)
 	return 0;
 }
 
-static int bind_service_drivers(struct udevice *dev)
+int optee_bind_services(struct udevice *dev, u32 tee_sess,
+			unsigned int pta_cmd)
 {
 	struct tee_shm *service_list = NULL;
 	size_t service_count;
-	u32 tee_sess;
-	int ret, ret2;
-
-	ret = open_enum_session(dev, &tee_sess);
-	if (ret)
-		return ret;
+	int ret;
 
 	ret = enum_services(dev, &service_list, &service_count, tee_sess,
-			    PTA_CMD_GET_DEVICES);
+			    pta_cmd);
 	if (!ret && service_count)
 		ret = bind_service_list(dev, service_list, service_count);
 
 	tee_shm_free(service_list);
-	service_list = NULL;
 
-	ret2 = enum_services(dev, &service_list, &service_count, tee_sess,
-			     PTA_CMD_GET_DEVICES_SUPP);
-	if (!ret2 && service_count)
-		ret2 = bind_service_list(dev, service_list, service_count);
+	return ret;
+}
+
+static int bind_service_drivers(struct udevice *dev)
+{
+	u32 tee_sess;
+	int ret, ret2;
 
-	tee_shm_free(service_list);
+	ret = optee_open_enum_session(dev, &tee_sess);
+	if (ret)
+		return ret;
+
+	ret = optee_bind_services(dev, tee_sess, PTA_CMD_GET_DEVICES);
+	ret2 = optee_bind_services(dev, tee_sess, PTA_CMD_GET_DEVICES_SUPP);
 
 	tee_close_session(dev, tee_sess);
 
drivers/tee/optee/optee_private.h +3 -0
index 1f07a27ee4b..25b6b3c3218 100644
@@ -27,6 +27,9 @@ struct optee_msg_arg;
 
 void optee_suppl_cmd(struct udevice *dev, struct tee_shm *shm_arg,
 		     void **page_list);
+int optee_open_enum_session(struct udevice *dev, u32 *tee_sess);
+int optee_bind_services(struct udevice *dev, u32 tee_sess,
+			unsigned int pta_cmd);
 
 #ifdef CONFIG_SUPPORT_EMMC_RPMB
 /**
Signature · 1 line
2.47.3
#2 lore raw

Re: [PATCH v2 1/5] tee: optee: Factor out service enumeration and binding functions

Hi Jan

Quoted 60 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

This already avoids code duplication between the different enumeration commands. It will furthermore allow to implement a third one for services with RPMB needs.

---
 drivers/tee/optee/core.c          | 33 +++++++++++++++++--------------
 drivers/tee/optee/optee_private.h |  3 +++
 2 files changed, 21 insertions(+), 15 deletions(-)
drivers/tee/optee/core.c +9 -14
index 4d67c948ec1..2871760a7b7 100644
@@ -156,7 +156,7 @@ static int enum_services(struct udevice *dev, struct tee_shm **shm, size_t *coun
 	return ret;
 }
 
-static int open_enum_session(struct udevice *dev, u32 *tee_sess)
+int optee_open_enum_session(struct udevice *dev, u32 *tee_sess)
 {
 	const struct tee_optee_ta_uuid pta_uuid = PTA_DEVICE_ENUM;
 	struct tee_open_session_arg arg = { };
@@ -176,31 +176,34 @@ static int open_enum_session(struct udevice *dev, u32 *tee_sess)
 	return 0;
 }
 
-static int bind_service_drivers(struct udevice *dev)
+int optee_bind_services(struct udevice *dev, u32 tee_sess,
+			unsigned int pta_cmd)
 {
 	struct tee_shm *service_list = NULL;
 	size_t service_count;
-	u32 tee_sess;
-	int ret, ret2;
-
-	ret = open_enum_session(dev, &tee_sess);
-	if (ret)
-		return ret;
+	int ret;
 
 	ret = enum_services(dev, &service_list, &service_count, tee_sess,
-			    PTA_CMD_GET_DEVICES);
+			    pta_cmd);
 	if (!ret && service_count)
 		ret = bind_service_list(dev, service_list, service_count);
 
 	tee_shm_free(service_list);
-	service_list = NULL;
 
-	ret2 = enum_services(dev, &service_list, &service_count, tee_sess,
-			     PTA_CMD_GET_DEVICES_SUPP);
-	if (!ret2 && service_count)
-		ret2 = bind_service_list(dev, service_list, service_count);
+	return ret;
+}
+
+static int bind_service_drivers(struct udevice *dev)

drivers/tee/optee/core.c static int open_enum_session(struct udevice *dev, u32 *tee_sess) · line 205

Quoted 10 lines
drivers/tee/optee/core.c +8 -1
+{
+	u32 tee_sess;
+	int ret, ret2;
 
-	tee_shm_free(service_list);
+	ret = optee_open_enum_session(dev, &tee_sess);
+	if (ret)
+		return ret;
+
+	ret = optee_bind_services(dev, tee_sess, PTA_CMD_GET_DEVICES);

Any reason we aren't exiting immediately here?

Quoted 9 lines
drivers/tee/optee/core.c +1 -0
+	ret2 = optee_bind_services(dev, tee_sess, PTA_CMD_GET_DEVICES_SUPP);
 
 	tee_close_session(dev, tee_sess);
 
drivers/tee/optee/optee_private.h +0 -0
index 1f07a27ee4b..25b6b3c3218 100644

drivers/tee/optee/optee_private.h struct optee_msg_arg; · line 35

Quoted 9 lines
drivers/tee/optee/optee_private.h +3 -0
@@ -27,6 +27,9 @@ struct optee_msg_arg;
 
 void optee_suppl_cmd(struct udevice *dev, struct tee_shm *shm_arg,
 		     void **page_list);
+int optee_open_enum_session(struct udevice *dev, u32 *tee_sess);
+int optee_bind_services(struct udevice *dev, u32 tee_sess,
+			unsigned int pta_cmd);
 
 #ifdef CONFIG_SUPPORT_EMMC_RPMB
 /**

Cheers
/Ilias

author
#3 lore raw

Re: [PATCH v2 1/5] tee: optee: Factor out service enumeration and binding functions

Quoted 68 lines · Ilias Apalodimas

Hi Jan

Quoted 64 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

This already avoids code duplication between the different enumeration commands. It will furthermore allow to implement a third one for services with RPMB needs.

---
 drivers/tee/optee/core.c          | 33 +++++++++++++++++--------------
 drivers/tee/optee/optee_private.h |  3 +++
 2 files changed, 21 insertions(+), 15 deletions(-)
drivers/tee/optee/core.c +12 -14
index 4d67c948ec1..2871760a7b7 100644
@@ -156,7 +156,7 @@ static int enum_services(struct udevice *dev, struct tee_shm **shm, size_t *coun
 	return ret;
 }
 
-static int open_enum_session(struct udevice *dev, u32 *tee_sess)
+int optee_open_enum_session(struct udevice *dev, u32 *tee_sess)
 {
 	const struct tee_optee_ta_uuid pta_uuid = PTA_DEVICE_ENUM;
 	struct tee_open_session_arg arg = { };
@@ -176,31 +176,34 @@ static int open_enum_session(struct udevice *dev, u32 *tee_sess)
 	return 0;
 }
 
-static int bind_service_drivers(struct udevice *dev)
+int optee_bind_services(struct udevice *dev, u32 tee_sess,
+			unsigned int pta_cmd)
 {
 	struct tee_shm *service_list = NULL;
 	size_t service_count;
-	u32 tee_sess;
-	int ret, ret2;
-
-	ret = open_enum_session(dev, &tee_sess);
-	if (ret)
-		return ret;
+	int ret;
 
 	ret = enum_services(dev, &service_list, &service_count, tee_sess,
-			    PTA_CMD_GET_DEVICES);
+			    pta_cmd);
 	if (!ret && service_count)
 		ret = bind_service_list(dev, service_list, service_count);
 
 	tee_shm_free(service_list);
-	service_list = NULL;
 
-	ret2 = enum_services(dev, &service_list, &service_count, tee_sess,
-			     PTA_CMD_GET_DEVICES_SUPP);
-	if (!ret2 && service_count)
-		ret2 = bind_service_list(dev, service_list, service_count);
+	return ret;
+}
+
+static int bind_service_drivers(struct udevice *dev)
+{
+	u32 tee_sess;
+	int ret, ret2;
 
Quoted 9 lines

drivers/tee/optee/core.c static int open_enum_session(struct udevice *dev, u32 *tee_sess) · line 205

Quoted 6 lines
drivers/tee/optee/core.c +5 -1
-	tee_shm_free(service_list);
+	ret = optee_open_enum_session(dev, &tee_sess);
+	if (ret)
+		return ret;
+
+	ret = optee_bind_services(dev, tee_sess, PTA_CMD_GET_DEVICES);

Any reason we aren't exiting immediately here?

Just maintained the pre-existing behavior. But I could do this as well:

	ret = optee_bind_services(dev, tee_sess, PTA_CMD_GET_DEVICES);
	if (ret == 0)
		ret = optee_bind_services(dev, tee_sess,
					  PTA_CMD_GET_DEVICES_SUPP);

Simpler, in fact...

Jan

Quoted 21 lines
Quoted 9 lines
drivers/tee/optee/core.c +1 -0
+	ret2 = optee_bind_services(dev, tee_sess, PTA_CMD_GET_DEVICES_SUPP);
 
 	tee_close_session(dev, tee_sess);
 
drivers/tee/optee/optee_private.h +0 -0
index 1f07a27ee4b..25b6b3c3218 100644

drivers/tee/optee/optee_private.h struct optee_msg_arg; · line 35

Quoted 9 lines
drivers/tee/optee/optee_private.h +3 -0
@@ -27,6 +27,9 @@ struct optee_msg_arg;
 
 void optee_suppl_cmd(struct udevice *dev, struct tee_shm *shm_arg,
 		     void **page_list);
+int optee_open_enum_session(struct udevice *dev, u32 *tee_sess);
+int optee_bind_services(struct udevice *dev, u32 tee_sess,
+			unsigned int pta_cmd);
 
 #ifdef CONFIG_SUPPORT_EMMC_RPMB
 /**

Cheers
/Ilias

Signature · 2 lines
Siemens AG, Foundational Technologies
Linux Expert Center
author
#4 lore raw

Re: [PATCH v2 1/5] tee: optee: Factor out service enumeration and binding functions

Quoted 79 lines · Jan Kiszka
Quoted 68 lines · Ilias Apalodimas

Hi Jan

Quoted 64 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

This already avoids code duplication between the different enumeration commands. It will furthermore allow to implement a third one for services with RPMB needs.

---
 drivers/tee/optee/core.c          | 33 +++++++++++++++++--------------
 drivers/tee/optee/optee_private.h |  3 +++
 2 files changed, 21 insertions(+), 15 deletions(-)
drivers/tee/optee/core.c +12 -14
index 4d67c948ec1..2871760a7b7 100644
@@ -156,7 +156,7 @@ static int enum_services(struct udevice *dev, struct tee_shm **shm, size_t *coun
 	return ret;
 }
 
-static int open_enum_session(struct udevice *dev, u32 *tee_sess)
+int optee_open_enum_session(struct udevice *dev, u32 *tee_sess)
 {
 	const struct tee_optee_ta_uuid pta_uuid = PTA_DEVICE_ENUM;
 	struct tee_open_session_arg arg = { };
@@ -176,31 +176,34 @@ static int open_enum_session(struct udevice *dev, u32 *tee_sess)
 	return 0;
 }
 
-static int bind_service_drivers(struct udevice *dev)
+int optee_bind_services(struct udevice *dev, u32 tee_sess,
+			unsigned int pta_cmd)
 {
 	struct tee_shm *service_list = NULL;
 	size_t service_count;
-	u32 tee_sess;
-	int ret, ret2;
-
-	ret = open_enum_session(dev, &tee_sess);
-	if (ret)
-		return ret;
+	int ret;
 
 	ret = enum_services(dev, &service_list, &service_count, tee_sess,
-			    PTA_CMD_GET_DEVICES);
+			    pta_cmd);
 	if (!ret && service_count)
 		ret = bind_service_list(dev, service_list, service_count);
 
 	tee_shm_free(service_list);
-	service_list = NULL;
 
-	ret2 = enum_services(dev, &service_list, &service_count, tee_sess,
-			     PTA_CMD_GET_DEVICES_SUPP);
-	if (!ret2 && service_count)
-		ret2 = bind_service_list(dev, service_list, service_count);
+	return ret;
+}
+
+static int bind_service_drivers(struct udevice *dev)
+{
+	u32 tee_sess;
+	int ret, ret2;
 
Quoted 9 lines

drivers/tee/optee/core.c static int open_enum_session(struct udevice *dev, u32 *tee_sess) · line 205

Quoted 6 lines
drivers/tee/optee/core.c +5 -1
-	tee_shm_free(service_list);
+	ret = optee_open_enum_session(dev, &tee_sess);
+	if (ret)
+		return ret;
+
+	ret = optee_bind_services(dev, tee_sess, PTA_CMD_GET_DEVICES);

Any reason we aren't exiting immediately here?

Quoted 9 lines

Just maintained the pre-existing behavior. But I could do this as well:

	ret = optee_bind_services(dev, tee_sess, PTA_CMD_GET_DEVICES);
	if (ret == 0)
		ret = optee_bind_services(dev, tee_sess,
					  PTA_CMD_GET_DEVICES_SUPP);

Simpler, in fact...

... but logically different: We only warn if any binding attempt fails, now we would not even attempt the other.

Key question is whether such an error scenario is possible at all, thus only PTA_CMD_GET_DEVICES fails but not PTA_CMD_GET_DEVICES_SUPP.

Jan

Signature · 2 lines
Siemens AG, Foundational Technologies
Linux Expert Center
#5 lore raw

Re: [PATCH v2 1/5] tee: optee: Factor out service enumeration and binding functions

Quoted 88 lines · Jan Kiszka
Quoted 86 lines · Jan Kiszka
Quoted 68 lines · Ilias Apalodimas

Hi Jan

Quoted 64 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

This already avoids code duplication between the different enumeration commands. It will furthermore allow to implement a third one for services with RPMB needs.

---
 drivers/tee/optee/core.c          | 33 +++++++++++++++++--------------
 drivers/tee/optee/optee_private.h |  3 +++
 2 files changed, 21 insertions(+), 15 deletions(-)
drivers/tee/optee/core.c +12 -14
index 4d67c948ec1..2871760a7b7 100644
@@ -156,7 +156,7 @@ static int enum_services(struct udevice *dev, struct tee_shm **shm, size_t *coun
    return ret;
 }
 
-static int open_enum_session(struct udevice *dev, u32 *tee_sess)
+int optee_open_enum_session(struct udevice *dev, u32 *tee_sess)
 {
    const struct tee_optee_ta_uuid pta_uuid = PTA_DEVICE_ENUM;
    struct tee_open_session_arg arg = { };
@@ -176,31 +176,34 @@ static int open_enum_session(struct udevice *dev, u32 *tee_sess)
    return 0;
 }
 
-static int bind_service_drivers(struct udevice *dev)
+int optee_bind_services(struct udevice *dev, u32 tee_sess,
+                   unsigned int pta_cmd)
 {
    struct tee_shm *service_list = NULL;
    size_t service_count;
-   u32 tee_sess;
-   int ret, ret2;
-
-   ret = open_enum_session(dev, &tee_sess);
-   if (ret)
-           return ret;
+   int ret;
 
    ret = enum_services(dev, &service_list, &service_count, tee_sess,
-                       PTA_CMD_GET_DEVICES);
+                       pta_cmd);
    if (!ret && service_count)
            ret = bind_service_list(dev, service_list, service_count);
 
    tee_shm_free(service_list);
-   service_list = NULL;
 
-   ret2 = enum_services(dev, &service_list, &service_count, tee_sess,
-                        PTA_CMD_GET_DEVICES_SUPP);
-   if (!ret2 && service_count)
-           ret2 = bind_service_list(dev, service_list, service_count);
+   return ret;
+}
+
+static int bind_service_drivers(struct udevice *dev)
+{
+   u32 tee_sess;
+   int ret, ret2;
 
Quoted 9 lines

drivers/tee/optee/core.c static int open_enum_session(struct udevice *dev, u32 *tee_sess) · line 205

Quoted 6 lines
drivers/tee/optee/core.c +5 -1
-   tee_shm_free(service_list);
+   ret = optee_open_enum_session(dev, &tee_sess);
+   if (ret)
+           return ret;
+
+   ret = optee_bind_services(dev, tee_sess, PTA_CMD_GET_DEVICES);

Any reason we aren't exiting immediately here?

Just maintained the pre-existing behavior. But I could do this as well:

      ret = optee_bind_services(dev, tee_sess, PTA_CMD_GET_DEVICES);
      if (ret == 0)
              ret = optee_bind_services(dev, tee_sess,
                                        PTA_CMD_GET_DEVICES_SUPP);
Quoted 8 lines
Quoted 2 lines

Simpler, in fact...

... but logically different: We only warn if any binding attempt fails, now we would not even attempt the other.

Key question is whether such an error scenario is possible at all, thus only PTA_CMD_GET_DEVICES fails but not PTA_CMD_GET_DEVICES_SUPP.

This can happen in the kernel (e.g the emulated RPMB that the supplicant presents), but I don't think it happens in u-boot. However, this is a valid reason not to exit immediately, so I am fine leaving it as is

Cheers
/Ilias

Quoted 6 lines

Jan

--
Siemens AG, Foundational Technologies
Linux Expert Center

author
#6 lore raw

PATCH v2 2/5 tee: optee: Add support for enumerating services that only need RPMB

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

Up to OP-TEE 4.4.0, all services that needed a supplicant where returned by PTA_CMD_GET_DEVICES_SUPP. Since then, services that only need a supplicant for the purpose of accessing the RPMB are only enumerated by the new, separate PTA_CMD_GET_DEVICES_RPMB. U-Boot so far lacks support for that, thus no longer finds such services, e.g. fTPM.

Perform the separate enumeration during probe but, as that may fail if the MMC is not probed yet, also provide a callback to trigger a retry when another MMC device becomes available.

---
 drivers/tee/optee/core.c          | 22 +++++++---------------
 drivers/tee/optee/optee_private.h | 21 +++++++++++++++++++++
 drivers/tee/optee/rpmb.c          | 19 +++++++++++++++++++
 include/tee/optee.h               |  6 ++++++
 4 files changed, 53 insertions(+), 15 deletions(-)
drivers/tee/optee/core.c +7 -15
index 2871760a7b7..ed8f2b6ec74 100644
@@ -27,19 +27,6 @@
  */
 #define PTA_DEVICE_ENUM		{ 0x7011a688, 0xddde, 0x4053, \
 				  { 0xa5, 0xa9, 0x7b, 0x3c, 0x4d, 0xdf, 0x13, 0xb8 } }
-/*
- * PTA_CMD_GET_DEVICES - List services without supplicant dependencies
- *
- * [out]    memref[0]: List of the UUIDs of service enumerated by OP-TEE
- */
-#define PTA_CMD_GET_DEVICES		0x0
-
-/*
- * PTA_CMD_GET_DEVICES_SUPP - List services depending on tee supplicant
- *
- * [out]    memref[0]: List of the UUIDs of service enumerated by OP-TEE
- */
-#define PTA_CMD_GET_DEVICES_SUPP	0x1
 
 typedef void (optee_invoke_fn)(unsigned long, unsigned long, unsigned long,
 			       unsigned long, unsigned long, unsigned long,
@@ -195,8 +182,8 @@ int optee_bind_services(struct udevice *dev, u32 tee_sess,
 
 static int bind_service_drivers(struct udevice *dev)
 {
+	int ret, ret2, ret3 = 0;
 	u32 tee_sess;
-	int ret, ret2;
 
 	ret = optee_open_enum_session(dev, &tee_sess);
 	if (ret)
@@ -204,13 +191,18 @@ static int bind_service_drivers(struct udevice *dev)
 
 	ret = optee_bind_services(dev, tee_sess, PTA_CMD_GET_DEVICES);
 	ret2 = optee_bind_services(dev, tee_sess, PTA_CMD_GET_DEVICES_SUPP);
+	if (CONFIG_IS_ENABLED(SUPPORT_EMMC_RPMB))
+		ret3 = optee_bind_services(dev, tee_sess,
+					   PTA_CMD_GET_DEVICES_RPMB);
 
 	tee_close_session(dev, tee_sess);
 
 	if (ret)
 		return ret;
+	if (ret2)
+		return ret2;
 
-	return ret2;
+	return ret3;
 }
 
 /**
drivers/tee/optee/optee_private.h +21 -0
index 25b6b3c3218..daff3e04493 100644
@@ -9,6 +9,27 @@
 #include <tee.h>
 #include <log.h>
 
+/*
+ * PTA_CMD_GET_DEVICES - List services without supplicant dependencies
+ *
+ * [out]    memref[0]: List of the UUIDs of service enumerated by OP-TEE
+ */
+#define PTA_CMD_GET_DEVICES		0x0
+
+/*
+ * PTA_CMD_GET_DEVICES_SUPP - List services depending on tee supplicant
+ *
+ * [out]    memref[0]: List of the UUIDs of service enumerated by OP-TEE
+ */
+#define PTA_CMD_GET_DEVICES_SUPP	0x1
+
+/*
+ * PTA_CMD_GET_DEVICES_RPMB - List services only depending on RPMB support
+ *
+ * [out]    memref[0]: List of the UUIDs of service enumerated by OP-TEE
+ */
+#define PTA_CMD_GET_DEVICES_RPMB	0x2
+
 /**
  * struct optee_private - OP-TEE driver private data
  * @rpmb_mmc:		mmc device for the RPMB partition
drivers/tee/optee/rpmb.c +19 -0
index bacced6af6c..f7312d7171c 100644
@@ -191,3 +191,22 @@ void optee_suppl_rpmb_release(struct udevice *dev)
 {
 	release_mmc(dev_get_priv(dev));
 }
+
+void optee_rpmb_available(void)
+{
+	struct udevice *dev;
+	struct uclass *uc;
+	u32 tee_sess;
+
+	uclass_id_foreach_dev(UCLASS_TEE, dev, uc) {
+		if (strcmp(dev->driver->name, "optee") != 0)
+			continue;
+
+		if (optee_open_enum_session(dev, &tee_sess) != 0)
+			continue;
+
+		optee_bind_services(dev, tee_sess, PTA_CMD_GET_DEVICES_RPMB);
+
+		tee_close_session(dev, tee_sess);
+	}
+}
include/tee/optee.h +6 -0
index d1194493780..755533b2c0b 100644
@@ -74,4 +74,10 @@ static inline bool is_optee_smc_api(void)
 }
 #endif
 
+#if defined(CONFIG_OPTEE) && defined(CONFIG_SUPPORT_EMMC_RPMB)
+void optee_rpmb_available(void);
+#else
+static inline void optee_rpmb_available(void) {}
+#endif
+
 #endif /* _OPTEE_H */
Signature · 1 line
2.47.3
#7 lore raw

Re: [PATCH v2 2/5] tee: optee: Add support for enumerating services that only need RPMB

[...]

Quoted 17 lines · Jan Kiszka
drivers/tee/optee/optee_private.h +1 -0
+
 /**
  * struct optee_private - OP-TEE driver private data
  * @rpmb_mmc:		mmc device for the RPMB partition
drivers/tee/optee/rpmb.c +5 -0
index bacced6af6c..f7312d7171c 100644
@@ -191,3 +191,22 @@ void optee_suppl_rpmb_release(struct udevice *dev)
 {
 	release_mmc(dev_get_priv(dev));
 }
+
+void optee_rpmb_available(void)
+{
+	struct udevice *dev;
+	struct uclass *uc;

drivers/tee/optee/rpmb.c void optee_suppl_rpmb_release(struct udevice *dev) · line 208

Quoted 10 lines
drivers/tee/optee/rpmb.c +10 -0
+	u32 tee_sess;
+
+	uclass_id_foreach_dev(UCLASS_TEE, dev, uc) {
+		if (strcmp(dev->driver->name, "optee") != 0)
+			continue;
+
+		if (optee_open_enum_session(dev, &tee_sess) != 0)
+			continue;
+
+		optee_bind_services(dev, tee_sess, PTA_CMD_GET_DEVICES_RPMB);

Will this work if devices are bound but not probed? IOW do we need a device_active() check?

Quoted 9 lines
drivers/tee/optee/rpmb.c +4 -0
+
+		tee_close_session(dev, tee_sess);
+	}
+}
include/tee/optee.h +0 -0
index d1194493780..755533b2c0b 100644

include/tee/optee.h static inline bool is_optee_smc_api(void) · line 83

Quoted 10 lines
include/tee/optee.h +6 -0
@@ -74,4 +74,10 @@ static inline bool is_optee_smc_api(void)
 }
 #endif
 
+#if defined(CONFIG_OPTEE) && defined(CONFIG_SUPPORT_EMMC_RPMB)
+void optee_rpmb_available(void);
+#else
+static inline void optee_rpmb_available(void) {}
+#endif
+
 #endif /* _OPTEE_H */

Thanks
/Ilias

author
#8 lore raw

Re: [PATCH v2 2/5] tee: optee: Add support for enumerating services that only need RPMB

Quoted 24 lines · Ilias Apalodimas

[...]

Quoted 21 lines · Jan Kiszka
drivers/tee/optee/optee_private.h +1 -0
+
 /**
  * struct optee_private - OP-TEE driver private data
  * @rpmb_mmc:		mmc device for the RPMB partition
drivers/tee/optee/rpmb.c +9 -0
index bacced6af6c..f7312d7171c 100644
@@ -191,3 +191,22 @@ void optee_suppl_rpmb_release(struct udevice *dev)
 {
 	release_mmc(dev_get_priv(dev));
 }
+
+void optee_rpmb_available(void)
+{
+	struct udevice *dev;
+	struct uclass *uc;
+	u32 tee_sess;
+
+	uclass_id_foreach_dev(UCLASS_TEE, dev, uc) {
+		if (strcmp(dev->driver->name, "optee") != 0)
Quoted 9 lines

drivers/tee/optee/rpmb.c void optee_suppl_rpmb_release(struct udevice *dev) · line 208

Quoted 6 lines
drivers/tee/optee/rpmb.c +6 -0
+			continue;
+
+		if (optee_open_enum_session(dev, &tee_sess) != 0)
+			continue;
+
+		optee_bind_services(dev, tee_sess, PTA_CMD_GET_DEVICES_RPMB);

Will this work if devices are bound but not probed? IOW do we need a device_active() check?

You mean the theoretical case that MMC is probed before optee? Unlikely right now but still valid. Let me add that.

Jan

Quoted 22 lines
Quoted 9 lines
drivers/tee/optee/rpmb.c +4 -0
+
+		tee_close_session(dev, tee_sess);
+	}
+}
include/tee/optee.h +0 -0
index d1194493780..755533b2c0b 100644

include/tee/optee.h static inline bool is_optee_smc_api(void) · line 83

Quoted 10 lines
include/tee/optee.h +6 -0
@@ -74,4 +74,10 @@ static inline bool is_optee_smc_api(void)
 }
 #endif
 
+#if defined(CONFIG_OPTEE) && defined(CONFIG_SUPPORT_EMMC_RPMB)
+void optee_rpmb_available(void);
+#else
+static inline void optee_rpmb_available(void) {}
+#endif
+
 #endif /* _OPTEE_H */

Thanks
/Ilias

Signature · 2 lines
Siemens AG, Foundational Technologies
Linux Expert Center
#9 lore raw

Re: [PATCH v2 2/5] tee: optee: Add support for enumerating services that only need RPMB

Quoted 36 lines · Jan Kiszka
Quoted 24 lines · Ilias Apalodimas

[...]

Quoted 21 lines · Jan Kiszka
drivers/tee/optee/optee_private.h +1 -0
+
 /**
  * struct optee_private - OP-TEE driver private data
  * @rpmb_mmc:               mmc device for the RPMB partition
drivers/tee/optee/rpmb.c +9 -0
index bacced6af6c..f7312d7171c 100644
@@ -191,3 +191,22 @@ void optee_suppl_rpmb_release(struct udevice *dev)
 {
     release_mmc(dev_get_priv(dev));
 }
+
+void optee_rpmb_available(void)
+{
+    struct udevice *dev;
+    struct uclass *uc;
+    u32 tee_sess;
+
+    uclass_id_foreach_dev(UCLASS_TEE, dev, uc) {
+            if (strcmp(dev->driver->name, "optee") != 0)
Quoted 9 lines

drivers/tee/optee/rpmb.c void optee_suppl_rpmb_release(struct udevice *dev) · line 208

Quoted 6 lines
drivers/tee/optee/rpmb.c +6 -0
+                    continue;
+
+            if (optee_open_enum_session(dev, &tee_sess) != 0)
+                    continue;
+
+            optee_bind_services(dev, tee_sess, PTA_CMD_GET_DEVICES_RPMB);

Will this work if devices are bound but not probed? IOW do we need a device_active() check?

Quoted 2 lines

You mean the theoretical case that MMC is probed before optee? Unlikely right now but still valid. Let me add that.

Yea, I am not sure if anyone can trigger this with preboot commands etc, but I think it's better to have it.

Cheers
/Ilias

Quoted 29 lines

Jan

Quoted 12 lines
Quoted 12 lines
drivers/tee/optee/rpmb.c +4 -0
+
+            tee_close_session(dev, tee_sess);
+    }
+}
include/tee/optee.h +0 -0
index d1194493780..755533b2c0b 100644
@@ -74,4 +74,10 @@ static inline bool is_optee_smc_api(void)
 }
 #endif
 
Quoted 10 lines

include/tee/optee.h static inline bool is_optee_smc_api(void) · line 83

Quoted 7 lines
include/tee/optee.h +6 -0
+#if defined(CONFIG_OPTEE) && defined(CONFIG_SUPPORT_EMMC_RPMB)
+void optee_rpmb_available(void);
+#else
+static inline void optee_rpmb_available(void) {}
+#endif
+
 #endif /* _OPTEE_H */

Thanks
/Ilias

--
Siemens AG, Foundational Technologies
Linux Expert Center

author
#10 lore raw

PATCH v2 3/5 tee: optee: Do not warn about TEE_ERROR_STORAGE_NOT_AVAILABLE

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

This is a transitional error that is resolved once an RPMB becomes available. Keep it as debug output only.

---
 drivers/tee/optee/core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/tee/optee/core.c +4 -1
index ed8f2b6ec74..d3b5811afb8 100644
@@ -106,7 +106,10 @@ static int __enum_services(struct udevice *dev, struct tee_shm *shm, size_t *shm
 
 	ret = tee_invoke_func(dev, &arg, 1, &param);
 	if (ret || (arg.ret && arg.ret != TEE_ERROR_SHORT_BUFFER)) {
-		dev_err(dev, "Enumeration command 0x%x failed: 0x%x\n", pta_cmd, arg.ret);
+		if (arg.ret != TEE_ERROR_STORAGE_NOT_AVAILABLE)
+			dev_err(dev, "Enumeration command 0x%x failed: 0x%x\n", pta_cmd, arg.ret);
+		else
+			dev_dbg(dev, "Enumeration command 0x%x failed due to unavailable storage\n", pta_cmd);
 		return -EINVAL;
 	}
 
Signature · 1 line
2.47.3
#11 lore raw

Re: [PATCH v2 3/5] tee: optee: Do not warn about TEE_ERROR_STORAGE_NOT_AVAILABLE

Hi Jan

Quoted 15 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

This is a transitional error that is resolved once an RPMB becomes available. Keep it as debug output only.

---
 drivers/tee/optee/core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/tee/optee/core.c +0 -0
index ed8f2b6ec74..d3b5811afb8 100644

drivers/tee/optee/core.c static int __enum_services(struct udevice *dev, struct tee_shm *shm, size_t *shm · line 112

Quoted 8 lines
drivers/tee/optee/core.c +4 -1
@@ -106,7 +106,10 @@ static int __enum_services(struct udevice *dev, struct tee_shm *shm, size_t *shm
 
 	ret = tee_invoke_func(dev, &arg, 1, &param);
 	if (ret || (arg.ret && arg.ret != TEE_ERROR_SHORT_BUFFER)) {
-		dev_err(dev, "Enumeration command 0x%x failed: 0x%x\n", pta_cmd, arg.ret);
+		if (arg.ret != TEE_ERROR_STORAGE_NOT_AVAILABLE)
+			dev_err(dev, "Enumeration command 0x%x failed: 0x%x\n", pta_cmd, arg.ret);
+		else
+			dev_dbg(dev, "Enumeration command 0x%x failed due to unavailable storage\n", pta_cmd);

I don't mind changing this and I like the different error messages. Isn't the dgb message useful for users though? Or it is something that's not expected to happen in production systems so we can hide it?

Cheers
/Ilias

Quoted 3 lines
drivers/tee/optee/core.c +0 -0
 		return -EINVAL;
 	}
 
author
#12 lore raw

Re: [PATCH v2 3/5] tee: optee: Do not warn about TEE_ERROR_STORAGE_NOT_AVAILABLE

Quoted 19 lines · Ilias Apalodimas

Hi Jan

Quoted 16 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

This is a transitional error that is resolved once an RPMB becomes available. Keep it as debug output only.

---
 drivers/tee/optee/core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/tee/optee/core.c +0 -0
index ed8f2b6ec74..d3b5811afb8 100644
@@ -106,7 +106,10 @@ static int __enum_services(struct udevice *dev, struct tee_shm *shm, size_t *shm
 
Quoted 11 lines

drivers/tee/optee/core.c static int __enum_services(struct udevice *dev, struct tee_shm *shm, size_t *shm · line 112

Quoted 7 lines
drivers/tee/optee/core.c +4 -1
 	ret = tee_invoke_func(dev, &arg, 1, &param);
 	if (ret || (arg.ret && arg.ret != TEE_ERROR_SHORT_BUFFER)) {
-		dev_err(dev, "Enumeration command 0x%x failed: 0x%x\n", pta_cmd, arg.ret);
+		if (arg.ret != TEE_ERROR_STORAGE_NOT_AVAILABLE)
+			dev_err(dev, "Enumeration command 0x%x failed: 0x%x\n", pta_cmd, arg.ret);
+		else
+			dev_dbg(dev, "Enumeration command 0x%x failed due to unavailable storage\n", pta_cmd);

I don't mind changing this and I like the different error messages. Isn't the dgb message useful for users though? Or it is something that's not expected to happen in production systems so we can hide it?

First of all, it's now something that will always happen due to probing of services that need RPMB when there is none yet. And, as explained above, it will be resolved later on. If you user misconfigured the firmware, though, there will be no resolution - but that is a debugging case.

Jan

Signature · 2 lines
Siemens AG, Foundational Technologies
Linux Expert Center
Reviewed-by
#13 lore raw

Re: [PATCH v2 3/5] tee: optee: Do not warn about TEE_ERROR_STORAGE_NOT_AVAILABLE

Quoted 33 lines · Jan Kiszka
Quoted 19 lines · Ilias Apalodimas

Hi Jan

Quoted 16 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

This is a transitional error that is resolved once an RPMB becomes available. Keep it as debug output only.

---
 drivers/tee/optee/core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/tee/optee/core.c +0 -0
index ed8f2b6ec74..d3b5811afb8 100644
@@ -106,7 +106,10 @@ static int __enum_services(struct udevice *dev, struct tee_shm *shm, size_t *shm
 
Quoted 11 lines

drivers/tee/optee/core.c static int __enum_services(struct udevice *dev, struct tee_shm *shm, size_t *shm · line 112

Quoted 7 lines
drivers/tee/optee/core.c +4 -1
     ret = tee_invoke_func(dev, &arg, 1, &param);
     if (ret || (arg.ret && arg.ret != TEE_ERROR_SHORT_BUFFER)) {
-            dev_err(dev, "Enumeration command 0x%x failed: 0x%x\n", pta_cmd, arg.ret);
+            if (arg.ret != TEE_ERROR_STORAGE_NOT_AVAILABLE)
+                    dev_err(dev, "Enumeration command 0x%x failed: 0x%x\n", pta_cmd, arg.ret);
+            else
+                    dev_dbg(dev, "Enumeration command 0x%x failed due to unavailable storage\n", pta_cmd);

I don't mind changing this and I like the different error messages. Isn't the dgb message useful for users though? Or it is something that's not expected to happen in production systems so we can hide it?

Quoted 5 lines

First of all, it's now something that will always happen due to probing of services that need RPMB when there is none yet. And, as explained above, it will be resolved later on. If you user misconfigured the firmware, though, there will be no resolution - but that is a debugging case.

Fair enough

Quoted 6 lines

Jan

--
Siemens AG, Foundational Technologies
Linux Expert Center

author
#14 lore raw

PATCH v2 4/5 mmc: Call back to optee after a successful mmc_init

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

This is needed to that OP-TEE can re-enumerate services which need RPMB access that may have become available now.

---
CC: Peng Fan <[email protected]>
CC: Jaehoon Chung <[email protected]>

---
 drivers/mmc/mmc.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mmc/mmc.c +4 -0
index 670e92ee12b..2463e50cd3c 100644
@@ -27,6 +27,7 @@
 #include <linux/list.h>
 #include <linux/printk.h>
 #include <div64.h>
+#include <tee/optee.h>
 #include "mmc_private.h"
 
 #define DEFAULT_CMD6_TIMEOUT_MS  500
@@ -3168,6 +3169,9 @@ int mmc_init(struct mmc *mmc)
 				mmc->cfg->name);
 	}
 
+	if (CONFIG_IS_ENABLED(OPTEE) && mmc->capacity_rpmb > 0)
+		optee_rpmb_available();
+
 	return err;
 }
 
Signature · 1 line
2.47.3
Reviewed-by Tanmay Kathpalia Reviewed-by Peng Fan
#16 lore raw

Re: [PATCH v2 4/5] mmc: Call back to optee after a successful mmc_init

Altera Confidential

________________________________
From: Peng Fan <[email protected]>
Sent: Wednesday, August 26, 2026 2:17:09 pm
To: Jan Kiszka <[email protected]>
Cc: U-Boot Mailing List <[email protected]>; Jens Wiklander <[email protected]>; Ilias Apalodimas <[email protected]>; Sai Sree Kartheek Adivi <[email protected]>; Alexander Heinisch <[email protected]>; Kathpalia, Tanmay <[email protected]>; Peng Fan <[email protected]>; Jaehoon Chung <[email protected]>
Subject: Re: [PATCH v2 4/5] mmc: Call back to optee after a successful mmc_init

Quoted 6 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

This is needed to that OP-TEE can re-enumerate services which need RPMB access that may have become available now.

author
#17 lore raw

PATCH v2 5/5 mmc: Make "MMC Device not found" a debug output

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

Callers of find_mmc_device are generally processing and informing about errors already, e.g.

=> mmc dev 2
MMC Device 2 not found
no mmc device at slot 2

---
CC: Peng Fan <[email protected]>
CC: Jaehoon Chung <[email protected]>

---
 drivers/mmc/mmc-uclass.c | 2 +-
 drivers/mmc/mmc_legacy.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/mmc-uclass.c +1 -1
index 698530088fe..ec16899f92e 100644
@@ -319,7 +319,7 @@ struct mmc *find_mmc_device(int dev_num)
 
 	if (ret) {
 #if !defined(CONFIG_XPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-		printf("MMC Device %d not found\n", dev_num);
+		dev_dbg(dev, "MMC Device %d not found\n", dev_num);
 #endif
 		return NULL;
 	}
drivers/mmc/mmc_legacy.c +1 -1
index 8f8ba34be71..573521842f6 100644
@@ -45,7 +45,7 @@ struct mmc *find_mmc_device(int dev_num)
 	}
 
 #if !defined(CONFIG_XPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-	printf("MMC Device %d not found\n", dev_num);
+	dev_dbg(dev, "MMC Device %d not found\n", dev_num);
 #endif
 
 	return NULL;
Signature · 1 line
2.47.3
Reviewed-by Tanmay Kathpalia Reviewed-by Peng Fan
#19 lore raw

Re: [PATCH v2 5/5] mmc: Make "MMC Device not found" a debug output

Altera Confidential

________________________________
From: Peng Fan <[email protected]>
Sent: Wednesday, August 26, 2026 2:17:24 pm
To: Jan Kiszka <[email protected]>
Cc: U-Boot Mailing List <[email protected]>; Jens Wiklander <[email protected]>; Ilias Apalodimas <[email protected]>; Sai Sree Kartheek Adivi <[email protected]>; Alexander Heinisch <[email protected]>; Kathpalia, Tanmay <[email protected]>; Peng Fan <[email protected]>; Jaehoon Chung <[email protected]>
Subject: Re: [PATCH v2 5/5] mmc: Make "MMC Device not found" a debug output

Quoted 10 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

Callers of find_mmc_device are generally processing and informing about errors already, e.g.

=> mmc dev 2
MMC Device 2 not found
no mmc device at slot 2

#20 lore raw

Re: [PATCH v2 5/5] mmc: Make "MMC Device not found" a debug output

In reply to Jan Kiszka
Quoted 1 line · Jan Kiszka

From: Jan Kiszka <[email protected]>

[...]

drivers/mmc/mmc-uclass.c struct mmc *find_mmc_device(int dev_num) · line 322

Quoted 10 lines
drivers/mmc/mmc-uclass.c +1 -1
index 698530088fe..ec16899f92e 100644
@@ -319,7 +319,7 @@ struct mmc *find_mmc_device(int dev_num)
 
 	if (ret) {
 #if !defined(CONFIG_XPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-		printf("MMC Device %d not found\n", dev_num);
+		dev_dbg(dev, "MMC Device %d not found\n", dev_num);

'dev' might be unitiazed here on failures

Quoted 8 lines
drivers/mmc/mmc-uclass.c +0 -0
 #endif
 		return NULL;
 	}
drivers/mmc/mmc_legacy.c +0 -0
index 8f8ba34be71..573521842f6 100644

drivers/mmc/mmc_legacy.c struct mmc *find_mmc_device(int dev_num) · line 51

Quoted 8 lines
drivers/mmc/mmc_legacy.c +1 -1
@@ -45,7 +45,7 @@ struct mmc *find_mmc_device(int dev_num)
 	}
 
 #if !defined(CONFIG_XPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-	printf("MMC Device %d not found\n", dev_num);
+	dev_dbg(dev, "MMC Device %d not found\n", dev_num);
 #endif
 
 	return NULL;

Cheers
/Ilias

#21 lore raw

Re: [PATCH v2 5/5] mmc: Make "MMC Device not found" a debug output

Quoted 10 lines · Ilias Apalodimas
Quoted 1 line · Jan Kiszka

From: Jan Kiszka <[email protected]>

[...]

Quoted 6 lines
drivers/mmc/mmc-uclass.c +0 -0
index 698530088fe..ec16899f92e 100644
@@ -319,7 +319,7 @@ struct mmc *find_mmc_device(int dev_num)
 
Quoted 5 lines

drivers/mmc/mmc-uclass.c struct mmc *find_mmc_device(int dev_num) · line 322

Quoted 4 lines
drivers/mmc/mmc-uclass.c +1 -1
  	if (ret) {
  #if !defined(CONFIG_XPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-		printf("MMC Device %d not found\n", dev_num);
+		dev_dbg(dev, "MMC Device %d not found\n", dev_num);

'dev' might be unitiazed here on failures

Yes, good catch. On the failure path of blk_find_device(), 'dev' is not guaranteed to be valid, so using it with dev_dbg() is wrong. I think debug() is the right replacement rather than leaving printf(), e.g.:
        debug("MMC Device %d not found\n", dev_num);

Quoted 11 lines
Quoted 11 lines
drivers/mmc/mmc-uclass.c +0 -0
  #endif
  		return NULL;
  	}
drivers/mmc/mmc_legacy.c +0 -0
index 8f8ba34be71..573521842f6 100644
@@ -45,7 +45,7 @@ struct mmc *find_mmc_device(int dev_num)
  	}
 
Quoted 4 lines

drivers/mmc/mmc_legacy.c struct mmc *find_mmc_device(int dev_num) · line 49

Quoted 4 lines
drivers/mmc/mmc_legacy.c +1 -1
  #if !defined(CONFIG_XPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-	printf("MMC Device %d not found\n", dev_num);
+	dev_dbg(dev, "MMC Device %d not found\n", dev_num);
  #endif

Same for the legacy path, which has no 'dev' at all.

Thanks Ilias, you are right. Dropping my Reviewed-by until a fixed version.

#22 lore raw
In reply to Jan Kiszka

Hi Jan

The CI [0] complains on this. My guess is it's due to the dev_dbg changes, but I haven't found time to look into it.

[0]
https://git.u-boot-project.org/u-boot/custodians/u-boot-tpm/-/pipelines/1208

Cheers
/Ilias

Quoted 34 lines · Jan Kiszka

This allows to find firmware TPM again with recent OP-TEE versions, possibly also other services. The StMM service was not affected because it is directly invoked by efi_variable_tee when needed, and that is late enough so that all dependencies are available by then.

See patches for further details.

Changes in v2:
- fix build breakages with disabled CONFIGs
- structure code differently between optee core and rpmb
- debug() -> dev_dbg()

Jan

Jan Kiszka (5):
tee: optee: Factor out service enumeration and binding functions
tee: optee: Add support for enumerating services that only need RPMB
tee: optee: Do not warn about TEE_ERROR_STORAGE_NOT_AVAILABLE
mmc: Call back to optee after a successful mmc_init
mmc: Make "MMC Device not found" a debug output

 drivers/mmc/mmc-uclass.c          |  2 +-
 drivers/mmc/mmc.c                 |  4 +++
 drivers/mmc/mmc_legacy.c          |  2 +-
 drivers/tee/optee/core.c          | 58 +++++++++++++++----------------
 drivers/tee/optee/optee_private.h | 24 +++++++++++++
 drivers/tee/optee/rpmb.c          | 19 ++++++++++
 include/tee/optee.h               |  6 ++++
 7 files changed, 83 insertions(+), 32 deletions(-)

--
2.47.3

author
#23 lore raw
Quoted 9 lines · Ilias Apalodimas

Hi Jan

The CI [0] complains on this. My guess is it's due to the dev_dbg changes, but I haven't found time to look into it.

[0] https://git.u-boot-project.org/u-boot/custodians/u-boot-tpm/-/
pipelines/1208 <https://git.u-boot-project.org/u-boot/custodians/u-boot-
tpm/-/pipelines/1208>

Yes, looks like (log is cut off, though). Let me sort this our first.

Jan

Quoted 39 lines

Cheers
/Ilias

On Sun, 23 Aug 2026 at 22:47, Jan Kiszka <[email protected] <mailto:[email protected]>> wrote:

This allows to find firmware TPM again with recent OP-TEE versions, possibly also other services. The StMM service was not affected because it is directly invoked by efi_variable_tee when needed, and that is late enough so that all dependencies are available by then.

See patches for further details.

Changes in v2:
 - fix build breakages with disabled CONFIGs
 - structure code differently between optee core and rpmb
 - debug() -> dev_dbg()

Jan

Jan Kiszka (5):
  tee: optee: Factor out service enumeration and binding functions
  tee: optee: Add support for enumerating services that only need RPMB
  tee: optee: Do not warn about TEE_ERROR_STORAGE_NOT_AVAILABLE
  mmc: Call back to optee after a successful mmc_init
  mmc: Make "MMC Device not found" a debug output

 drivers/mmc/mmc-uclass.c          |  2 +- drivers/mmc/mmc.c                 |  4 +++ drivers/mmc/mmc_legacy.c          |  2 +- drivers/tee/optee/core.c          | 58 +++++++++++++++---------------- drivers/tee/optee/optee_private.h | 24 +++++++++++++ drivers/tee/optee/rpmb.c          | 19 ++++++++++ include/tee/optee.h               |  6 ++++
 7 files changed, 83 insertions(+), 32 deletions(-)

--
2.47.3

Signature · 2 lines
Siemens AG, Foundational Technologies
Linux Expert Center