diff mbox series

[RESEND,4/6] imx8m: Restrict usable memory to space below 4G boundary

Message ID 20210607123707.189163-5-frieder@fris.de
State Accepted
Commit e27bddff4b97598baaa7186196ebfb28075f702c
Delegated to: Stefano Babic
Headers show
Series Add support for Kontron i.MX6UL/ULL and i.MX8MM modules/boards | expand

Commit Message

Frieder Schrempf June 7, 2021, 12:36 p.m. UTC
From: Frieder Schrempf <frieder.schrempf@kontron.de>

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.

We implement board_get_usable_ram_top() for all i.MX8M SoCs, as the
whole family is affected by this.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
---
 arch/arm/mach-imx/imx8m/soc.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Stefano Babic July 10, 2021, 3:53 p.m. UTC | #1
> From: Frieder Schrempf <frieder.schrempf@kontron.de>
> 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.
> We implement board_get_usable_ram_top() for all i.MX8M SoCs, as the
> whole family is affected by this.
> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
Stefano Babic July 10, 2021, 7:36 p.m. UTC | #2
> From: Frieder Schrempf <frieder.schrempf@kontron.de>
> 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.
> We implement board_get_usable_ram_top() for all i.MX8M SoCs, as the
> whole family is affected by this.
> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
index 0c44022a6d..f5983320c7 100644
--- a/arch/arm/mach-imx/imx8m/soc.c
+++ b/arch/arm/mach-imx/imx8m/soc.c
@@ -296,6 +296,20 @@  phys_size_t get_effective_memsize(void)
 #endif
 }
 
+ulong board_get_usable_ram_top(ulong total_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;
+
+	return PHYS_SDRAM + gd->ram_size;
+}
+
 static u32 get_cpu_variant_type(u32 type)
 {
 	struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;