[PATCH 1/6] efi_loader: use CONFIG_STACK_SIZE in the UEFI sub-system

Heinrich Schuchardt xypron.glpk at gmx.de
Wed Jul 29 17:42:30 CEST 2020


The Kconfig symbol CONFIG_STACK_SIZE is used both by ARM and Microblaze
with the same meaning. Move it to menu 'General setup' so that we can use
it for all architectures.

Use the value of CONFIG_STACK_SIZE instead of a hard coded 16 MiB value for
reserving memory in the UEFI sub-system.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 Kconfig                     | 10 ++++++++++
 arch/arm/Kconfig            | 17 -----------------
 arch/microblaze/Kconfig     |  8 --------
 lib/efi_loader/efi_memory.c |  2 +-
 4 files changed, 11 insertions(+), 26 deletions(-)

diff --git a/Kconfig b/Kconfig
index e6308f30e5..fda35f9e45 100644
--- a/Kconfig
+++ b/Kconfig
@@ -350,6 +350,16 @@ config PLATFORM_ELFENTRY
 	default "__start" if MIPS
 	default "_start"

+config STACK_SIZE
+	hex "Define max stack size that can be used by U-Boot"
+	default 0x4000000 if ARCH_VERSAL || ARCH_ZYNQMP
+	default 0x200000 if MICROBLAZE
+	default 0x1000000
+	help
+	  Define Max stack size that can be used by U-Boot. This value is used
+	  by the UEFI sub-system. On some boards initrd_high is calculated as
+	  base stack pointer minus this stack size.
+
 endmenu		# General setup

 menu "Boot images"
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index ded8cfee09..e01196e724 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -501,23 +501,6 @@ config TPL_USE_ARCH_MEMSET
 	  Such an 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 || ARCH_ZYNQMP || ARCH_ZYNQ
-	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 || ARCH_ZYNQMP
-	default 0x1000000 if ARCH_ZYNQ
-	help
-	  Define 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
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 2bd260e5d7..ff6b3c7e3d 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -20,14 +20,6 @@ config TARGET_MICROBLAZE_GENERIC

 endchoice

-config STACK_SIZE
-	hex "Define max stack size that can be used by u-boot"
-	default 0x200000
-	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.
-
 source "board/xilinx/microblaze-generic/Kconfig"

 endmenu
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index 44b8a2e09f..7be756e370 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -762,7 +762,7 @@ static void add_u_boot_and_runtime(void)
 	unsigned long runtime_start, runtime_end, runtime_pages;
 	unsigned long runtime_mask = EFI_PAGE_MASK;
 	unsigned long uboot_start, uboot_pages;
-	unsigned long uboot_stack_size = 16 * 1024 * 1024;
+	unsigned long uboot_stack_size = CONFIG_STACK_SIZE;

 	/* Add U-Boot */
 	uboot_start = ((uintptr_t)map_sysmem(gd->start_addr_sp, 0) -
--
2.27.0



More information about the U-Boot mailing list