* [PATCH] tee: optee: improve error message for unprogrammed auth key
@ 2026-11-03 10:15 Ahmad Fatoum
0 siblings, 0 replies; only message in thread
From: Ahmad Fatoum @ 2026-11-03 10:15 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Even with barebox now decoding the OP-TEE command that fails, the
resulting error message is still rather cryptic:
ERROR: optee: PTA_CMD_GET_DEVICES_RPMB invoke function err: f0100003
Linux doesn't emit an error message at all, but suppresses this specific
error code.
We won't go that far in barebox, but let's bump the message down to info
level and make it more descriptive.
Reported-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/tee/optee/device.c | 14 +++++++++++++-
drivers/tee/optee/optee_private.h | 4 ++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/tee/optee/device.c b/drivers/tee/optee/device.c
index 425971b9544e..a0c975617ea7 100644
--- a/drivers/tee/optee/device.c
+++ b/drivers/tee/optee/device.c
@@ -59,6 +59,13 @@ static int get_devices(struct tee_context *ctx, u32 session,
ret = tee_client_invoke_func(ctx, &inv_arg, param);
if ((ret < 0) || ((inv_arg.ret != TEEC_SUCCESS) &&
(inv_arg.ret != TEEC_ERROR_SHORT_BUFFER))) {
+ /*
+ * TEE_ERROR_STORAGE_NOT_AVAILABLE is returned when getting
+ * the list of device TAs that depends on RPMB but a usable
+ * RPMB device isn't found.
+ */
+ if (inv_arg.ret == TEE_ERROR_STORAGE_NOT_AVAILABLE)
+ return -ENODEV;
pr_err("%s invoke function err: %x\n",
pta_cmd_str(func), inv_arg.ret);
return -EINVAL;
@@ -184,13 +191,18 @@ static bool rpmb_available;
static void optee_scan_bus_rpmb(void)
{
+ int ret;
+
if (!optee_ready)
return;
if (!rpmb_available)
return;
__optee_enumerate_devices(PTA_CMD_GET_DEVICES_SUPP);
- __optee_enumerate_devices(PTA_CMD_GET_DEVICES_RPMB);
+
+ ret = __optee_enumerate_devices(PTA_CMD_GET_DEVICES_RPMB);
+ if (ret == -ENODEV)
+ pr_info("RPMB unavailable (auth key not programmed?), skipping RPMB-dependent TAs\n");
}
int optee_enumerate_devices(u32 func)
diff --git a/drivers/tee/optee/optee_private.h b/drivers/tee/optee/optee_private.h
index 9752e0ea933f..c4596b56a477 100644
--- a/drivers/tee/optee/optee_private.h
+++ b/drivers/tee/optee/optee_private.h
@@ -27,6 +27,10 @@
#define TEEC_ERROR_BUSY 0xFFFF000D
#define TEEC_ERROR_SHORT_BUFFER 0xFFFF0010
+/* API Return Codes are from the GP TEE Internal Core API Specification */
+#define TEE_ERROR_TIMEOUT 0xFFFF3001
+#define TEE_ERROR_STORAGE_NOT_AVAILABLE 0xF0100003
+
#define TEEC_ORIGIN_COMMS 0x00000002
/*
--
2.47.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-03 10:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 10:15 [PATCH] tee: optee: improve error message for unprogrammed auth key Ahmad Fatoum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox