mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] optee: Explicitly ignore OPTEE_RPC_CMD_RPMB_*
@ 2026-03-19  7:03 Sascha Hauer
  2026-03-19  7:03 ` [PATCH 2/2] optee: skip registration of already known TEE bus devices Sascha Hauer
  2026-03-20  6:35 ` [PATCH 1/2] optee: Explicitly ignore OPTEE_RPC_CMD_RPMB_* Sascha Hauer
  0 siblings, 2 replies; 4+ messages in thread
From: Sascha Hauer @ 2026-03-19  7:03 UTC (permalink / raw)
  To: Barebox List

We do not implement OPTEE_RPC_CMD_RPMB_* which are needed for the new
in-kernel RPMB handling which we don't implement. For now we emulate a
tee-supplicant for RPMB handling, so there's no need to warn about these
not being implemented.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/tee/optee/rpc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/tee/optee/rpc.c b/drivers/tee/optee/rpc.c
index bc398a625b..b91833d53a 100644
--- a/drivers/tee/optee/rpc.c
+++ b/drivers/tee/optee/rpc.c
@@ -69,7 +69,12 @@ void optee_rpc_cmd(struct tee_context *ctx, struct optee *optee,
 		break;
 	default:
 		pr_notice_once("optee: No supplicant or RPC handler for command 0x%x\n", arg->cmd);
+		fallthrough;
+	case OPTEE_RPC_CMD_RPMB_PROBE_RESET:
+	case OPTEE_RPC_CMD_RPMB_PROBE_NEXT:
+	case OPTEE_RPC_CMD_RPMB_FRAMES:
 		arg->ret = TEEC_ERROR_NOT_IMPLEMENTED;
+		break;
 	}
 
 	arg->ret_origin = TEEC_ORIGIN_COMMS;
-- 
2.47.3




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] optee: skip registration of already known TEE bus devices
  2026-03-19  7:03 [PATCH 1/2] optee: Explicitly ignore OPTEE_RPC_CMD_RPMB_* Sascha Hauer
@ 2026-03-19  7:03 ` Sascha Hauer
  2026-03-20  9:09   ` [PATCH] fixup! " Sascha Hauer
  2026-03-20  6:35 ` [PATCH 1/2] optee: Explicitly ignore OPTEE_RPC_CMD_RPMB_* Sascha Hauer
  1 sibling, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2026-03-19  7:03 UTC (permalink / raw)
  To: Barebox List; +Cc: Claude Opus 4.6

optee_enumerate_devices() may be called multiple times, e.g. when a
new RPMB device appears. Check if a device with the same name is
already registered on the TEE bus before registering it again.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/tee/optee/device.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/tee/optee/device.c b/drivers/tee/optee/device.c
index f5e03630b1..ab05a4dfc9 100644
--- a/drivers/tee/optee/device.c
+++ b/drivers/tee/optee/device.c
@@ -57,14 +57,23 @@ static int get_devices(struct tee_context *ctx, u32 session,
 static int optee_register_device(const uuid_t *device_uuid)
 {
 	struct tee_client_device *optee_device = NULL;
+	struct device *dev;
+	char name[39];
 	int rc;
 
+	snprintf(name, sizeof(name), "optee-ta-%pUb", device_uuid);
+
+	dev = bus_find_device_by_name(&tee_bus_type, NULL, name);
+	if (dev)
+		return 0;
+
 	optee_device = kzalloc(sizeof(*optee_device), GFP_KERNEL);
 	if (!optee_device)
 		return -ENOMEM;
 
+	optee_device->dev.id = DEVICE_ID_SINGLE;
 	optee_device->dev.bus = &tee_bus_type;
-	if (dev_set_name(&optee_device->dev, "optee-ta-%pUb", device_uuid)) {
+	if (dev_set_name(&optee_device->dev, "%s", name)) {
 		kfree(optee_device);
 		return -ENOMEM;
 	}
-- 
2.47.3




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] optee: Explicitly ignore OPTEE_RPC_CMD_RPMB_*
  2026-03-19  7:03 [PATCH 1/2] optee: Explicitly ignore OPTEE_RPC_CMD_RPMB_* Sascha Hauer
  2026-03-19  7:03 ` [PATCH 2/2] optee: skip registration of already known TEE bus devices Sascha Hauer
@ 2026-03-20  6:35 ` Sascha Hauer
  1 sibling, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2026-03-20  6:35 UTC (permalink / raw)
  To: Barebox List, Sascha Hauer


On Thu, 19 Mar 2026 08:03:03 +0100, Sascha Hauer wrote:
> We do not implement OPTEE_RPC_CMD_RPMB_* which are needed for the new
> in-kernel RPMB handling which we don't implement. For now we emulate a
> tee-supplicant for RPMB handling, so there's no need to warn about these
> not being implemented.
> 
> 

Applied, thanks!

[1/2] optee: Explicitly ignore OPTEE_RPC_CMD_RPMB_*
      https://git.pengutronix.de/cgit/barebox/commit/?id=4d38c4eb8b6e (link may not be stable)
[2/2] optee: skip registration of already known TEE bus devices
      https://git.pengutronix.de/cgit/barebox/commit/?id=0f3d9ddb1892 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] fixup! optee: skip registration of already known TEE bus devices
  2026-03-19  7:03 ` [PATCH 2/2] optee: skip registration of already known TEE bus devices Sascha Hauer
@ 2026-03-20  9:09   ` Sascha Hauer
  0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2026-03-20  9:09 UTC (permalink / raw)
  To: Barebox List

---
 drivers/tee/optee/device.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/tee/optee/device.c b/drivers/tee/optee/device.c
index ab05a4dfc9..2713af0797 100644
--- a/drivers/tee/optee/device.c
+++ b/drivers/tee/optee/device.c
@@ -5,6 +5,7 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include <stdio.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/device.h>
-- 
2.47.3




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-20  9:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-19  7:03 [PATCH 1/2] optee: Explicitly ignore OPTEE_RPC_CMD_RPMB_* Sascha Hauer
2026-03-19  7:03 ` [PATCH 2/2] optee: skip registration of already known TEE bus devices Sascha Hauer
2026-03-20  9:09   ` [PATCH] fixup! " Sascha Hauer
2026-03-20  6:35 ` [PATCH 1/2] optee: Explicitly ignore OPTEE_RPC_CMD_RPMB_* Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox