* [PATCH v2] arch: arm: imx: esdctl: limit ram to 1GB on imx93 in case OPTEE is enabled
@ 2025-06-23 22:00 Michael Grzeschik
2025-06-24 10:26 ` Sascha Hauer
2025-06-24 10:30 ` Marco Felsch
0 siblings, 2 replies; 4+ messages in thread
From: Michael Grzeschik @ 2025-06-23 22:00 UTC (permalink / raw)
To: barebox
In MX93 the ELE (Edge Lock Enclave) is limited to communicate with
messages addressed under 1.5GB. The ELE can not reach the memory between
(0xE0000000-0xFFFFFFFF).
So we limit the usable memory in case OPTEE is used.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
v1 -> v2: moved the limitation to be active in imx93_barebox_entry only
---
arch/arm/mach-imx/esdctl.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-imx/esdctl.c b/arch/arm/mach-imx/esdctl.c
index 4b67b52ca45..c79d7c29245 100644
--- a/arch/arm/mach-imx/esdctl.c
+++ b/arch/arm/mach-imx/esdctl.c
@@ -1046,9 +1046,20 @@ void __noreturn imx7d_barebox_entry(void *boarddata)
void __noreturn imx93_barebox_entry(void *boarddata)
{
+ resource_size_t mem = 0;
+
imx93_init_scratch_space(false);
optee_set_membase(imx_scratch_get_optee_hdr());
- barebox_arm_entry(MX9_DDR_CSD1_BASE_ADDR,
- imx9_ddrc_sdram_size(), boarddata);
+ mem = imx9_ddrc_sdram_size();
+ /* In MX93 the ELE is limited to comunicate with messages
+ * under 1.5GB address space. This limits the overal memory
+ * to be 1GB in case OPTEE is used.
+ */
+ if (IS_ENABLED(CONFIG_PBL_OPTEE)) {
+ if (mem > 0x40000000)
+ mem = 0x40000000;
+ }
+
+ barebox_arm_entry(MX9_DDR_CSD1_BASE_ADDR, mem, boarddata);
}
--
2.39.5
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] arch: arm: imx: esdctl: limit ram to 1GB on imx93 in case OPTEE is enabled
2025-06-23 22:00 [PATCH v2] arch: arm: imx: esdctl: limit ram to 1GB on imx93 in case OPTEE is enabled Michael Grzeschik
@ 2025-06-24 10:26 ` Sascha Hauer
2025-06-24 10:30 ` Marco Felsch
1 sibling, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2025-06-24 10:26 UTC (permalink / raw)
To: Michael Grzeschik; +Cc: barebox
On Tue, Jun 24, 2025 at 12:00:09AM +0200, Michael Grzeschik wrote:
> In MX93 the ELE (Edge Lock Enclave) is limited to communicate with
> messages addressed under 1.5GB. The ELE can not reach the memory between
> (0xE0000000-0xFFFFFFFF).
1.5GB would be 0xc0000000 which you also use in the patch, but in the
commit message you say 0xe0000000. Which one is it?
I really don't like this patch and that's why I hesitated to apply it
when you first sent it. I hoped I would get a better idea how we can
allocate memory in the usable range, but I still don't have an idea, so
I'll apply it this time. Does anyone have a better idea? Adding a
reserved_mem node to the device tree might be an option, but still not
very convincing.
Sascha
>
> So we limit the usable memory in case OPTEE is used.
>
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
>
> ---
> v1 -> v2: moved the limitation to be active in imx93_barebox_entry only
> ---
> arch/arm/mach-imx/esdctl.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-imx/esdctl.c b/arch/arm/mach-imx/esdctl.c
> index 4b67b52ca45..c79d7c29245 100644
> --- a/arch/arm/mach-imx/esdctl.c
> +++ b/arch/arm/mach-imx/esdctl.c
> @@ -1046,9 +1046,20 @@ void __noreturn imx7d_barebox_entry(void *boarddata)
>
> void __noreturn imx93_barebox_entry(void *boarddata)
> {
> + resource_size_t mem = 0;
> +
> imx93_init_scratch_space(false);
> optee_set_membase(imx_scratch_get_optee_hdr());
>
> - barebox_arm_entry(MX9_DDR_CSD1_BASE_ADDR,
> - imx9_ddrc_sdram_size(), boarddata);
> + mem = imx9_ddrc_sdram_size();
> + /* In MX93 the ELE is limited to comunicate with messages
> + * under 1.5GB address space. This limits the overal memory
> + * to be 1GB in case OPTEE is used.
> + */
> + if (IS_ENABLED(CONFIG_PBL_OPTEE)) {
> + if (mem > 0x40000000)
> + mem = 0x40000000;
> + }
> +
> + barebox_arm_entry(MX9_DDR_CSD1_BASE_ADDR, mem, boarddata);
> }
> --
> 2.39.5
>
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] arch: arm: imx: esdctl: limit ram to 1GB on imx93 in case OPTEE is enabled
2025-06-23 22:00 [PATCH v2] arch: arm: imx: esdctl: limit ram to 1GB on imx93 in case OPTEE is enabled Michael Grzeschik
2025-06-24 10:26 ` Sascha Hauer
@ 2025-06-24 10:30 ` Marco Felsch
1 sibling, 0 replies; 4+ messages in thread
From: Marco Felsch @ 2025-06-24 10:30 UTC (permalink / raw)
To: Michael Grzeschik; +Cc: barebox
Hi Michael,
thanks for the patch.
On 25-06-24, Michael Grzeschik wrote:
> In MX93 the ELE (Edge Lock Enclave) is limited to communicate with
> messages addressed under 1.5GB. The ELE can not reach the memory between
> (0xE0000000-0xFFFFFFFF).
>
> So we limit the usable memory in case OPTEE is used.
Out of curiosity. This limits the memory for barebox but what about
Linux? You don't want to limit memory for Linux because ELE is not
capable of using memory above 0xe0000000.
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
>
> ---
> v1 -> v2: moved the limitation to be active in imx93_barebox_entry only
> ---
> arch/arm/mach-imx/esdctl.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-imx/esdctl.c b/arch/arm/mach-imx/esdctl.c
> index 4b67b52ca45..c79d7c29245 100644
> --- a/arch/arm/mach-imx/esdctl.c
> +++ b/arch/arm/mach-imx/esdctl.c
> @@ -1046,9 +1046,20 @@ void __noreturn imx7d_barebox_entry(void *boarddata)
>
> void __noreturn imx93_barebox_entry(void *boarddata)
> {
> + resource_size_t mem = 0;
> +
> imx93_init_scratch_space(false);
> optee_set_membase(imx_scratch_get_optee_hdr());
>
> - barebox_arm_entry(MX9_DDR_CSD1_BASE_ADDR,
> - imx9_ddrc_sdram_size(), boarddata);
> + mem = imx9_ddrc_sdram_size();
> + /* In MX93 the ELE is limited to comunicate with messages
> + * under 1.5GB address space. This limits the overal memory
> + * to be 1GB in case OPTEE is used.
> + */
What is the role of OP-TEE here? Is the ELE communication done by
barebox or op-tee or both?
Regards,
Marco
> + if (IS_ENABLED(CONFIG_PBL_OPTEE)) {
> + if (mem > 0x40000000)
> + mem = 0x40000000;
> + }
> +
> + barebox_arm_entry(MX9_DDR_CSD1_BASE_ADDR, mem, boarddata);
> }
> --
> 2.39.5
>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] arch: arm: imx: esdctl: limit ram to 1GB on imx93 in case OPTEE is enabled
@ 2025-05-01 7:20 Michael Grzeschik
0 siblings, 0 replies; 4+ messages in thread
From: Michael Grzeschik @ 2025-05-01 7:20 UTC (permalink / raw)
To: barebox
In MX93 the ELE (Edge Lock Enclave) is limited to communicate with
messages addressed under 1.5GB. The ELE can not reach the memory between
(0xE0000000-0xFFFFFFFF).
So we limit the usable memory in case OPTEE is used.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
v1 -> v2: moved the limitation to be active in imx93_barebox_entry only
---
arch/arm/mach-imx/esdctl.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-imx/esdctl.c b/arch/arm/mach-imx/esdctl.c
index 701ca0ac1f3..264ba1177ec 100644
--- a/arch/arm/mach-imx/esdctl.c
+++ b/arch/arm/mach-imx/esdctl.c
@@ -1047,9 +1047,20 @@ void __noreturn imx7d_barebox_entry(void *boarddata)
void __noreturn imx93_barebox_entry(void *boarddata)
{
+ resource_size_t mem = 0;
+
imx93_init_scratch_space(false);
optee_set_membase(imx_scratch_get_optee_hdr());
- barebox_arm_entry(MX9_DDR_CSD1_BASE_ADDR,
- imx9_ddrc_sdram_size(), boarddata);
+ mem = imx9_ddrc_sdram_size();
+ /* In MX93 the ELE is limited to comunicate with messages
+ * under 1.5GB address space. This limits the overal memory
+ * to be 1GB in case OPTEE is used.
+ */
+ if (IS_ENABLED(CONFIG_PBL_OPTEE)) {
+ if (mem > 0x40000000)
+ mem = 0x40000000;
+ }
+
+ barebox_arm_entry(MX9_DDR_CSD1_BASE_ADDR, mem, boarddata);
}
---
base-commit: 873b572763d38ab4100d218d0a3614f79b596077
change-id: 20250430-imx9optee-31d2dfc926bf
Best regards,
--
Michael Grzeschik <m.grzeschik@pengutronix.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-06-24 11:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-23 22:00 [PATCH v2] arch: arm: imx: esdctl: limit ram to 1GB on imx93 in case OPTEE is enabled Michael Grzeschik
2025-06-24 10:26 ` Sascha Hauer
2025-06-24 10:30 ` Marco Felsch
-- strict thread matches above, loose matches on Subject: below --
2025-05-01 7:20 Michael Grzeschik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox