* [PATCH 0/1] imx8m: Restrict usable memory based on rom_pointer[0]
@ 2021-08-23 2:43 Ying-Chun Liu
2021-08-23 2:43 ` [PATCH 1/1] " Ying-Chun Liu
0 siblings, 1 reply; 4+ messages in thread
From: Ying-Chun Liu @ 2021-08-23 2:43 UTC (permalink / raw)
To: u-boot; +Cc: Ying-Chun Liu (PaulLiu)
From: "Ying-Chun Liu (PaulLiu)" <paulliu@debian.org>
When TEE is loaded, we need to restrict the memory usage based
on rom_pointer[0]
This patch fixes a regression on Compulab IoT gate imx8 hang when
OPTEE runs.
Ying-Chun Liu (PaulLiu) (1):
imx8m: Restrict usable memory based on rom_pointer[0]
arch/arm/mach-imx/imx8m/soc.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
--
2.32.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/1] imx8m: Restrict usable memory based on rom_pointer[0]
2021-08-23 2:43 [PATCH 0/1] imx8m: Restrict usable memory based on rom_pointer[0] Ying-Chun Liu
@ 2021-08-23 2:43 ` Ying-Chun Liu
2021-08-24 6:30 ` Frieder Schrempf
2021-10-07 14:12 ` sbabic
0 siblings, 2 replies; 4+ messages in thread
From: Ying-Chun Liu @ 2021-08-23 2:43 UTC (permalink / raw)
To: u-boot
Cc: Ying-Chun Liu (PaulLiu), Fabio Estevam, Frieder Schrempf, uboot-imx
From: "Ying-Chun Liu (PaulLiu)" <paulliu@debian.org>
When TEE is loaded, we need to restrict the memory usage based
on rom_pointer[0]
Signed-off-by: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Frieder Schrempf <frieder.schrempf@kontron.de>
Cc: uboot-imx <uboot-imx@nxp.com>
---
arch/arm/mach-imx/imx8m/soc.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
index f2ddc834d4..863508776d 100644
--- a/arch/arm/mach-imx/imx8m/soc.c
+++ b/arch/arm/mach-imx/imx8m/soc.c
@@ -298,16 +298,26 @@ phys_size_t get_effective_memsize(void)
ulong board_get_usable_ram_top(ulong total_size)
{
+ ulong top_addr = PHYS_SDRAM + gd->ram_size;
+
/*
* Some IPs have their accessible address space restricted by
* the interconnect. Let's make sure U-Boot only ever uses the
* space below the 4G address boundary (which is 3GiB big),
* even when the effective available memory is bigger.
*/
- if (PHYS_SDRAM + gd->ram_size > 0x80000000)
- return 0x80000000;
+ if (top_addr > 0x80000000)
+ top_addr = 0x80000000;
+
+ /*
+ * rom_pointer[0] stores the TEE memory start address.
+ * rom_pointer[1] stores the size TEE uses.
+ * We need to reserve the memory region for TEE.
+ */
+ if (rom_pointer[0] && rom_pointer[1] && top_addr > rom_pointer[0])
+ top_addr = rom_pointer[0];
- return PHYS_SDRAM + gd->ram_size;
+ return top_addr;
}
static u32 get_cpu_variant_type(u32 type)
--
2.32.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] imx8m: Restrict usable memory based on rom_pointer[0]
2021-08-23 2:43 ` [PATCH 1/1] " Ying-Chun Liu
@ 2021-08-24 6:30 ` Frieder Schrempf
2021-10-07 14:12 ` sbabic
1 sibling, 0 replies; 4+ messages in thread
From: Frieder Schrempf @ 2021-08-24 6:30 UTC (permalink / raw)
To: Ying-Chun Liu, u-boot; +Cc: Ying-Chun Liu (PaulLiu), Fabio Estevam, uboot-imx
On 23.08.21 04:43, Ying-Chun Liu wrote:
> From: "Ying-Chun Liu (PaulLiu)" <paulliu@debian.org>
>
> When TEE is loaded, we need to restrict the memory usage based
> on rom_pointer[0]
>
> Signed-off-by: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
> Cc: Fabio Estevam <festevam@denx.de>
> Cc: Frieder Schrempf <frieder.schrempf@kontron.de>
> Cc: uboot-imx <uboot-imx@nxp.com>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
> ---
> arch/arm/mach-imx/imx8m/soc.c | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
> index f2ddc834d4..863508776d 100644
> --- a/arch/arm/mach-imx/imx8m/soc.c
> +++ b/arch/arm/mach-imx/imx8m/soc.c
> @@ -298,16 +298,26 @@ phys_size_t get_effective_memsize(void)
>
> ulong board_get_usable_ram_top(ulong total_size)
> {
> + ulong top_addr = PHYS_SDRAM + gd->ram_size;
> +
> /*
> * Some IPs have their accessible address space restricted by
> * the interconnect. Let's make sure U-Boot only ever uses the
> * space below the 4G address boundary (which is 3GiB big),
> * even when the effective available memory is bigger.
> */
> - if (PHYS_SDRAM + gd->ram_size > 0x80000000)
> - return 0x80000000;
> + if (top_addr > 0x80000000)
> + top_addr = 0x80000000;
> +
> + /*
> + * rom_pointer[0] stores the TEE memory start address.
> + * rom_pointer[1] stores the size TEE uses.
> + * We need to reserve the memory region for TEE.
> + */
> + if (rom_pointer[0] && rom_pointer[1] && top_addr > rom_pointer[0])
> + top_addr = rom_pointer[0];
>
> - return PHYS_SDRAM + gd->ram_size;
> + return top_addr;
> }
>
> static u32 get_cpu_variant_type(u32 type)
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/1] imx8m: Restrict usable memory based on rom_pointer[0]
2021-08-23 2:43 ` [PATCH 1/1] " Ying-Chun Liu
2021-08-24 6:30 ` Frieder Schrempf
@ 2021-10-07 14:12 ` sbabic
1 sibling, 0 replies; 4+ messages in thread
From: sbabic @ 2021-10-07 14:12 UTC (permalink / raw)
To: Ying-Chun Liu, U-Boot
> From: "Ying-Chun Liu (PaulLiu)" <paulliu@debian.org>
> When TEE is loaded, we need to restrict the memory usage based
> on rom_pointer[0]
> Signed-off-by: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
> Cc: Fabio Estevam <festevam@denx.de>
> Cc: Frieder Schrempf <frieder.schrempf@kontron.de>
> Cc: uboot-imx <uboot-imx@nxp.com>
> Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-10-07 14:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-23 2:43 [PATCH 0/1] imx8m: Restrict usable memory based on rom_pointer[0] Ying-Chun Liu
2021-08-23 2:43 ` [PATCH 1/1] " Ying-Chun Liu
2021-08-24 6:30 ` Frieder Schrempf
2021-10-07 14:12 ` sbabic
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.