arm64: versal: Set initrd_high to as high as possible
authorSiva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Mon, 5 Aug 2019 17:58:30 +0000 (23:28 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 8 Oct 2019 07:11:14 +0000 (09:11 +0200)
This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
arch/arm/Kconfig
board/xilinx/versal/board.c
include/configs/xilinx_versal.h

index a93138a..33cb3e0 100644 (file)
@@ -462,6 +462,22 @@ config TPL_USE_ARCH_MEMSET
          Such implementation may be faster under some conditions
          but may increase the binary size.
 
+config SET_STACK_SIZE
+       bool "Enable an option to set max stack size that can be used"
+       default y if ARCH_VERSAL
+       help
+         This will enable an option to set max stack size that can be
+         used by u-boot.
+
+config STACK_SIZE
+       hex "Define max stack size that can be used by u-boot"
+       depends on SET_STACK_SIZE
+       default 0x4000000 if ARCH_VERSAL
+       help
+         Defines Max stack size that can be used by u-boot so that the
+         initrd_high will be calculated as base stack pointer minus this
+         stack size.
+
 config ARM64_SUPPORT_AARCH32
        bool "ARM64 system support AArch32 execution state"
        depends on ARM64
index a2b00aa..2b4edd8 100644 (file)
@@ -12,6 +12,7 @@
 #include <dm/device.h>
 #include <dm/uclass.h>
 #include <versalpl.h>
+#include <linux/sizes.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -88,6 +89,7 @@ int board_late_init(void)
        const char *mode;
        char *new_targets;
        char *env_targets;
+       ulong initrd_hi;
 
        if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
                debug("Saved variables - Skipping\n");
@@ -183,6 +185,10 @@ int board_late_init(void)
 
        env_set("boot_targets", new_targets);
 
+       initrd_hi = gd->start_addr_sp - CONFIG_STACK_SIZE;
+       initrd_hi = round_down(initrd_hi, SZ_16M);
+       env_set_addr("initrd_high", (void *)initrd_hi);
+
        return 0;
 }
 
index 296f450..1e0951c 100644 (file)
@@ -65,7 +65,6 @@
 
 #define ENV_MEM_LAYOUT_SETTINGS \
        "fdt_high=10000000\0" \
-       "initrd_high=10000000\0" \
        "fdt_addr_r=0x40000000\0" \
        "pxefile_addr_r=0x10000000\0" \
        "kernel_addr_r=0x18000000\0" \