vexpress64: fix various memory issues

Message ID 1431331437-27890-1-git-send-email-linus.walleij@linaro.org
State New
Headers show

Commit Message

Linus Walleij May 11, 2015, 8:03 a.m.
The ARM Trusted Firmware or other security solutions are
eating memory from the top of the physical SDRAM1 space,
moving backward from 0xffffffff, currently occupying e.g.
0xfe000000-0xffffffff with Trusted Firmware.

This solution to reserving memory for secure world is not
optimal, so we need to think of how the secure world and
earlier boot stages should communicate to U-Boot what
memory they are eating up. For now let's just put 16MB
aside.

Also enable the memory test command and define start and
end of the test range so we can check that we actually have
all that memory available and working.

Suggested-by: Axel Haslam <ahaslam@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 include/configs/vexpress_aemv8a.h | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Comments

Linus Walleij May 27, 2015, 7:47 a.m. | #1
On Mon, May 11, 2015 at 10:03 AM, Linus Walleij
<linus.walleij@linaro.org> wrote:

> The ARM Trusted Firmware or other security solutions are
> eating memory from the top of the physical SDRAM1 space,
> moving backward from 0xffffffff, currently occupying e.g.
> 0xfe000000-0xffffffff with Trusted Firmware.
>
> This solution to reserving memory for secure world is not
> optimal, so we need to think of how the secure world and
> earlier boot stages should communicate to U-Boot what
> memory they are eating up. For now let's just put 16MB
> aside.
>
> Also enable the memory test command and define start and
> end of the test range so we can check that we actually have
> all that memory available and working.
>
> Suggested-by: Axel Haslam <ahaslam@baylibre.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Ping on this.

Yours,
Linus Walleij

Patch

diff --git a/include/configs/vexpress_aemv8a.h b/include/configs/vexpress_aemv8a.h
index 032010bb9e02..371e85b8f7be 100644
--- a/include/configs/vexpress_aemv8a.h
+++ b/include/configs/vexpress_aemv8a.h
@@ -113,9 +113,6 @@ 
 #endif
 #endif /* !CONFIG_GICV3 */
 
-#define CONFIG_SYS_MEMTEST_START	V2M_BASE
-#define CONFIG_SYS_MEMTEST_END		(V2M_BASE + 0x80000000)
-
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_F_LEN		0x2000
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (8 << 20))
@@ -182,8 +179,15 @@ 
 /* Physical Memory Map */
 #define CONFIG_NR_DRAM_BANKS		1
 #define PHYS_SDRAM_1			(V2M_BASE)	/* SDRAM Bank #1 */
-#define PHYS_SDRAM_1_SIZE		0x80000000	/* 2048 MB */
-#define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM_1
+/* Top 16MB reserved for secure world use */
+#define DRAM_SEC_SIZE		0x01000000
+#define PHYS_SDRAM_1_SIZE	0x80000000 - DRAM_SEC_SIZE
+#define CONFIG_SYS_SDRAM_BASE	PHYS_SDRAM_1
+
+/* Enable memtest */
+#define CONFIG_CMD_MEMTEST
+#define CONFIG_SYS_MEMTEST_START	PHYS_SDRAM_1
+#define CONFIG_SYS_MEMTEST_END		(PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE)
 
 /* Initial environment variables */
 #ifdef CONFIG_TARGET_VEXPRESS64_JUNO