* [PATCH 1/2] tee: optee: merge tee/optee.h and ARM asm/optee.h
@ 2025-08-06 12:52 Ahmad Fatoum
2025-08-06 12:52 ` [PATCH 2/2] tee: optee: skip optee node fixup if method is NULL Ahmad Fatoum
2025-08-07 6:11 ` [PATCH 1/2] tee: optee: merge tee/optee.h and ARM asm/optee.h Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2025-08-06 12:52 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
OP-TEE is also available for RISC-V, so let's replace the asm/optee.h
header with a generic tee/optee.h header.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
arch/arm/boards/tqma6ulx/board.c | 1 -
arch/arm/include/asm/optee.h | 18 ------------------
arch/arm/mach-imx/imx9.c | 1 -
arch/arm/mach-rockchip/rockchip.c | 2 +-
drivers/soc/imx/soc-imx8m.c | 1 -
drivers/tee/optee/of_fixup.c | 1 -
include/tee/optee.h | 17 +++++++++++++++++
7 files changed, 18 insertions(+), 23 deletions(-)
delete mode 100644 arch/arm/include/asm/optee.h
diff --git a/arch/arm/boards/tqma6ulx/board.c b/arch/arm/boards/tqma6ulx/board.c
index 0c1af3c18f8d..c4222920d450 100644
--- a/arch/arm/boards/tqma6ulx/board.c
+++ b/arch/arm/boards/tqma6ulx/board.c
@@ -12,7 +12,6 @@
#include <of.h>
#include <string.h>
#include <linux/clk.h>
-#include <asm/optee.h>
#include <asm-generic/memory_layout.h>
#include "tqma6ulx.h"
diff --git a/arch/arm/include/asm/optee.h b/arch/arm/include/asm/optee.h
deleted file mode 100644
index f8eb7b4a8b0f..000000000000
--- a/arch/arm/include/asm/optee.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#ifndef __ARM_OPTEE_H__
-#define __ARM_OPTEE_H__
-
-#include <linux/types.h>
-
-struct device_node;
-
-struct of_optee_fixup_data {
- const char *method;
- size_t shm_size;
-};
-
-int of_optee_fixup(struct device_node *root, void *fixup_data);
-
-#endif /* __ARM_OPTEE_H__ */
-
diff --git a/arch/arm/mach-imx/imx9.c b/arch/arm/mach-imx/imx9.c
index 220951fd1920..dd4fbf099e60 100644
--- a/arch/arm/mach-imx/imx9.c
+++ b/arch/arm/mach-imx/imx9.c
@@ -9,7 +9,6 @@
#include <mach/imx/imx9-regs.h>
#include <tee/optee.h>
#include <asm-generic/memory_layout.h>
-#include <asm/optee.h>
#include <mach/imx/scratch.h>
#define SPEED_GRADING_MASK GENMASK(11, 6)
diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c
index 3d2ef791d20f..532d794fead1 100644
--- a/arch/arm/mach-rockchip/rockchip.c
+++ b/arch/arm/mach-rockchip/rockchip.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <common.h>
#include <init.h>
-#include <asm/optee.h>
+#include <tee/optee.h>
#include <asm-generic/memory_layout.h>
#include <mach/rockchip/rockchip.h>
#include <mach/rockchip/bootrom.h>
diff --git a/drivers/soc/imx/soc-imx8m.c b/drivers/soc/imx/soc-imx8m.c
index 1b47c914de8e..3b83284fcbfd 100644
--- a/drivers/soc/imx/soc-imx8m.c
+++ b/drivers/soc/imx/soc-imx8m.c
@@ -10,7 +10,6 @@
#include <of_address.h>
#include <pm_domain.h>
-#include <asm/optee.h>
#include <asm-generic/memory_layout.h>
#include <linux/io.h>
diff --git a/drivers/tee/optee/of_fixup.c b/drivers/tee/optee/of_fixup.c
index f3ccff31e68a..5a3eb094f22d 100644
--- a/drivers/tee/optee/of_fixup.c
+++ b/drivers/tee/optee/of_fixup.c
@@ -3,7 +3,6 @@
#include <of.h>
#include <linux/ioport.h>
#include <asm/barebox-arm.h>
-#include <asm/optee.h>
#include <tee/optee.h>
int of_optee_fixup(struct device_node *root, void *_data)
diff --git a/include/tee/optee.h b/include/tee/optee.h
index 943dbb8fdab6..10e829c04f88 100644
--- a/include/tee/optee.h
+++ b/include/tee/optee.h
@@ -61,4 +61,21 @@ int imx6ul_start_optee_early(void *fdt, void *tee, void *data_location,
#endif /* __PBL__ */
+struct device_node;
+
+struct of_optee_fixup_data {
+ const char *method;
+ size_t shm_size;
+};
+
+#ifdef CONFIG_OF_FIXUP_OPTEE
+int of_optee_fixup(struct device_node *root, void *fixup_data);
+#else
+static inline int of_optee_fixup(struct device_node *root, void *fixup_data)
+{
+ return -ENOSYS;
+}
+#endif
+
+
#endif /* _OPTEE_H */
--
2.39.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] tee: optee: skip optee node fixup if method is NULL
2025-08-06 12:52 [PATCH 1/2] tee: optee: merge tee/optee.h and ARM asm/optee.h Ahmad Fatoum
@ 2025-08-06 12:52 ` Ahmad Fatoum
2025-08-07 6:11 ` [PATCH 1/2] tee: optee: merge tee/optee.h and ARM asm/optee.h Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2025-08-06 12:52 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The function fixes up an OP-TEE node as well as reserved memory regions.
It can be useful to fix up the memory reservations, but not the OP-TEE
node itself, so let's make this possible if the method is NULL.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
drivers/tee/optee/of_fixup.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/drivers/tee/optee/of_fixup.c b/drivers/tee/optee/of_fixup.c
index 5a3eb094f22d..152322901a7e 100644
--- a/drivers/tee/optee/of_fixup.c
+++ b/drivers/tee/optee/of_fixup.c
@@ -10,24 +10,27 @@ int of_optee_fixup(struct device_node *root, void *_data)
struct of_optee_fixup_data *fixup_data = _data;
const char *optee_of_path = "/firmware/optee";
struct resource res_core = {}, res_shm = {};
- struct device_node *node;
u64 optee_membase;
int ret;
if (of_find_node_by_path_from(root, optee_of_path))
return 0;
- node = of_create_node(root, optee_of_path);
- if (!node)
- return -ENOMEM;
+ if (fixup_data->method) {
+ struct device_node *node;
- ret = of_property_write_string(node, "compatible", "linaro,optee-tz");
- if (ret)
- return ret;
+ node = of_create_node(root, optee_of_path);
+ if (!node)
+ return -ENOMEM;
- ret = of_property_write_string(node, "method", fixup_data->method);
- if (ret)
- return ret;
+ ret = of_property_write_string(node, "compatible", "linaro,optee-tz");
+ if (ret)
+ return ret;
+
+ ret = of_property_write_string(node, "method", fixup_data->method);
+ if (ret)
+ return ret;
+ }
if (!optee_get_membase(&optee_membase)) {
res_core.start = optee_membase;
--
2.39.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] tee: optee: merge tee/optee.h and ARM asm/optee.h
2025-08-06 12:52 [PATCH 1/2] tee: optee: merge tee/optee.h and ARM asm/optee.h Ahmad Fatoum
2025-08-06 12:52 ` [PATCH 2/2] tee: optee: skip optee node fixup if method is NULL Ahmad Fatoum
@ 2025-08-07 6:11 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2025-08-07 6:11 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Wed, 06 Aug 2025 14:52:28 +0200, Ahmad Fatoum wrote:
> OP-TEE is also available for RISC-V, so let's replace the asm/optee.h
> header with a generic tee/optee.h header.
>
>
Applied, thanks!
[1/2] tee: optee: merge tee/optee.h and ARM asm/optee.h
https://git.pengutronix.de/cgit/barebox/commit/?id=1cbc9eb5c45e (link may not be stable)
[2/2] tee: optee: skip optee node fixup if method is NULL
https://git.pengutronix.de/cgit/barebox/commit/?id=c24a984cd5db (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-08-07 6:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-06 12:52 [PATCH 1/2] tee: optee: merge tee/optee.h and ARM asm/optee.h Ahmad Fatoum
2025-08-06 12:52 ` [PATCH 2/2] tee: optee: skip optee node fixup if method is NULL Ahmad Fatoum
2025-08-07 6:11 ` [PATCH 1/2] tee: optee: merge tee/optee.h and ARM asm/optee.h Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox