* [PATCH 0/4] optee: Add support for enumerating RPMB-dependent services
@ 2026-08-21 9:28 Jan Kiszka
2026-08-21 9:28 ` [PATCH 1/4] tee: optee: Add support for enumerating services that only need RPMB Jan Kiszka
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Jan Kiszka @ 2026-08-21 9:28 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Jens Wiklander, Ilias Apalodimas, Sai Sree Kartheek Adivi,
Alexander Heinisch
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.
Jan
Jan Kiszka (4):
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 | 37 ++++++++++++++++++++++++++++++-
drivers/tee/optee/optee_private.h | 2 ++
drivers/tee/optee/rpmb.c | 11 +++++++++
include/tee/optee.h | 2 ++
7 files changed, 57 insertions(+), 3 deletions(-)
--
2.47.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] tee: optee: Add support for enumerating services that only need RPMB
2026-08-21 9:28 [PATCH 0/4] optee: Add support for enumerating RPMB-dependent services Jan Kiszka
@ 2026-08-21 9:28 ` Jan Kiszka
2026-08-21 9:28 ` [PATCH 2/4] tee: optee: Do not warn about TEE_ERROR_STORAGE_NOT_AVAILABLE Jan Kiszka
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Jan Kiszka @ 2026-08-21 9:28 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Jens Wiklander, Ilias Apalodimas, Sai Sree Kartheek Adivi,
Alexander Heinisch
From: Jan Kiszka <jan.kiszka@siemens.com>
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.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
drivers/tee/optee/core.c | 32 +++++++++++++++++++++++++++++++
drivers/tee/optee/optee_private.h | 2 ++
drivers/tee/optee/rpmb.c | 11 +++++++++++
include/tee/optee.h | 2 ++
4 files changed, 47 insertions(+)
diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
index 4d67c948ec1..5600d5a4c7d 100644
--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -41,6 +41,13 @@
*/
#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
+
typedef void (optee_invoke_fn)(unsigned long, unsigned long, unsigned long,
unsigned long, unsigned long, unsigned long,
unsigned long, unsigned long,
@@ -210,6 +217,29 @@ static int bind_service_drivers(struct udevice *dev)
return ret2;
}
+#ifdef CONFIG_SUPPORT_EMMC_RPMB
+void optee_bind_service_drivers_rpmb(struct udevice *dev)
+{
+ struct tee_shm *service_list = NULL;
+ size_t service_count;
+ u32 tee_sess;
+ int ret;
+
+ ret = open_enum_session(dev, &tee_sess);
+ if (ret)
+ return;
+
+ ret = enum_services(dev, &service_list, &service_count, tee_sess,
+ PTA_CMD_GET_DEVICES_RPMB);
+ if (!ret && service_count)
+ ret = bind_service_list(dev, service_list, service_count);
+
+ tee_shm_free(service_list);
+
+ tee_close_session(dev, tee_sess);
+}
+#endif
+
/**
* reg_pair_to_ptr() - Make a pointer of 2 32-bit values
* @reg0: High bits of the pointer
@@ -852,6 +882,8 @@ static int optee_probe(struct udevice *dev)
ret = bind_service_drivers(dev);
if (ret)
dev_warn(dev, "optee service enumeration failed: %d\n", ret);
+ else
+ optee_bind_service_drivers_rpmb(dev);
} else if (IS_ENABLED(CONFIG_RNG_OPTEE)) {
/*
* Discovery of TAs on the TEE bus is not supported in U-Boot:
diff --git a/drivers/tee/optee/optee_private.h b/drivers/tee/optee/optee_private.h
index 1f07a27ee4b..b5a58df5b96 100644
--- a/drivers/tee/optee/optee_private.h
+++ b/drivers/tee/optee/optee_private.h
@@ -79,4 +79,6 @@ static inline void optee_suppl_cmd_i2c_transfer(struct optee_msg_arg *arg)
void *optee_alloc_and_init_page_list(void *buf, ulong len, u64 *phys_buf_ptr);
+void optee_bind_service_drivers_rpmb(struct udevice *dev);
+
#endif /* __OPTEE_PRIVATE_H */
diff --git a/drivers/tee/optee/rpmb.c b/drivers/tee/optee/rpmb.c
index bacced6af6c..f4a66641755 100644
--- a/drivers/tee/optee/rpmb.c
+++ b/drivers/tee/optee/rpmb.c
@@ -191,3 +191,14 @@ 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;
+
+ uclass_id_foreach_dev(UCLASS_TEE, dev, uc) {
+ if (strcmp(dev->driver->name, "optee") == 0)
+ optee_bind_service_drivers_rpmb(dev);
+ }
+}
diff --git a/include/tee/optee.h b/include/tee/optee.h
index d1194493780..c12fda3cc73 100644
--- a/include/tee/optee.h
+++ b/include/tee/optee.h
@@ -74,4 +74,6 @@ static inline bool is_optee_smc_api(void)
}
#endif
+void optee_rpmb_available(void);
+
#endif /* _OPTEE_H */
--
2.47.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] tee: optee: Do not warn about TEE_ERROR_STORAGE_NOT_AVAILABLE
2026-08-21 9:28 [PATCH 0/4] optee: Add support for enumerating RPMB-dependent services Jan Kiszka
2026-08-21 9:28 ` [PATCH 1/4] tee: optee: Add support for enumerating services that only need RPMB Jan Kiszka
@ 2026-08-21 9:28 ` Jan Kiszka
2026-08-21 9:29 ` [PATCH 3/4] mmc: Call back to optee after a successful mmc_init Jan Kiszka
2026-08-21 9:29 ` [PATCH 4/4] mmc: Make "MMC Device not found" a debug output Jan Kiszka
3 siblings, 0 replies; 5+ messages in thread
From: Jan Kiszka @ 2026-08-21 9:28 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Jens Wiklander, Ilias Apalodimas, Sai Sree Kartheek Adivi,
Alexander Heinisch
From: Jan Kiszka <jan.kiszka@siemens.com>
This is a transitional error that is resolved once an RPMB becomes
available. Keep it as debug output only.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
drivers/tee/optee/core.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
index 5600d5a4c7d..4b1396b8652 100644
--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -126,7 +126,10 @@ static int __enum_services(struct udevice *dev, struct tee_shm *shm, size_t *shm
ret = tee_invoke_func(dev, &arg, 1, ¶m);
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
+ debug("Enumeration command 0x%x failed due to unavailable storage\n", pta_cmd);
return -EINVAL;
}
--
2.47.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] mmc: Call back to optee after a successful mmc_init
2026-08-21 9:28 [PATCH 0/4] optee: Add support for enumerating RPMB-dependent services Jan Kiszka
2026-08-21 9:28 ` [PATCH 1/4] tee: optee: Add support for enumerating services that only need RPMB Jan Kiszka
2026-08-21 9:28 ` [PATCH 2/4] tee: optee: Do not warn about TEE_ERROR_STORAGE_NOT_AVAILABLE Jan Kiszka
@ 2026-08-21 9:29 ` Jan Kiszka
2026-08-21 9:29 ` [PATCH 4/4] mmc: Make "MMC Device not found" a debug output Jan Kiszka
3 siblings, 0 replies; 5+ messages in thread
From: Jan Kiszka @ 2026-08-21 9:29 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Jens Wiklander, Ilias Apalodimas, Sai Sree Kartheek Adivi,
Alexander Heinisch, Peng Fan, Jaehoon Chung
From: Jan Kiszka <jan.kiszka@siemens.com>
This is needed to that OP-TEE can re-enumerate services which need RPMB
access that may have become available now.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
CC: Peng Fan <peng.fan@nxp.com>
CC: Jaehoon Chung <jh80.chung@samsung.com>
---
drivers/mmc/mmc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 670e92ee12b..2463e50cd3c 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -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;
}
--
2.47.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] mmc: Make "MMC Device not found" a debug output
2026-08-21 9:28 [PATCH 0/4] optee: Add support for enumerating RPMB-dependent services Jan Kiszka
` (2 preceding siblings ...)
2026-08-21 9:29 ` [PATCH 3/4] mmc: Call back to optee after a successful mmc_init Jan Kiszka
@ 2026-08-21 9:29 ` Jan Kiszka
3 siblings, 0 replies; 5+ messages in thread
From: Jan Kiszka @ 2026-08-21 9:29 UTC (permalink / raw)
To: U-Boot Mailing List
Cc: Jens Wiklander, Ilias Apalodimas, Sai Sree Kartheek Adivi,
Alexander Heinisch, Peng Fan, Jaehoon Chung
From: Jan Kiszka <jan.kiszka@siemens.com>
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
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
CC: Peng Fan <peng.fan@nxp.com>
CC: Jaehoon Chung <jh80.chung@samsung.com>
---
drivers/mmc/mmc-uclass.c | 2 +-
drivers/mmc/mmc_legacy.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index 698530088fe..cd930807802 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -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);
+ debug("MMC Device %d not found\n", dev_num);
#endif
return NULL;
}
diff --git a/drivers/mmc/mmc_legacy.c b/drivers/mmc/mmc_legacy.c
index 8f8ba34be71..2a4a8a83fb3 100644
--- a/drivers/mmc/mmc_legacy.c
+++ b/drivers/mmc/mmc_legacy.c
@@ -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);
+ debug("MMC Device %d not found\n", dev_num);
#endif
return NULL;
--
2.47.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-08-21 9:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-21 9:28 [PATCH 0/4] optee: Add support for enumerating RPMB-dependent services Jan Kiszka
2026-08-21 9:28 ` [PATCH 1/4] tee: optee: Add support for enumerating services that only need RPMB Jan Kiszka
2026-08-21 9:28 ` [PATCH 2/4] tee: optee: Do not warn about TEE_ERROR_STORAGE_NOT_AVAILABLE Jan Kiszka
2026-08-21 9:29 ` [PATCH 3/4] mmc: Call back to optee after a successful mmc_init Jan Kiszka
2026-08-21 9:29 ` [PATCH 4/4] mmc: Make "MMC Device not found" a debug output Jan Kiszka
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.