Skip to contentSkip to conversation

Simplify image size checks

PATCH Superseded Philip Oberfichtner 4 participants 34 messages Sep 3, 2025 – Oct 10, 2025

Subsystems (9)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover Simplify image size checks

This patch series aims at simplifying and harmonizing image size checks, which are currently represented by the following Kconfig symbols:

CONFIG_HAS_BOARD_SIZE_LIMIT
CONFIG_BOARD_SIZE_LIMIT
CONFIG_SPL_SIZE_LIMIT
CONFIG_TPL_SIZE_LIMIT
CONFIG_VPL_SIZE_LIMIT

After this series, we would have
- Less code duplication in the toplevel Makefile
- Consistent logic for all the different CONFIGS
- All related options in one place

Changes in v3:
V3 is a complete remake of the series. In the discussions on V2 we decided to follow the approach of using CONFIG_HAS_XXX_SIZE_LIMIT instead of my initial proposal, which was to disable a size check by setting its limit to zero.

Changes in v2:
- Rebase on current master
- Rebase on my pending mips patch series (linked above)
- Incorporated Heinrich's Review

Philip Oberfichtner (5):
Image size checks: Move all configs in one place Image size checks: Use HAS_SIZE_LIMIT consistently Image size checks: Use consistent help texts Image size checks: Deduplicate Makefile Image size checks: Simplify SPL_SIZE_LIMIT logic

 Kconfig                                   | 73 ++++++++++++++++++++++-
 Makefile                                  | 45 ++++----------
 arch/arm/mach-socfpga/Kconfig             |  5 +-
 arch/mips/mach-mtmips/Kconfig             |  5 +-
 arch/x86/cpu/apollolake/Kconfig           |  5 +-
 common/spl/Kconfig                        | 38 ------------
 common/spl/Kconfig.tpl                    |  7 ---
 common/spl/Kconfig.vpl                    |  7 ---
 configs/am62ax_evm_r5_defconfig           |  1 +
 configs/am62px_evm_r5_defconfig           |  1 +
 configs/am62x_beagleplay_a53_defconfig    |  1 +
 configs/am62x_beagleplay_r5_defconfig     |  1 +
 configs/am62x_evm_a53_defconfig           |  1 +
 configs/am62x_evm_a53_ethboot_defconfig   |  1 +
 configs/am62x_evm_r5_defconfig            |  1 +
 configs/am64x_evm_r5_defconfig            |  1 +
 configs/am65x_evm_r5_defconfig            |  1 +
 configs/am65x_evm_r5_usbmsc_defconfig     |  1 +
 configs/am67a_beagley_ai_r5_defconfig     |  1 +
 configs/brcp150_defconfig                 |  1 +
 configs/brcp170_defconfig                 |  1 +
 configs/brcp1_1r_defconfig                |  1 +
 configs/brcp1_1r_switch_defconfig         |  1 +
 configs/brcp1_2r_defconfig                |  1 +
 configs/brsmarc2_defconfig                |  1 +
 configs/evb-ast2600_defconfig             |  1 +
 configs/evb-rk3288_defconfig              |  1 +
 configs/firefly-rk3288_defconfig          |  1 +
 configs/ibex-ast2700_defconfig            |  1 +
 configs/ibm-sbp1_defconfig                |  1 +
 configs/imx28_btt3_defconfig              |  1 +
 configs/imx28_xea_defconfig               |  1 +
 configs/imx6q_bosch_acc_defconfig         |  1 +
 configs/imxrt1020-evk_defconfig           |  1 +
 configs/imxrt1050-evk_defconfig           |  1 +
 configs/imxrt1050-evk_fspi_defconfig      |  1 +
 configs/imxrt1170-evk_defconfig           |  1 +
 configs/j721e_beagleboneai64_r5_defconfig |  1 +
 configs/j721e_evm_r5_defconfig            |  1 +
 configs/j721s2_evm_r5_defconfig           |  1 +
 configs/j722s_evm_r5_defconfig            |  1 +
 configs/j784s4_evm_r5_defconfig           |  1 +
 configs/kontron_sl28_defconfig            |  1 +
 configs/phycore_am62ax_r5_defconfig       |  1 +
 configs/phycore_am62x_a53_defconfig       |  1 +
 configs/phycore_am62x_r5_defconfig        |  1 +
 configs/phycore_am64x_r5_defconfig        |  1 +
 configs/stm32746g-eval_spl_defconfig      |  1 +
 configs/stm32f746-disco_spl_defconfig     |  1 +
 configs/stm32f769-disco_spl_defconfig     |  1 +
 configs/tinker-rk3288_defconfig           |  1 +
 configs/tinker-s-rk3288_defconfig         |  1 +
 configs/verdin-am62_a53_defconfig         |  1 +
 configs/verdin-am62_r5_defconfig          |  1 +
 configs/verdin-am62p_a53_defconfig        |  1 +
 configs/verdin-am62p_r5_defconfig         |  1 +
 configs/xilinx_mbv32_defconfig            |  1 +
 configs/xilinx_mbv32_smode_defconfig      |  1 +
 configs/xilinx_mbv64_defconfig            |  1 +
 configs/xilinx_mbv64_smode_defconfig      |  1 +
 configs/xilinx_zynqmp_kria_defconfig      |  1 +
 configs/xilinx_zynqmp_virt_defconfig      |  1 +
 tools/spl_size_limit.c                    |  4 +-
 63 files changed, 151 insertions(+), 92 deletions(-)
Signature · 1 line
2.39.5
#1 lore raw

PATCH v3 1/5 Image size checks: Move all configs in one place

How image size limiting works in U-Boot should be easier to grasp if we have all related options in one place.

---
 Kconfig                | 59 ++++++++++++++++++++++++++++++++++++++++++
 common/spl/Kconfig     | 38 ---------------------------
 common/spl/Kconfig.tpl |  7 -----
 common/spl/Kconfig.vpl |  7 -----
 4 files changed, 59 insertions(+), 52 deletions(-)
Kconfig +59 -0
index 70125c4e5a6..f1a6be299e8 100644
@@ -535,6 +535,8 @@ config BUILD_TARGET
 	  special image will be automatically built upon calling
 	  make / buildman.
 
+menu "Image size limits"
+
 config HAS_BOARD_SIZE_LIMIT
 	bool "Define a maximum size for the U-Boot image"
 	depends on !COMPILE_TEST
@@ -554,6 +556,63 @@ config BOARD_SIZE_LIMIT
 	  include SPL nor TPL, on platforms that use that functionality, they
 	  have separate options to restrict size.
 
+config VPL_SIZE_LIMIT
+	depends on VPL
+	hex "Maximum size of VPL image"
+	default 0x0
+	help
+	  Specifies the maximum length of the U-Boot VPL image.
+	  If this value is zero, it is ignored.
+
+config TPL_SIZE_LIMIT
+	depends on TPL
+	hex "Maximum size of TPL image"
+	default 0x0
+	help
+	  Specifies the maximum length of the U-Boot TPL image.
+	  If this value is zero, it is ignored.
+
+config SPL_SIZE_LIMIT
+	depends on SPL
+	hex "Maximum size of SPL image"
+	default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB
+	default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
+	default 0x30000 if ARCH_MVEBU && ARMADA_32BIT
+	default 0x0
+	help
+	  Specifies the maximum length of the U-Boot SPL image.
+	  If this value is zero, it is ignored.
+
+config SPL_SIZE_LIMIT_SUBTRACT_GD
+	bool "SPL image size check: provide space for global data"
+	depends on SPL_SIZE_LIMIT > 0
+	help
+	  If enabled, aligned size of global data is reserved in
+	  SPL_SIZE_LIMIT check to ensure such an image does not overflow SRAM
+	  if SPL_SIZE_LIMIT describes the size of SRAM available for SPL when
+	  pre-reloc global data is put into this SRAM, too.
+
+config SPL_SIZE_LIMIT_SUBTRACT_MALLOC
+	bool "SPL image size check: provide space for malloc() pool before relocation"
+	depends on SPL_SIZE_LIMIT > 0
+	help
+	  If enabled, SPL_SYS_MALLOC_F_LEN is reserved in SPL_SIZE_LIMIT check
+	  to ensure such an image does not overflow SRAM if SPL_SIZE_LIMIT
+	  describes the size of SRAM available for SPL when pre-reloc malloc
+	  pool is put into this SRAM, too.
+
+config SPL_SIZE_LIMIT_PROVIDE_STACK
+	hex "SPL image size check: provide stack space before relocation"
+	depends on SPL_SIZE_LIMIT > 0
+	default 0x0
+	help
+	  If set, this size is reserved in SPL_SIZE_LIMIT check to ensure such
+	  an image does not overflow SRAM if SPL_SIZE_LIMIT describes the size
+	  of SRAM available for SPL when the stack required before reolcation
+	  uses this SRAM, too.
+
+endmenu
+
 config SYS_CUSTOM_LDSCRIPT
 	bool "Use a custom location for the U-Boot linker script"
 	depends on !COMPILE_TEST
common/spl/Kconfig +0 -38
index ab05536bd02..87a56bd8f8a 100644
@@ -36,44 +36,6 @@ config SPL_FRAMEWORK_BOARD_INIT_F
 	  - initialize the serial (preloader_console_init)
 	  Unless you want to provide your own board_init_f, you should say Y.
 
-config SPL_SIZE_LIMIT
-	hex "Maximum size of SPL image"
-	default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB
-	default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
-	default 0x30000 if ARCH_MVEBU && ARMADA_32BIT
-	default 0x0
-	help
-	  Specifies the maximum length of the U-Boot SPL image.
-	  If this value is zero, it is ignored.
-
-config SPL_SIZE_LIMIT_SUBTRACT_GD
-	bool "SPL image size check: provide space for global data"
-	depends on SPL_SIZE_LIMIT > 0
-	help
-	  If enabled, aligned size of global data is reserved in
-	  SPL_SIZE_LIMIT check to ensure such an image does not overflow SRAM
-	  if SPL_SIZE_LIMIT describes the size of SRAM available for SPL when
-	  pre-reloc global data is put into this SRAM, too.
-
-config SPL_SIZE_LIMIT_SUBTRACT_MALLOC
-	bool "SPL image size check: provide space for malloc() pool before relocation"
-	depends on SPL_SIZE_LIMIT > 0
-	help
-	  If enabled, SPL_SYS_MALLOC_F_LEN is reserved in SPL_SIZE_LIMIT check
-	  to ensure such an image does not overflow SRAM if SPL_SIZE_LIMIT
-	  describes the size of SRAM available for SPL when pre-reloc malloc
-	  pool is put into this SRAM, too.
-
-config SPL_SIZE_LIMIT_PROVIDE_STACK
-	hex "SPL image size check: provide stack space before relocation"
-	depends on SPL_SIZE_LIMIT > 0
-	default 0x0
-	help
-	  If set, this size is reserved in SPL_SIZE_LIMIT check to ensure such
-	  an image does not overflow SRAM if SPL_SIZE_LIMIT describes the size
-	  of SRAM available for SPL when the stack required before reolcation
-	  uses this SRAM, too.
-
 config SPL_MAX_SIZE
 	hex "Maximum size of the SPL image, excluding BSS"
 	default 0x30000 if ARCH_MX6 && MX6_OCRAM_256KB
common/spl/Kconfig.tpl +0 -7
index a535b61ecd3..515bbeec685 100644
@@ -1,13 +1,6 @@
 menu "TPL configuration options"
 	depends on TPL
 
-config TPL_SIZE_LIMIT
-	hex "Maximum size of TPL image"
-	default 0x0
-	help
-	  Specifies the maximum length of the U-Boot TPL image.
-	  If this value is zero, it is ignored.
-
 config TPL_BINMAN_SYMBOLS
 	bool "Support binman symbols in TPL"
 	depends on TPL_FRAMEWORK && BINMAN
common/spl/Kconfig.vpl +0 -7
index 434562443ac..739f2805315 100644
@@ -220,13 +220,6 @@ config VPL_SERIAL
 	  Enable support for serial in VPL. See SPL_SERIAL for
 	  details.
 
-config VPL_SIZE_LIMIT
-	hex "Maximum size of VPL image"
-	default 0x0
-	help
-	  Specifies the maximum length of the U-Boot VPL image.
-	  If this value is zero, it is ignored.
-
 config VPL_SPI
 	bool "Support SPI drivers"
 	help
Signature · 1 line
2.39.5
#2 lore raw

Re: [PATCH v3 1/5] Image size checks: Move all configs in one place

Quoted 33 lines · Philip Oberfichtner

How image size limiting works in U-Boot should be easier to grasp if we have all related options in one place.

---
  Kconfig                | 59 ++++++++++++++++++++++++++++++++++++++++++
  common/spl/Kconfig     | 38 ---------------------------
  common/spl/Kconfig.tpl |  7 -----
  common/spl/Kconfig.vpl |  7 -----
  4 files changed, 59 insertions(+), 52 deletions(-)
Kconfig +7 -0
index 70125c4e5a6..f1a6be299e8 100644
@@ -535,6 +535,8 @@ config BUILD_TARGET
  	  special image will be automatically built upon calling
  	  make / buildman.
 
+menu "Image size limits"
+
  config HAS_BOARD_SIZE_LIMIT
  	bool "Define a maximum size for the U-Boot image"
  	depends on !COMPILE_TEST
@@ -554,6 +556,63 @@ config BOARD_SIZE_LIMIT
  	  include SPL nor TPL, on platforms that use that functionality, they
  	  have separate options to restrict size.
 
+config VPL_SIZE_LIMIT
+	depends on VPL
+	hex "Maximum size of VPL image"
+	default 0x0
+	help

Kconfig config BOARD_SIZE_LIMIT · line 573

Quoted 10 lines
Kconfig +10 -0
+	  Specifies the maximum length of the U-Boot VPL image.
+	  If this value is zero, it is ignored.
+
+config TPL_SIZE_LIMIT
+	depends on TPL
+	hex "Maximum size of TPL image"
+	default 0x0
+	help
+	  Specifies the maximum length of the U-Boot TPL image.
+	  If this value is zero, it is ignored.

The point of separate common/spl/Kconfig.tpl and common/spl/Kconfig.vpl files is to group SPL / TPL / VPL symbols in those files .

#3 lore raw

Re: [PATCH v3 1/5] Image size checks: Move all configs in one place

Quoted 36 lines · Marek Vasut
Quoted 35 lines · Philip Oberfichtner

How image size limiting works in U-Boot should be easier to grasp if we have all related options in one place.

---
  Kconfig                | 59 ++++++++++++++++++++++++++++++++++++++++++
  common/spl/Kconfig     | 38 ---------------------------
  common/spl/Kconfig.tpl |  7 -----
  common/spl/Kconfig.vpl |  7 -----
  4 files changed, 59 insertions(+), 52 deletions(-)
Kconfig +11 -0
index 70125c4e5a6..f1a6be299e8 100644
@@ -535,6 +535,8 @@ config BUILD_TARGET
  	  special image will be automatically built upon calling
  	  make / buildman.
+menu "Image size limits"
+
  config HAS_BOARD_SIZE_LIMIT
  	bool "Define a maximum size for the U-Boot image"
  	depends on !COMPILE_TEST
@@ -554,6 +556,63 @@ config BOARD_SIZE_LIMIT
  	  include SPL nor TPL, on platforms that use that functionality, they
  	  have separate options to restrict size.
+config VPL_SIZE_LIMIT
+	depends on VPL
+	hex "Maximum size of VPL image"
+	default 0x0
+	help
+	  Specifies the maximum length of the U-Boot VPL image.
+	  If this value is zero, it is ignored.
+
+config TPL_SIZE_LIMIT
Quoted 8 lines

Kconfig config BOARD_SIZE_LIMIT · line 573

Quoted 6 lines
Kconfig +6 -0
+	depends on TPL
+	hex "Maximum size of TPL image"
+	default 0x0
+	help
+	  Specifies the maximum length of the U-Boot TPL image.
+	  If this value is zero, it is ignored.

The point of separate common/spl/Kconfig.tpl and common/spl/Kconfig.vpl files is to group SPL / TPL / VPL symbols in those files .

There is "config TPL_" definitions literally all over the place. I think there might actually even be more of them outside Kconfig.tpl than inside.

#4 lore raw

Re: [PATCH v3 1/5] Image size checks: Move all configs in one place

Quoted 46 lines · Philip Oberfichtner
Quoted 36 lines · Marek Vasut
Quoted 35 lines · Philip Oberfichtner

How image size limiting works in U-Boot should be easier to grasp if we have all related options in one place.

---
   Kconfig                | 59 ++++++++++++++++++++++++++++++++++++++++++
   common/spl/Kconfig     | 38 ---------------------------
   common/spl/Kconfig.tpl |  7 -----
   common/spl/Kconfig.vpl |  7 -----
   4 files changed, 59 insertions(+), 52 deletions(-)
Kconfig +11 -0
index 70125c4e5a6..f1a6be299e8 100644
@@ -535,6 +535,8 @@ config BUILD_TARGET
   	  special image will be automatically built upon calling
   	  make / buildman.
+menu "Image size limits"
+
   config HAS_BOARD_SIZE_LIMIT
   	bool "Define a maximum size for the U-Boot image"
   	depends on !COMPILE_TEST
@@ -554,6 +556,63 @@ config BOARD_SIZE_LIMIT
   	  include SPL nor TPL, on platforms that use that functionality, they
   	  have separate options to restrict size.
+config VPL_SIZE_LIMIT
+	depends on VPL
+	hex "Maximum size of VPL image"
+	default 0x0
+	help
+	  Specifies the maximum length of the U-Boot VPL image.
+	  If this value is zero, it is ignored.
+
+config TPL_SIZE_LIMIT
Quoted 8 lines

Kconfig config BOARD_SIZE_LIMIT · line 573

Quoted 6 lines
Kconfig +6 -0
+	depends on TPL
+	hex "Maximum size of TPL image"
+	default 0x0
+	help
+	  Specifies the maximum length of the U-Boot TPL image.
+	  If this value is zero, it is ignored.

The point of separate common/spl/Kconfig.tpl and common/spl/Kconfig.vpl files is to group SPL / TPL / VPL symbols in those files .

Quoted 3 lines

There is "config TPL_" definitions literally all over the place. I think there might actually even be more of them outside Kconfig.tpl than inside.

That does not make it OK to make that situation worse.

This config TPL... should be in common/spl/Kconfig.tpl .

#5 lore raw

Re: [PATCH v3 1/5] Image size checks: Move all configs in one place

Quoted 47 lines · Marek Vasut
Quoted 46 lines · Philip Oberfichtner
Quoted 44 lines · Marek Vasut
Quoted 31 lines · Philip Oberfichtner

How image size limiting works in U-Boot should be easier to grasp if we have all related options in one place.

---
   Kconfig                | 59 ++++++++++++++++++++++++++++++++++++++++++
   common/spl/Kconfig     | 38 ---------------------------
   common/spl/Kconfig.tpl |  7 -----
   common/spl/Kconfig.vpl |  7 -----
   4 files changed, 59 insertions(+), 52 deletions(-)
Kconfig +7 -0
index 70125c4e5a6..f1a6be299e8 100644
@@ -535,6 +535,8 @@ config BUILD_TARGET
   	  special image will be automatically built upon calling
   	  make / buildman.
+menu "Image size limits"
+
   config HAS_BOARD_SIZE_LIMIT
   	bool "Define a maximum size for the U-Boot image"
   	depends on !COMPILE_TEST
@@ -554,6 +556,63 @@ config BOARD_SIZE_LIMIT
   	  include SPL nor TPL, on platforms that use that functionality, they
   	  have separate options to restrict size.
+config VPL_SIZE_LIMIT
+	depends on VPL
+	hex "Maximum size of VPL image"
+	default 0x0
+	help

Kconfig config BOARD_SIZE_LIMIT · line 572

Quoted 10 lines
Kconfig +10 -0
+	  Specifies the maximum length of the U-Boot VPL image.
+	  If this value is zero, it is ignored.
+
+config TPL_SIZE_LIMIT
+	depends on TPL
+	hex "Maximum size of TPL image"
+	default 0x0
+	help
+	  Specifies the maximum length of the U-Boot TPL image.
+	  If this value is zero, it is ignored.

The point of separate common/spl/Kconfig.tpl and common/spl/Kconfig.vpl files is to group SPL / TPL / VPL symbols in those files .

Quoted 5 lines
Quoted 3 lines

There is "config TPL_" definitions literally all over the place. I think there might actually even be more of them outside Kconfig.tpl than inside.

That does not make it OK to make that situation worse.

It doesn't. Someone who stumbles over BOARD_SIZE_LIMIT might be asking himself, if there's an analogous option for SPL, too. It'll jump right into his eyes, after this patch of mine.

And apparently there were other contributers before me who found it reasonable to group strongly related options together within one menu, instead of spreading them out over many different places. Let me give you a few examples (and this list is by far not exhaustive):

Kconfig:
config SYS_MALLOC_F
config SPL_SYS_MALLOC_F
config TPL_SYS_MALLOC_F
config VPL_SYS_MALLOC_F

arch/Kconfig
menu "Skipping low level initialization functions" config SKIP_LOWLEVEL_INIT
config SPL_SKIP_LOWLEVEL_INIT
config TPL_SKIP_LOWLEVEL_INIT

boot/Kconfig
menuconfig FIT
config SPL_FIT
config VPL_FIT
config TPL_FIT

common/Kconfig
menu "Logging"
config LOG
config SPL_LOG
config TPL_LOG
config VPL_LOG

dts/Kconfig
menu "Device Tree Control"
config OF_CONTROL
config SPL_OF_CONTROL
config TPL_OF_CONTROL
config VPL_OF_CONTROL

lib/Kconfig
menu "Compression Support"
config LZ4
config SPL_LZ4
config TPL_LZ4
config VPL_LZ4

So how do these and many other cases differ from the SIZE_LIMIT case discussed here? Or would it be better to tear all those menus apart?

#6 lore raw

Re: [PATCH v3 1/5] Image size checks: Move all configs in one place

Quoted 105 lines · Philip Oberfichtner
Quoted 47 lines · Marek Vasut
Quoted 46 lines · Philip Oberfichtner
Quoted 44 lines · Marek Vasut
Quoted 31 lines · Philip Oberfichtner

How image size limiting works in U-Boot should be easier to grasp if we have all related options in one place.

---
   Kconfig                | 59 ++++++++++++++++++++++++++++++++++++++++++
   common/spl/Kconfig     | 38 ---------------------------
   common/spl/Kconfig.tpl |  7 -----
   common/spl/Kconfig.vpl |  7 -----
   4 files changed, 59 insertions(+), 52 deletions(-)
Kconfig +7 -0
index 70125c4e5a6..f1a6be299e8 100644
@@ -535,6 +535,8 @@ config BUILD_TARGET
   	  special image will be automatically built upon calling
   	  make / buildman.
+menu "Image size limits"
+
   config HAS_BOARD_SIZE_LIMIT
   	bool "Define a maximum size for the U-Boot image"
   	depends on !COMPILE_TEST
@@ -554,6 +556,63 @@ config BOARD_SIZE_LIMIT
   	  include SPL nor TPL, on platforms that use that functionality, they
   	  have separate options to restrict size.
+config VPL_SIZE_LIMIT
+	depends on VPL
+	hex "Maximum size of VPL image"
+	default 0x0
+	help

Kconfig config BOARD_SIZE_LIMIT · line 572

Quoted 10 lines
Kconfig +10 -0
+	  Specifies the maximum length of the U-Boot VPL image.
+	  If this value is zero, it is ignored.
+
+config TPL_SIZE_LIMIT
+	depends on TPL
+	hex "Maximum size of TPL image"
+	default 0x0
+	help
+	  Specifies the maximum length of the U-Boot TPL image.
+	  If this value is zero, it is ignored.

The point of separate common/spl/Kconfig.tpl and common/spl/Kconfig.vpl files is to group SPL / TPL / VPL symbols in those files .

Quoted 5 lines
Quoted 3 lines

There is "config TPL_" definitions literally all over the place. I think there might actually even be more of them outside Kconfig.tpl than inside.

That does not make it OK to make that situation worse.

It doesn't. Someone who stumbles over BOARD_SIZE_LIMIT might be asking himself, if there's an analogous option for SPL, too. It'll jump right into his eyes, after this patch of mine.

And apparently there were other contributers before me who found it reasonable to group strongly related options together within one menu, instead of spreading them out over many different places. Let me give you a few examples (and this list is by far not exhaustive):

Kconfig:
config SYS_MALLOC_F
config SPL_SYS_MALLOC_F
config TPL_SYS_MALLOC_F
config VPL_SYS_MALLOC_F

arch/Kconfig
menu "Skipping low level initialization functions" config SKIP_LOWLEVEL_INIT
config SPL_SKIP_LOWLEVEL_INIT
config TPL_SKIP_LOWLEVEL_INIT

boot/Kconfig
menuconfig FIT
config SPL_FIT
config VPL_FIT
config TPL_FIT

common/Kconfig
menu "Logging"
config LOG
config SPL_LOG
config TPL_LOG
config VPL_LOG

dts/Kconfig
menu "Device Tree Control"
config OF_CONTROL
config SPL_OF_CONTROL
config TPL_OF_CONTROL
config VPL_OF_CONTROL

lib/Kconfig
menu "Compression Support"
config LZ4
config SPL_LZ4
config TPL_LZ4
config VPL_LZ4

Quoted 2 lines

So how do these and many other cases differ from the SIZE_LIMIT case discussed here? Or would it be better to tear all those menus apart?

We are not consistent about this, and it really becomes a stylistic argument. Roughly speaking, common/spl/Kconfig.* is for things core to a given phase (SPL, TPL, VPL) which is why often but not always, say compression algorithms are with the compression algorithms. In this case, limits are a core part of the phase so I think Marek's point is valid here.

Signature · 1 line
Tom
#7 lore raw

Re: [PATCH v3 1/5] Image size checks: Move all configs in one place

Quoted 109 lines · Tom Rini
Quoted 105 lines · Philip Oberfichtner
Quoted 47 lines · Marek Vasut
Quoted 46 lines · Philip Oberfichtner
Quoted 44 lines · Marek Vasut
Quoted 31 lines · Philip Oberfichtner

How image size limiting works in U-Boot should be easier to grasp if we have all related options in one place.

---
   Kconfig                | 59 ++++++++++++++++++++++++++++++++++++++++++
   common/spl/Kconfig     | 38 ---------------------------
   common/spl/Kconfig.tpl |  7 -----
   common/spl/Kconfig.vpl |  7 -----
   4 files changed, 59 insertions(+), 52 deletions(-)
Kconfig +7 -0
index 70125c4e5a6..f1a6be299e8 100644
@@ -535,6 +535,8 @@ config BUILD_TARGET
   	  special image will be automatically built upon calling
   	  make / buildman.
+menu "Image size limits"
+
   config HAS_BOARD_SIZE_LIMIT
   	bool "Define a maximum size for the U-Boot image"
   	depends on !COMPILE_TEST
@@ -554,6 +556,63 @@ config BOARD_SIZE_LIMIT
   	  include SPL nor TPL, on platforms that use that functionality, they
   	  have separate options to restrict size.
+config VPL_SIZE_LIMIT
+	depends on VPL
+	hex "Maximum size of VPL image"
+	default 0x0
+	help

Kconfig config BOARD_SIZE_LIMIT · line 572

Quoted 10 lines
Kconfig +10 -0
+	  Specifies the maximum length of the U-Boot VPL image.
+	  If this value is zero, it is ignored.
+
+config TPL_SIZE_LIMIT
+	depends on TPL
+	hex "Maximum size of TPL image"
+	default 0x0
+	help
+	  Specifies the maximum length of the U-Boot TPL image.
+	  If this value is zero, it is ignored.

The point of separate common/spl/Kconfig.tpl and common/spl/Kconfig.vpl files is to group SPL / TPL / VPL symbols in those files .

Quoted 5 lines
Quoted 3 lines

There is "config TPL_" definitions literally all over the place. I think there might actually even be more of them outside Kconfig.tpl than inside.

That does not make it OK to make that situation worse.

It doesn't. Someone who stumbles over BOARD_SIZE_LIMIT might be asking himself, if there's an analogous option for SPL, too. It'll jump right into his eyes, after this patch of mine.

And apparently there were other contributers before me who found it reasonable to group strongly related options together within one menu, instead of spreading them out over many different places. Let me give you a few examples (and this list is by far not exhaustive):

Kconfig:
config SYS_MALLOC_F
config SPL_SYS_MALLOC_F
config TPL_SYS_MALLOC_F
config VPL_SYS_MALLOC_F

arch/Kconfig
menu "Skipping low level initialization functions" config SKIP_LOWLEVEL_INIT
config SPL_SKIP_LOWLEVEL_INIT
config TPL_SKIP_LOWLEVEL_INIT

boot/Kconfig
menuconfig FIT
config SPL_FIT
config VPL_FIT
config TPL_FIT

common/Kconfig
menu "Logging"
config LOG
config SPL_LOG
config TPL_LOG
config VPL_LOG

dts/Kconfig
menu "Device Tree Control"
config OF_CONTROL
config SPL_OF_CONTROL
config TPL_OF_CONTROL
config VPL_OF_CONTROL

lib/Kconfig
menu "Compression Support"
config LZ4
config SPL_LZ4
config TPL_LZ4
config VPL_LZ4

Quoted 2 lines

So how do these and many other cases differ from the SIZE_LIMIT case discussed here? Or would it be better to tear all those menus apart?

Quoted 6 lines

We are not consistent about this, and it really becomes a stylistic argument. Roughly speaking, common/spl/Kconfig.* is for things core to a given phase (SPL, TPL, VPL) which is why often but not always, say compression algorithms are with the compression algorithms. In this case, limits are a core part of the phase so I think Marek's point is valid here.

Okay. Thanks for the clarification.

#8 lore raw

PATCH v3 2/5 Image size checks: Use HAS_SIZE_LIMIT consistently

In reply to Philip Oberfichtner

Use a consistent logic for image size checks. No functional change.

Before this commit, there were two concurrent approaches of how image size checks are disabled: Whereas BOARD_SIZE_LIMIT was gated through a dedicated Kconfig symbol to achieve this, all the other size checks were disabled by assigning them a limit of zero bytes.

By this commit we achieve a consistent logic for size limiting, by introducing CONFIG_HAS_XXX_SIZE_LIMIT for all those options that don't have it yet.

---
 Kconfig                                   | 30 ++++++++++++++++-------
 Makefile                                  |  6 ++---
 arch/arm/mach-socfpga/Kconfig             |  5 +++-
 arch/mips/mach-mtmips/Kconfig             |  5 +++-
 arch/x86/cpu/apollolake/Kconfig           |  5 +++-
 configs/am62ax_evm_r5_defconfig           |  1 +
 configs/am62px_evm_r5_defconfig           |  1 +
 configs/am62x_beagleplay_a53_defconfig    |  1 +
 configs/am62x_beagleplay_r5_defconfig     |  1 +
 configs/am62x_evm_a53_defconfig           |  1 +
 configs/am62x_evm_a53_ethboot_defconfig   |  1 +
 configs/am62x_evm_r5_defconfig            |  1 +
 configs/am64x_evm_r5_defconfig            |  1 +
 configs/am65x_evm_r5_defconfig            |  1 +
 configs/am65x_evm_r5_usbmsc_defconfig     |  1 +
 configs/am67a_beagley_ai_r5_defconfig     |  1 +
 configs/brcp150_defconfig                 |  1 +
 configs/brcp170_defconfig                 |  1 +
 configs/brcp1_1r_defconfig                |  1 +
 configs/brcp1_1r_switch_defconfig         |  1 +
 configs/brcp1_2r_defconfig                |  1 +
 configs/brsmarc2_defconfig                |  1 +
 configs/evb-ast2600_defconfig             |  1 +
 configs/evb-rk3288_defconfig              |  1 +
 configs/firefly-rk3288_defconfig          |  1 +
 configs/ibex-ast2700_defconfig            |  1 +
 configs/ibm-sbp1_defconfig                |  1 +
 configs/imx28_btt3_defconfig              |  1 +
 configs/imx28_xea_defconfig               |  1 +
 configs/imx6q_bosch_acc_defconfig         |  1 +
 configs/imxrt1020-evk_defconfig           |  1 +
 configs/imxrt1050-evk_defconfig           |  1 +
 configs/imxrt1050-evk_fspi_defconfig      |  1 +
 configs/imxrt1170-evk_defconfig           |  1 +
 configs/j721e_beagleboneai64_r5_defconfig |  1 +
 configs/j721e_evm_r5_defconfig            |  1 +
 configs/j721s2_evm_r5_defconfig           |  1 +
 configs/j722s_evm_r5_defconfig            |  1 +
 configs/j784s4_evm_r5_defconfig           |  1 +
 configs/kontron_sl28_defconfig            |  1 +
 configs/phycore_am62ax_r5_defconfig       |  1 +
 configs/phycore_am62x_a53_defconfig       |  1 +
 configs/phycore_am62x_r5_defconfig        |  1 +
 configs/phycore_am64x_r5_defconfig        |  1 +
 configs/stm32746g-eval_spl_defconfig      |  1 +
 configs/stm32f746-disco_spl_defconfig     |  1 +
 configs/stm32f769-disco_spl_defconfig     |  1 +
 configs/tinker-rk3288_defconfig           |  1 +
 configs/tinker-s-rk3288_defconfig         |  1 +
 configs/verdin-am62_a53_defconfig         |  1 +
 configs/verdin-am62_r5_defconfig          |  1 +
 configs/verdin-am62p_a53_defconfig        |  1 +
 configs/verdin-am62p_r5_defconfig         |  1 +
 configs/xilinx_mbv32_defconfig            |  1 +
 configs/xilinx_mbv32_smode_defconfig      |  1 +
 configs/xilinx_mbv64_defconfig            |  1 +
 configs/xilinx_mbv64_smode_defconfig      |  1 +
 configs/xilinx_zynqmp_kria_defconfig      |  1 +
 configs/xilinx_zynqmp_virt_defconfig      |  1 +
 59 files changed, 90 insertions(+), 15 deletions(-)
Kconfig +21 -9
index f1a6be299e8..e73dd91a408 100644
@@ -556,36 +556,48 @@ config BOARD_SIZE_LIMIT
 	  include SPL nor TPL, on platforms that use that functionality, they
 	  have separate options to restrict size.
 
-config VPL_SIZE_LIMIT
+config HAS_VPL_SIZE_LIMIT
+	bool "Enable size limit check for the VPL image"
+	depends on !COMPILE_TEST
 	depends on VPL
+
+config VPL_SIZE_LIMIT
 	hex "Maximum size of VPL image"
-	default 0x0
+	depends on HAS_VPL_SIZE_LIMIT
 	help
 	  Specifies the maximum length of the U-Boot VPL image.
 	  If this value is zero, it is ignored.
 
-config TPL_SIZE_LIMIT
+config HAS_TPL_SIZE_LIMIT
+	bool "Enable size limit check for the TPL image"
+	depends on !COMPILE_TEST
 	depends on TPL
+
+config TPL_SIZE_LIMIT
 	hex "Maximum size of TPL image"
-	default 0x0
+	depends on HAS_TPL_SIZE_LIMIT
 	help
 	  Specifies the maximum length of the U-Boot TPL image.
 	  If this value is zero, it is ignored.
 
-config SPL_SIZE_LIMIT
+config HAS_SPL_SIZE_LIMIT
+	bool "Enable size limit check for the SPL image"
+	depends on !COMPILE_TEST
 	depends on SPL
+
+config SPL_SIZE_LIMIT
 	hex "Maximum size of SPL image"
+	depends on HAS_SPL_SIZE_LIMIT
 	default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB
 	default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
 	default 0x30000 if ARCH_MVEBU && ARMADA_32BIT
-	default 0x0
 	help
 	  Specifies the maximum length of the U-Boot SPL image.
 	  If this value is zero, it is ignored.
 
 config SPL_SIZE_LIMIT_SUBTRACT_GD
 	bool "SPL image size check: provide space for global data"
-	depends on SPL_SIZE_LIMIT > 0
+	depends on HAS_SPL_SIZE_LIMIT
 	help
 	  If enabled, aligned size of global data is reserved in
 	  SPL_SIZE_LIMIT check to ensure such an image does not overflow SRAM
@@ -594,7 +606,7 @@ config SPL_SIZE_LIMIT_SUBTRACT_GD
 
 config SPL_SIZE_LIMIT_SUBTRACT_MALLOC
 	bool "SPL image size check: provide space for malloc() pool before relocation"
-	depends on SPL_SIZE_LIMIT > 0
+	depends on HAS_SPL_SIZE_LIMIT
 	help
 	  If enabled, SPL_SYS_MALLOC_F_LEN is reserved in SPL_SIZE_LIMIT check
 	  to ensure such an image does not overflow SRAM if SPL_SIZE_LIMIT
@@ -603,7 +615,7 @@ config SPL_SIZE_LIMIT_SUBTRACT_MALLOC
 
 config SPL_SIZE_LIMIT_PROVIDE_STACK
 	hex "SPL image size check: provide stack space before relocation"
-	depends on SPL_SIZE_LIMIT > 0
+	depends on HAS_SPL_SIZE_LIMIT
 	default 0x0
 	help
 	  If set, this size is reserved in SPL_SIZE_LIMIT check to ensure such
Makefile +3 -3
index b4f10c08d75..a17d8b57196 100644
@@ -1109,19 +1109,19 @@ else
 BOARD_SIZE_CHECK =
 endif
 
-ifneq ($(CONFIG_SPL_SIZE_LIMIT),0x0)
+ifneq ($(CONFIG_SPL_SIZE_LIMIT),)
 SPL_SIZE_CHECK = @$(call size_check,$@,$$(tools/spl_size_limit))
 else
 SPL_SIZE_CHECK =
 endif
 
-ifneq ($(CONFIG_TPL_SIZE_LIMIT),0x0)
+ifneq ($(CONFIG_TPL_SIZE_LIMIT),)
 TPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_TPL_SIZE_LIMIT))
 else
 TPL_SIZE_CHECK =
 endif
 
-ifneq ($(CONFIG_VPL_SIZE_LIMIT),0x0)
+ifneq ($(CONFIG_VPL_SIZE_LIMIT),)
 VPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_VPL_SIZE_LIMIT))
 else
 VPL_SIZE_CHECK =
arch/arm/mach-socfpga/Kconfig +4 -1
index f2e959b5662..d4d46100736 100644
@@ -22,8 +22,11 @@ config SOCFPGA_SECURE_VAB_AUTH_ALLOW_NON_FIT_IMAGE
 	bool "Allow non-FIT VAB signed images"
 	depends on SOCFPGA_SECURE_VAB_AUTH
 
+config HAS_SPL_SIZE_LIMIT
+	default y if TARGET_SOCFPGA_GEN5
+
 config SPL_SIZE_LIMIT
-	default 0x10000 if TARGET_SOCFPGA_GEN5
+	default 0x10000 if TARGET_SOCFPGA_GEN5 && HAS_SPL_SIZE_LIMIT
 
 config SPL_SIZE_LIMIT_PROVIDE_STACK
 	default 0x200 if TARGET_SOCFPGA_GEN5
arch/mips/mach-mtmips/Kconfig +4 -1
index 3fcd0b8465b..d2a1652954c 100644
@@ -36,8 +36,11 @@ config SPL_TEXT_BASE
 	default 0x9c000000 if !SOC_MT7621
 	default 0x80100000 if SOC_MT7621
 
+config HAS_SPL_SIZE_LIMIT
+	default y if SOC_MT7621
+
 config SPL_SIZE_LIMIT
-	default 0x30000 if SOC_MT7621
+	default 0x30000 if SOC_MT7621 && HAS_SPL_SIZE_LIMIT
 
 config TPL_TEXT_BASE
 	default 0xbfc00000 if SOC_MT7621
arch/x86/cpu/apollolake/Kconfig +4 -1
index 5dd866ffcfe..d70e8def36f 100644
@@ -78,8 +78,11 @@ config MMCONF_BASE_ADDRESS
 	hex
 	default 0xe0000000
 
+config HAS_TPL_SIZE_LIMIT
+	default y
+
 config TPL_SIZE_LIMIT
-	default 0x7800
+	default 0x7800 if HAS_TPL_SIZE_LIMIT
 
 config CPU_ADDR_BITS
 	default 39
configs/am62ax_evm_r5_defconfig +1 -0
index 64886986c42..003e35d32dd 100644
@@ -20,6 +20,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x43c3b000
 CONFIG_SPL_BSS_MAX_SIZE=0x3000
 CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x3A7F0
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x3500
 CONFIG_SPL_FS_FAT=y
configs/am62px_evm_r5_defconfig +1 -0
index c9592d7b6c4..ad56354a252 100644
@@ -23,6 +23,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x43c4b000
 CONFIG_SPL_BSS_MAX_SIZE=0x3000
 CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x3C000
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x5000
 CONFIG_SPL_FS_FAT=y
configs/am62x_beagleplay_a53_defconfig +1 -0
index 05853317fea..dfac96379ce 100644
@@ -20,6 +20,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x80c80000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x40000
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x800
 CONFIG_SPL_FS_FAT=y
configs/am62x_beagleplay_r5_defconfig +1 -0
index ce503000e4c..3f5d1642b29 100644
@@ -23,6 +23,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x43c3b000
 CONFIG_SPL_BSS_MAX_SIZE=0x3000
 CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x3A7F0
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x3500
 CONFIG_SPL_FS_FAT=y
configs/am62x_evm_a53_defconfig +1 -0
index 4da668396d0..d368cc99c84 100644
@@ -24,6 +24,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x80c80000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x40000
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x800
 CONFIG_SPL_FS_FAT=y
configs/am62x_evm_a53_ethboot_defconfig +1 -0
index 9d3c6b889f0..5d073bebb9a 100644
@@ -6,6 +6,7 @@ CONFIG_SOC_K3_AM625=y
 CONFIG_TARGET_AM625_A53_EVM=y
 CONFIG_DEFAULT_DEVICE_TREE="ti/k3-am625-sk"
 CONFIG_SPL_STACK_R_ADDR=0x83000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x80000
 CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_SPL_BOARD_INIT=y
configs/am62x_evm_r5_defconfig +1 -0
index 18ffc991b25..4eaa8d3e3ac 100644
@@ -25,6 +25,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x43c3b000
 CONFIG_SPL_BSS_MAX_SIZE=0x3000
 CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x3A7F0
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x3500
 CONFIG_SPL_FS_FAT=y
configs/am64x_evm_r5_defconfig +1 -0
index 491e0dd102e..b49370d2a34 100644
@@ -24,6 +24,7 @@ CONFIG_SPL_BSS_START_ADDR=0x7019b800
 CONFIG_SPL_BSS_MAX_SIZE=0x4000
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x400000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x190000
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x4000
 CONFIG_SPL_FS_FAT=y
configs/am65x_evm_r5_defconfig +1 -0
index 6733dcfdd85..8d368ce9f19 100644
@@ -23,6 +23,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x41c7effc
 CONFIG_SPL_BSS_MAX_SIZE=0xc00
 CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x7ec00
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x2000
 CONFIG_SPL_FS_FAT=y
configs/am65x_evm_r5_usbmsc_defconfig +1 -0
index 37b5c6a43e7..df4c1faae96 100644
@@ -21,6 +21,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x41c7effc
 CONFIG_SPL_BSS_MAX_SIZE=0xc00
 CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x7ec00
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x2000
 CONFIG_SPL_FS_FAT=y
configs/am67a_beagley_ai_r5_defconfig +1 -0
index 00c6ba6e2b5..7d461fb93bb 100644
@@ -21,6 +21,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x43c7b000
 CONFIG_SPL_BSS_MAX_SIZE=0x3000
 CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x3C000
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x5000
 CONFIG_SPL_FS_FAT=y
configs/brcp150_defconfig +1 -0
index 6d2b92e1ec3..68d7ba2a507 100644
@@ -27,6 +27,7 @@ CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x600000
 CONFIG_SYS_BOOTM_LEN=0x2000000
 CONFIG_SYS_LOAD_ADDR=0x2000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x20000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x30000
configs/brcp170_defconfig +1 -0
index 44460c510f1..b92db4dc6d4 100644
@@ -27,6 +27,7 @@ CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x600000
 CONFIG_SYS_BOOTM_LEN=0x2000000
 CONFIG_SYS_LOAD_ADDR=0x2000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x20000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x30000
configs/brcp1_1r_defconfig +1 -0
index 684800228ef..050c743641d 100644
@@ -27,6 +27,7 @@ CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x600000
 CONFIG_SYS_BOOTM_LEN=0x2000000
 CONFIG_SYS_LOAD_ADDR=0x2000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x20000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x30000
configs/brcp1_1r_switch_defconfig +1 -0
index 9b45961ef8e..79b7bea5935 100644
@@ -27,6 +27,7 @@ CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x600000
 CONFIG_SYS_BOOTM_LEN=0x2000000
 CONFIG_SYS_LOAD_ADDR=0x2000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x20000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x30000
configs/brcp1_2r_defconfig +1 -0
index 357eef38601..bbc3756bcf9 100644
@@ -27,6 +27,7 @@ CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x600000
 CONFIG_SYS_BOOTM_LEN=0x2000000
 CONFIG_SYS_LOAD_ADDR=0x2000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x20000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x30000
configs/brsmarc2_defconfig +1 -0
index 2ed54817af4..b460ee11ea6 100644
@@ -27,6 +27,7 @@ CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x600000
 CONFIG_SYS_BOOTM_LEN=0x2000000
 CONFIG_SYS_LOAD_ADDR=0x2000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x20000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x30000
configs/evb-ast2600_defconfig +1 -0
index 16e8a58ccc0..393ed3e1873 100644
@@ -26,6 +26,7 @@ CONFIG_SPL_BSS_MAX_SIZE=0x1000000
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000000
 CONFIG_SYS_LOAD_ADDR=0x83000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x10000
 CONFIG_SPL=y
 # CONFIG_ARMV7_NONSEC is not set
configs/evb-rk3288_defconfig +1 -0
index 02347b58c22..3f8bb365cde 100644
@@ -20,6 +20,7 @@ CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000
 CONFIG_SYS_BOOTM_LEN=0x4000000
 CONFIG_SYS_LOAD_ADDR=0x800800
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x4b000
 CONFIG_DEBUG_UART_BASE=0xff690000
 CONFIG_DEBUG_UART_CLOCK=24000000
configs/firefly-rk3288_defconfig +1 -0
index d7b01e67db9..35ade7f99a3 100644
@@ -13,6 +13,7 @@ CONFIG_ROCKCHIP_RK3288=y
 CONFIG_TARGET_FIREFLY_RK3288=y
 CONFIG_SYS_BOOTM_LEN=0x4000000
 CONFIG_SYS_LOAD_ADDR=0x800800
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x40000
 CONFIG_DEBUG_UART_BASE=0xff690000
 CONFIG_DEBUG_UART_CLOCK=24000000
configs/ibex-ast2700_defconfig +1 -0
index 8e8259f291d..5c6b31944c5 100644
@@ -16,6 +16,7 @@ CONFIG_SPL_TEXT_BASE=0x14bc0080
 CONFIG_SPL_BSS_START_ADDR=0x14bd7800
 CONFIG_SPL_BSS_MAX_SIZE=0x800
 CONFIG_SYS_LOAD_ADDR=0x83000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x16000
 CONFIG_SPL=y
 CONFIG_SYS_MEM_TOP_HIDE=0x10000000
configs/ibm-sbp1_defconfig +1 -0
index 5f16301e5b5..26420c6f831 100644
@@ -24,6 +24,7 @@ CONFIG_SPL_BSS_MAX_SIZE=0x1000000
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000000
 CONFIG_SYS_LOAD_ADDR=0x83000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x10000
 CONFIG_SPL=y
 # CONFIG_ARMV7_NONSEC is not set
configs/imx28_btt3_defconfig +1 -0
index 07c805faa2f..87db48a2ac5 100644
@@ -25,6 +25,7 @@ CONFIG_SPL_SYS_MALLOC_F_LEN=0x1000
 CONFIG_SPL_TEXT_BASE=0x1000
 CONFIG_SYS_LOAD_ADDR=0x42000000
 CONFIG_SF_DEFAULT_BUS=2
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0xa000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x90000
configs/imx28_xea_defconfig +1 -0
index 8715893bbcc..2ba2b7f72af 100644
@@ -23,6 +23,7 @@ CONFIG_SPL_SYS_MALLOC_F_LEN=0x1000
 CONFIG_SPL_TEXT_BASE=0x1000
 CONFIG_SYS_LOAD_ADDR=0x42000000
 CONFIG_SF_DEFAULT_BUS=2
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0xa000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x90000
configs/imx6q_bosch_acc_defconfig +1 -0
index 6f0ef2eaee3..30b2af737b1 100644
@@ -18,6 +18,7 @@ CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
 CONFIG_BOOTCOUNT_BOOTLIMIT=8
 CONFIG_WATCHDOG_TIMEOUT_MSECS=60000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=69632
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x1ff000
configs/imxrt1020-evk_defconfig +1 -0
index 17c650e6950..7fc6afafc1b 100644
@@ -17,6 +17,7 @@ CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
 CONFIG_SPL_TEXT_BASE=0x20209000
 CONFIG_SYS_LOAD_ADDR=0x20209000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x20000
 CONFIG_SPL=y
 CONFIG_HAVE_SYS_UBOOT_START=y
configs/imxrt1050-evk_defconfig +1 -0
index 5faf964759d..6ba608f20a4 100644
@@ -19,6 +19,7 @@ CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
 CONFIG_SPL_TEXT_BASE=0x20002000
 CONFIG_SYS_LOAD_ADDR=0x20002000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x20000
 CONFIG_SPL=y
 CONFIG_HAVE_SYS_UBOOT_START=y
configs/imxrt1050-evk_fspi_defconfig +1 -0
index cc7e8a3e10b..7d6a41403fc 100644
@@ -21,6 +21,7 @@ CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
 CONFIG_SPL_TEXT_BASE=0x20002000
 CONFIG_SYS_LOAD_ADDR=0x20002000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x20000
 CONFIG_SPL=y
 CONFIG_HAVE_SYS_UBOOT_START=y
configs/imxrt1170-evk_defconfig +1 -0
index 9bd3874143c..4f7e6104c78 100644
@@ -19,6 +19,7 @@ CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
 CONFIG_SPL_TEXT_BASE=0x202C0000
 CONFIG_SYS_LOAD_ADDR=0x202C0000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x20000
 CONFIG_SPL=y
 CONFIG_HAVE_SYS_UBOOT_START=y
configs/j721e_beagleboneai64_r5_defconfig +1 -0
index 50a9d95d7bf..8e9450326b1 100644
@@ -23,6 +23,7 @@ CONFIG_SPL_BSS_START_ADDR=0x41cf59f0
 CONFIG_SPL_BSS_MAX_SIZE=0xa000
 CONFIG_SPL_STACK_R=y
 CONFIG_SYS_BOOTM_LEN=0x4000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0xf59f0
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x4000
 CONFIG_SPL_FS_FAT=y
configs/j721e_evm_r5_defconfig +1 -0
index ceb2e273b54..4499073c5d9 100644
@@ -25,6 +25,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x41cf59f0
 CONFIG_SPL_BSS_MAX_SIZE=0xa000
 CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0xf59f0
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x4000
 CONFIG_SPL_FS_FAT=y
configs/j721s2_evm_r5_defconfig +1 -0
index aaf8fd32879..9cbb841ce49 100644
@@ -25,6 +25,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x41c76000
 CONFIG_SPL_BSS_MAX_SIZE=0xa000
 CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x80000
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x4000
 CONFIG_SPL_FS_FAT=y
configs/j722s_evm_r5_defconfig +1 -0
index 8e2741c8d42..590bb9452df 100644
@@ -24,6 +24,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x43c7b000
 CONFIG_SPL_BSS_MAX_SIZE=0x3000
 CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x3C000
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x5000
 CONFIG_SPL_FS_FAT=y
configs/j784s4_evm_r5_defconfig +1 -0
index cc340a2fe76..21b040d6399 100644
@@ -26,6 +26,7 @@ CONFIG_SPL_BSS_START_ADDR=0x41c76000
 CONFIG_SPL_BSS_MAX_SIZE=0xa000
 CONFIG_SPL_STACK_R=y
 CONFIG_SYS_BOOTM_LEN=0x4000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x80000
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x4000
 CONFIG_SPL_FS_FAT=y
configs/kontron_sl28_defconfig +1 -0
index e97534ecc0a..cb57538b597 100644
@@ -24,6 +24,7 @@ CONFIG_SPL_BSS_START_ADDR=0x80100000
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 CONFIG_SYS_BOOTM_LEN=0x800000
 CONFIG_SYS_LOAD_ADDR=0x82000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x20000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x3f0000
configs/phycore_am62ax_r5_defconfig +1 -0
index 01d100842de..657c2fe2612 100644
@@ -21,6 +21,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x43c3b000
 CONFIG_SPL_BSS_MAX_SIZE=0x3000
 CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x3A7F0
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x3500
 CONFIG_SPL_FS_FAT=y
configs/phycore_am62x_a53_defconfig +1 -0
index fdbe79d3e32..f146ee30488 100644
@@ -27,6 +27,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x80c80000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x80000
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x800
 CONFIG_ENV_OFFSET_REDUND=0x6c0000
configs/phycore_am62x_r5_defconfig +1 -0
index 0368d4ef474..a41c09569df 100644
@@ -26,6 +26,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x43c3b000
 CONFIG_SPL_BSS_MAX_SIZE=0x3000
 CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x3A7F0
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x3500
 CONFIG_SPL_FS_FAT=y
configs/phycore_am64x_r5_defconfig +1 -0
index d1ac992dc7a..4bbe38536d1 100644
@@ -26,6 +26,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x7019b800
 CONFIG_SPL_BSS_MAX_SIZE=0x4000
 CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x190000
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x4000
 CONFIG_SPL_FS_FAT=y
configs/stm32746g-eval_spl_defconfig +1 -0
index 432d35d0d5a..5ce93a34b9e 100644
@@ -16,6 +16,7 @@ CONFIG_SPL_SERIAL=y
 CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_SPL_TEXT_BASE=0x8000000
 CONFIG_SYS_LOAD_ADDR=0x8009000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x9000
 CONFIG_STM32F7=y
 CONFIG_TARGET_STM32F746_DISCO=y
configs/stm32f746-disco_spl_defconfig +1 -0
index 699ae9d08fc..b629c5eeefd 100644
@@ -16,6 +16,7 @@ CONFIG_SPL_SERIAL=y
 CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_SPL_TEXT_BASE=0x8000000
 CONFIG_SYS_LOAD_ADDR=0x8009000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x9000
 CONFIG_STM32F7=y
 CONFIG_TARGET_STM32F746_DISCO=y
configs/stm32f769-disco_spl_defconfig +1 -0
index 74210fe8252..f82bcd9d937 100644
@@ -16,6 +16,7 @@ CONFIG_SPL_SERIAL=y
 CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_SPL_TEXT_BASE=0x8000000
 CONFIG_SYS_LOAD_ADDR=0x8009000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x9000
 CONFIG_STM32F7=y
 CONFIG_TARGET_STM32F746_DISCO=y
configs/tinker-rk3288_defconfig +1 -0
index afbb394228f..9c56fe10bfd 100644
@@ -12,6 +12,7 @@ CONFIG_ROCKCHIP_RK3288=y
 CONFIG_TARGET_TINKER_RK3288=y
 CONFIG_SYS_BOOTM_LEN=0x4000000
 CONFIG_SYS_LOAD_ADDR=0x800800
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x4b000
 CONFIG_DEBUG_UART_BASE=0xff690000
 CONFIG_DEBUG_UART_CLOCK=24000000
configs/tinker-s-rk3288_defconfig +1 -0
index 876086573d3..2f830eb8c88 100644
@@ -12,6 +12,7 @@ CONFIG_ROCKCHIP_RK3288=y
 CONFIG_TARGET_TINKER_RK3288=y
 CONFIG_SYS_BOOTM_LEN=0x4000000
 CONFIG_SYS_LOAD_ADDR=0x800800
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x4b000
 CONFIG_DEBUG_UART_BASE=0xff690000
 CONFIG_DEBUG_UART_CLOCK=24000000
configs/verdin-am62_a53_defconfig +1 -0
index 2c0573cd54e..f7cbcd2e48a 100644
@@ -25,6 +25,7 @@ CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_STACK_R=y
 CONFIG_SYS_BOOTM_LEN=0x40000000
 CONFIG_SYS_LOAD_ADDR=0x88200000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x40000
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x800
 CONFIG_SYS_MEMTEST_START=0x80000000
configs/verdin-am62_r5_defconfig +1 -0
index efba857ad70..d2fcd38a161 100644
@@ -22,6 +22,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x43c3b000
 CONFIG_SPL_BSS_MAX_SIZE=0x3000
 CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x3A7F0
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x3500
 CONFIG_SPL_LIBDISK_SUPPORT=y
configs/verdin-am62p_a53_defconfig +1 -0
index c46b883a9c6..f04e184a079 100644
@@ -24,6 +24,7 @@ CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_STACK_R=y
 CONFIG_SYS_BOOTM_LEN=0x40000000
 CONFIG_SYS_LOAD_ADDR=0x88200000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x80000
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x800
 CONFIG_SYS_MEMTEST_START=0x80000000
configs/verdin-am62p_r5_defconfig +1 -0
index a8b0e942b61..076111b30d9 100644
@@ -22,6 +22,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x43c4b000
 CONFIG_SPL_BSS_MAX_SIZE=0x3000
 CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x3C000
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x5000
 CONFIG_SPL_LIBDISK_SUPPORT=y
configs/xilinx_mbv32_defconfig +1 -0
index e3341179a68..94cd6c7112b 100644
@@ -10,6 +10,7 @@ CONFIG_SPL_BSS_START_ADDR=0x84000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SYS_BOOTM_LEN=0x800000
 CONFIG_SYS_LOAD_ADDR=0x80200000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x40000
 CONFIG_SPL=y
 CONFIG_DEBUG_UART_BASE=0x40600000
configs/xilinx_mbv32_smode_defconfig +1 -0
index c95b4497395..9058bdf8030 100644
@@ -10,6 +10,7 @@ CONFIG_SPL_BSS_START_ADDR=0x84000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SYS_BOOTM_LEN=0x800000
 CONFIG_SYS_LOAD_ADDR=0x80200000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x40000
 CONFIG_SPL=y
 CONFIG_DEBUG_UART_BASE=0x40600000
configs/xilinx_mbv64_defconfig +1 -0
index a3cc1a5669e..2f00466ff9e 100644
@@ -10,6 +10,7 @@ CONFIG_SPL_BSS_START_ADDR=0x84000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SYS_BOOTM_LEN=0x800000
 CONFIG_SYS_LOAD_ADDR=0x80200000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x40000
 CONFIG_SPL=y
 CONFIG_DEBUG_UART_BASE=0x40600000
configs/xilinx_mbv64_smode_defconfig +1 -0
index 3d49670c60c..ec5598025bf 100644
@@ -10,6 +10,7 @@ CONFIG_SPL_BSS_START_ADDR=0x84000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SYS_BOOTM_LEN=0x800000
 CONFIG_SYS_LOAD_ADDR=0x80200000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x40000
 CONFIG_SPL=y
 CONFIG_DEBUG_UART_BASE=0x40600000
configs/xilinx_zynqmp_kria_defconfig +1 -0
index 3e2ac614405..d1238687ce3 100644
@@ -19,6 +19,7 @@ CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_STACK_R=y
 CONFIG_SYS_BOOTM_LEN=0x6400000
 CONFIG_SYS_LOAD_ADDR=0x8000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x2a000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x2220000
configs/xilinx_zynqmp_virt_defconfig +1 -0
index 65c8a4bbaad..11a39595680 100644
@@ -14,6 +14,7 @@ CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_STACK_R=y
 CONFIG_SYS_BOOTM_LEN=0x6400000
 CONFIG_SYS_LOAD_ADDR=0x8000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x2a000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x1E80000
Signature · 1 line
2.39.5
#9 lore raw

Re: [PATCH v3 2/5] Image size checks: Use HAS_SIZE_LIMIT consistently

configs/am62x_beagleplay_a53_defconfig CONFIG_SPL_HAS_BSS_LINKER_SECTION=y · line 23

Quoted 9 lines · Philip Oberfichtner
configs/am62x_beagleplay_a53_defconfig +1 -0
index 05853317fea..dfac96379ce 100644
@@ -20,6 +20,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
  CONFIG_SPL_BSS_START_ADDR=0x80c80000
  CONFIG_SPL_BSS_MAX_SIZE=0x80000
  CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y

How much of this massive config file patching can be done using some "select" in Kconfig file ?

#10 lore raw

Re: [PATCH v3 2/5] Image size checks: Use HAS_SIZE_LIMIT consistently

Quoted 13 lines · Marek Vasut

configs/am62x_beagleplay_a53_defconfig CONFIG_SPL_HAS_BSS_LINKER_SECTION=y · line 23

Quoted 9 lines · Philip Oberfichtner
configs/am62x_beagleplay_a53_defconfig +1 -0
index 05853317fea..dfac96379ce 100644
@@ -20,6 +20,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
  CONFIG_SPL_BSS_START_ADDR=0x80c80000
  CONFIG_SPL_BSS_MAX_SIZE=0x80000
  CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y

How much of this massive config file patching can be done using some "select" in Kconfig file ?

I'm not following you here. I'm only adding CONFIG_HAS_XXX_SIZE_LIMIT wherever there already was an explicit CONFIG_XXX_SIZE_LIMIT in the defconfig before. I'm not changing anything here. Can you please elaborate on what it is that your asking for?

#11 lore raw

Re: [PATCH v3 2/5] Image size checks: Use HAS_SIZE_LIMIT consistently

Quoted 15 lines · Philip Oberfichtner
Quoted 13 lines · Marek Vasut

configs/am62x_beagleplay_a53_defconfig CONFIG_SPL_HAS_BSS_LINKER_SECTION=y · line 23

Quoted 9 lines · Philip Oberfichtner
configs/am62x_beagleplay_a53_defconfig +1 -0
index 05853317fea..dfac96379ce 100644
@@ -20,6 +20,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
   CONFIG_SPL_BSS_START_ADDR=0x80c80000
   CONFIG_SPL_BSS_MAX_SIZE=0x80000
   CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y

How much of this massive config file patching can be done using some "select" in Kconfig file ?

Quoted 4 lines

I'm not following you here. I'm only adding CONFIG_HAS_XXX_SIZE_LIMIT wherever there already was an explicit CONFIG_XXX_SIZE_LIMIT in the defconfig before. I'm not changing anything here. Can you please elaborate on what it is that your asking for?

Can this massive configs/ update be avoided by using a default value / select / imply in some Kconfig file ?

#12 lore raw

Re: [PATCH v3 2/5] Image size checks: Use HAS_SIZE_LIMIT consistently

Quoted 16 lines · Marek Vasut
Quoted 15 lines · Philip Oberfichtner
Quoted 13 lines · Marek Vasut

configs/am62x_beagleplay_a53_defconfig CONFIG_SPL_HAS_BSS_LINKER_SECTION=y · line 23

Quoted 9 lines · Philip Oberfichtner
configs/am62x_beagleplay_a53_defconfig +1 -0
index 05853317fea..dfac96379ce 100644
@@ -20,6 +20,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
   CONFIG_SPL_BSS_START_ADDR=0x80c80000
   CONFIG_SPL_BSS_MAX_SIZE=0x80000
   CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y

How much of this massive config file patching can be done using some "select" in Kconfig file ?

Quoted 7 lines
Quoted 4 lines

I'm not following you here. I'm only adding CONFIG_HAS_XXX_SIZE_LIMIT wherever there already was an explicit CONFIG_XXX_SIZE_LIMIT in the defconfig before. I'm not changing anything here. Can you please elaborate on what it is that your asking for?

Can this massive configs/ update be avoided by using a default value / select / imply in some Kconfig file ?

No, I'm afraid it cannot ...

#13 lore raw

Re: [PATCH v3 2/5] Image size checks: Use HAS_SIZE_LIMIT consistently

In reply to Philip Oberfichtner
Quoted 12 lines · Philip Oberfichtner

Use a consistent logic for image size checks. No functional change.

Before this commit, there were two concurrent approaches of how image size checks are disabled: Whereas BOARD_SIZE_LIMIT was gated through a dedicated Kconfig symbol to achieve this, all the other size checks were disabled by assigning them a limit of zero bytes.

By this commit we achieve a consistent logic for size limiting, by introducing CONFIG_HAS_XXX_SIZE_LIMIT for all those options that don't have it yet.

[snip]

Quoted 41 lines
arch/arm/mach-socfpga/Kconfig +4 -1
index f2e959b5662..d4d46100736 100644
@@ -22,8 +22,11 @@ config SOCFPGA_SECURE_VAB_AUTH_ALLOW_NON_FIT_IMAGE
 	bool "Allow non-FIT VAB signed images"
 	depends on SOCFPGA_SECURE_VAB_AUTH
 
+config HAS_SPL_SIZE_LIMIT
+	default y if TARGET_SOCFPGA_GEN5
+
 config SPL_SIZE_LIMIT
-	default 0x10000 if TARGET_SOCFPGA_GEN5
+	default 0x10000 if TARGET_SOCFPGA_GEN5 && HAS_SPL_SIZE_LIMIT
 
 config SPL_SIZE_LIMIT_PROVIDE_STACK
 	default 0x200 if TARGET_SOCFPGA_GEN5
arch/mips/mach-mtmips/Kconfig +4 -1
index 3fcd0b8465b..d2a1652954c 100644
@@ -36,8 +36,11 @@ config SPL_TEXT_BASE
 	default 0x9c000000 if !SOC_MT7621
 	default 0x80100000 if SOC_MT7621
 
+config HAS_SPL_SIZE_LIMIT
+	default y if SOC_MT7621
+
 config SPL_SIZE_LIMIT
-	default 0x30000 if SOC_MT7621
+	default 0x30000 if SOC_MT7621 && HAS_SPL_SIZE_LIMIT
 
 config TPL_TEXT_BASE
 	default 0xbfc00000 if SOC_MT7621
arch/x86/cpu/apollolake/Kconfig +0 -0
index 5dd866ffcfe..d70e8def36f 100644
@@ -78,8 +78,11 @@ config MMCONF_BASE_ADDRESS
 	hex
 	default 0xe0000000

arch/x86/cpu/apollolake/Kconfig config MMCONF_BASE_ADDRESS · line 88

Quoted 10 lines
arch/x86/cpu/apollolake/Kconfig +4 -1
 
+config HAS_TPL_SIZE_LIMIT
+	default y
+
 config TPL_SIZE_LIMIT
-	default 0x7800
+	default 0x7800 if HAS_TPL_SIZE_LIMIT
 
 config CPU_ADDR_BITS
 	default 39

These should be "default y if .." in the main Kconfig entry for the option.

configs/am62ax_evm_r5_defconfig

Quoted 1 line
configs/am62ax_evm_r5_defconfig +0 -0

The reset of these, to Marek's point, show that we need to also add "default y if .." for a number of other platforms too. At least the ones where today we have default limits provided in Kconfig today.

Signature · 1 line
Tom
#14 lore raw

Re: [PATCH v3 2/5] Image size checks: Use HAS_SIZE_LIMIT consistently

Quoted 14 lines · Tom Rini
Quoted 12 lines · Philip Oberfichtner

Use a consistent logic for image size checks. No functional change.

Before this commit, there were two concurrent approaches of how image size checks are disabled: Whereas BOARD_SIZE_LIMIT was gated through a dedicated Kconfig symbol to achieve this, all the other size checks were disabled by assigning them a limit of zero bytes.

By this commit we achieve a consistent logic for size limiting, by introducing CONFIG_HAS_XXX_SIZE_LIMIT for all those options that don't have it yet.

<...>

Quoted 15 lines
Quoted 15 lines
arch/x86/cpu/apollolake/Kconfig +4 -1
index 5dd866ffcfe..d70e8def36f 100644
@@ -78,8 +78,11 @@ config MMCONF_BASE_ADDRESS
 	hex
 	default 0xe0000000
 
+config HAS_TPL_SIZE_LIMIT
+	default y
+
 config TPL_SIZE_LIMIT
-	default 0x7800
+	default 0x7800 if HAS_TPL_SIZE_LIMIT
 
Quoted 5 lines

arch/x86/cpu/apollolake/Kconfig config MMCONF_BASE_ADDRESS · line 88

Quoted 2 lines
arch/x86/cpu/apollolake/Kconfig +0 -0
 config CPU_ADDR_BITS
 	default 39

These should be "default y if .." in the main Kconfig entry for the option.

Not sure if I'm following you here. So you mean both of the defaults should be moved to common/spl/Kconfig.tpl? - like

	config HAS_TPL_SIZE_LIMIT
		[...]
		default y if INTEL_APOLLOLAKE


	config TPL_SIZE_LIMIT
		[...]
		default 0x7800 if INTEL_APOLLOLAKE
Quoted 5 lines

configs/am62ax_evm_r5_defconfig

Quoted 2 lines
configs/am62ax_evm_r5_defconfig +0 -0

The reset of these, to Marek's point, show that we need to also add "default y if .." for a number of other platforms too.

Which platforms exactly?

Quoted 2 lines

At least the ones
where today we have default limits provided in Kconfig today.

Besides the ones handled above, i.e.
arch/arm/mach-socfpga/Kconfig,
arch/mips/mach-mtmips/Kconfig and
arch/x86/cpu/apollolake/Kconfig,

there aren't any.

I myself am not very fond of changing that many defconfigs, but I still don't see a way of avoiding it. I guess it would become more clear if you concretely name a few examples.

Best regards,
Philip

#15 lore raw

Re: [PATCH v3 2/5] Image size checks: Use HAS_SIZE_LIMIT consistently

Quoted 40 lines · Philip Oberfichtner
Quoted 14 lines · Tom Rini
Quoted 12 lines · Philip Oberfichtner

Use a consistent logic for image size checks. No functional change.

Before this commit, there were two concurrent approaches of how image size checks are disabled: Whereas BOARD_SIZE_LIMIT was gated through a dedicated Kconfig symbol to achieve this, all the other size checks were disabled by assigning them a limit of zero bytes.

By this commit we achieve a consistent logic for size limiting, by introducing CONFIG_HAS_XXX_SIZE_LIMIT for all those options that don't have it yet.

<...>

Quoted 15 lines
Quoted 15 lines
arch/x86/cpu/apollolake/Kconfig +4 -1
index 5dd866ffcfe..d70e8def36f 100644
@@ -78,8 +78,11 @@ config MMCONF_BASE_ADDRESS
 	hex
 	default 0xe0000000
 
+config HAS_TPL_SIZE_LIMIT
+	default y
+
 config TPL_SIZE_LIMIT
-	default 0x7800
+	default 0x7800 if HAS_TPL_SIZE_LIMIT
 
Quoted 5 lines

arch/x86/cpu/apollolake/Kconfig config MMCONF_BASE_ADDRESS · line 88

Quoted 2 lines
arch/x86/cpu/apollolake/Kconfig +0 -0
 config CPU_ADDR_BITS
 	default 39

These should be "default y if .." in the main Kconfig entry for the option.

Not sure if I'm following you here. So you mean both of the defaults should be moved to common/spl/Kconfig.tpl? - like

Quoted 8 lines
	config HAS_TPL_SIZE_LIMIT
		[...]
		default y if INTEL_APOLLOLAKE


	config TPL_SIZE_LIMIT
		[...]
		default 0x7800 if INTEL_APOLLOLAKE

Yes, like that.

Quoted 6 lines
Quoted 4 lines

configs/am62ax_evm_r5_defconfig

Quoted 1 line
configs/am62ax_evm_r5_defconfig +0 -0

The reset of these, to Marek's point, show that we need to also add "default y if .." for a number of other platforms too.

Which platforms exactly?

So the platforms today which have a default ..size.. if SOC should also be listed as default y if SOC, is that I was I believe getting at.

Quoted 8 lines
Quoted 2 lines

At least the ones
where today we have default limits provided in Kconfig today.

Besides the ones handled above, i.e.
arch/arm/mach-socfpga/Kconfig,
arch/mips/mach-mtmips/Kconfig and
arch/x86/cpu/apollolake/Kconfig,

Quoted 5 lines

there aren't any.

I myself am not very fond of changing that many defconfigs, but I still don't see a way of avoiding it. I guess it would become more clear if you concretely name a few examples.

So, part of the pattern is that we should take this from common/spl/Kconfig:
config SPL_SIZE_LIMIT

        hex "Maximum size of SPL image"
        default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB
        default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
        default 0x30000 if ARCH_MVEBU && ARMADA_32BIT
        default 0x0
        help
	  ...

And it becomes:

config HAS_SPL_SIZE_LIMIT
bool "Enforce a maximum size of the SPL image
default y if ARCH_MX6 || (ARCH_MVEBU && ARMADA_32BIT) || \
ARCH_K3
help
.. What we had talked about in earlier threads to be clear about what .. is / isn't checked by this option.

config SPL_SIZE_LIMIT

        hex "Maximum size of SPL image"
	depends on HAS_SPL_SIZE_LIMIT
        default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB
        default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
        default 0x30000 if ARCH_MVEBU && ARMADA_32BIT
	help
	  ..

And note that I've added ARCH_K3 to the list here because from a quick grep, TI K3 platforms also set SPL_SIZE_LIMIT and so with this, you won't have to change all of those defconfigs as well.

Signature · 1 line
Tom
#16 lore raw

Re: [PATCH v3 2/5] Image size checks: Use HAS_SIZE_LIMIT consistently

Hi Tom,

Thank you for the clarification.

Quoted 46 lines · Tom Rini
Quoted 45 lines · Philip Oberfichtner
Quoted 14 lines · Tom Rini
Quoted 12 lines · Philip Oberfichtner

Use a consistent logic for image size checks. No functional change.

Before this commit, there were two concurrent approaches of how image size checks are disabled: Whereas BOARD_SIZE_LIMIT was gated through a dedicated Kconfig symbol to achieve this, all the other size checks were disabled by assigning them a limit of zero bytes.

By this commit we achieve a consistent logic for size limiting, by introducing CONFIG_HAS_XXX_SIZE_LIMIT for all those options that don't have it yet.

<...>

Quoted 15 lines
Quoted 15 lines
arch/x86/cpu/apollolake/Kconfig +4 -1
index 5dd866ffcfe..d70e8def36f 100644
@@ -78,8 +78,11 @@ config MMCONF_BASE_ADDRESS
 	hex
 	default 0xe0000000
 
+config HAS_TPL_SIZE_LIMIT
+	default y
+
 config TPL_SIZE_LIMIT
-	default 0x7800
+	default 0x7800 if HAS_TPL_SIZE_LIMIT
 
Quoted 5 lines

arch/x86/cpu/apollolake/Kconfig config MMCONF_BASE_ADDRESS · line 88

Quoted 2 lines
arch/x86/cpu/apollolake/Kconfig +0 -0
 config CPU_ADDR_BITS
 	default 39

These should be "default y if .." in the main Kconfig entry for the option.

Not sure if I'm following you here. So you mean both of the defaults should be moved to common/spl/Kconfig.tpl? - like

	config HAS_TPL_SIZE_LIMIT
		[...]
		default y if INTEL_APOLLOLAKE
Quoted 5 lines
Quoted 3 lines
	config TPL_SIZE_LIMIT
		[...]
		default 0x7800 if INTEL_APOLLOLAKE

Yes, like that.

Ok.

Quoted 10 lines
Quoted 7 lines
Quoted 5 lines

configs/am62ax_evm_r5_defconfig

Quoted 2 lines
configs/am62ax_evm_r5_defconfig +0 -0

The reset of these, to Marek's point, show that we need to also add "default y if .." for a number of other platforms too.

Which platforms exactly?

So the platforms today which have a default ..size.. if SOC should also be listed as default y if SOC, is that I was I believe getting at.

Yes, this part is already included as of now.

Quoted 35 lines
Quoted 9 lines
Quoted 3 lines

At least the ones
where today we have default limits provided in Kconfig today.

Besides the ones handled above, i.e.
arch/arm/mach-socfpga/Kconfig,
arch/mips/mach-mtmips/Kconfig and
arch/x86/cpu/apollolake/Kconfig,

Quoted 5 lines

there aren't any.

I myself am not very fond of changing that many defconfigs, but I still don't see a way of avoiding it. I guess it would become more clear if you concretely name a few examples.

So, part of the pattern is that we should take this from common/spl/Kconfig:
config SPL_SIZE_LIMIT

        hex "Maximum size of SPL image"
        default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB
        default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
        default 0x30000 if ARCH_MVEBU && ARMADA_32BIT
        default 0x0
        help
	  ...

And it becomes:

config HAS_SPL_SIZE_LIMIT
bool "Enforce a maximum size of the SPL image
default y if ARCH_MX6 || (ARCH_MVEBU && ARMADA_32BIT) || \
ARCH_K3
help
.. What we had talked about in earlier threads to be clear about what .. is / isn't checked by this option.

Quoted 9 lines

config SPL_SIZE_LIMIT

        hex "Maximum size of SPL image"
	depends on HAS_SPL_SIZE_LIMIT
        default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB
        default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
        default 0x30000 if ARCH_MVEBU && ARMADA_32BIT
	help
	  ..

Ok, I agree until here, but ...

Quoted 3 lines

And note that I've added ARCH_K3 to the list here because from a quick grep, TI K3 platforms also set SPL_SIZE_LIMIT and so with this, you won't have to change all of those defconfigs as well.

concerning ARCH_K3 I do not yet agree:

git grep -l ARCH_K3=y configs | wc -l

gives me 54 ARCH_K3 platforms. But only 24 of them use SPL_SIZE_LIMITs:

git grep -l ARCH_K3=y configs | xargs grep -l SIZE_LIMIT | wc -l

So if I'm not mistaken, we cannot set default HAS_SPL_SIZE_LIMIT for ARCH_K3.

Best regards,
Philip

#17 lore raw

Re: [PATCH v3 2/5] Image size checks: Use HAS_SIZE_LIMIT consistently

Quoted 128 lines · Philip Oberfichtner

Hi Tom,

Thank you for the clarification.

Quoted 46 lines · Tom Rini
Quoted 45 lines · Philip Oberfichtner
Quoted 14 lines · Tom Rini
Quoted 12 lines · Philip Oberfichtner

Use a consistent logic for image size checks. No functional change.

Before this commit, there were two concurrent approaches of how image size checks are disabled: Whereas BOARD_SIZE_LIMIT was gated through a dedicated Kconfig symbol to achieve this, all the other size checks were disabled by assigning them a limit of zero bytes.

By this commit we achieve a consistent logic for size limiting, by introducing CONFIG_HAS_XXX_SIZE_LIMIT for all those options that don't have it yet.

<...>

Quoted 15 lines
Quoted 15 lines
arch/x86/cpu/apollolake/Kconfig +4 -1
index 5dd866ffcfe..d70e8def36f 100644
@@ -78,8 +78,11 @@ config MMCONF_BASE_ADDRESS
 	hex
 	default 0xe0000000
 
+config HAS_TPL_SIZE_LIMIT
+	default y
+
 config TPL_SIZE_LIMIT
-	default 0x7800
+	default 0x7800 if HAS_TPL_SIZE_LIMIT
 
Quoted 5 lines

arch/x86/cpu/apollolake/Kconfig config MMCONF_BASE_ADDRESS · line 88

Quoted 2 lines
arch/x86/cpu/apollolake/Kconfig +0 -0
 config CPU_ADDR_BITS
 	default 39

These should be "default y if .." in the main Kconfig entry for the option.

Not sure if I'm following you here. So you mean both of the defaults should be moved to common/spl/Kconfig.tpl? - like

	config HAS_TPL_SIZE_LIMIT
		[...]
		default y if INTEL_APOLLOLAKE
Quoted 5 lines
Quoted 3 lines
	config TPL_SIZE_LIMIT
		[...]
		default 0x7800 if INTEL_APOLLOLAKE

Yes, like that.

Ok.

Quoted 10 lines
Quoted 7 lines
Quoted 5 lines

configs/am62ax_evm_r5_defconfig

Quoted 2 lines
configs/am62ax_evm_r5_defconfig +0 -0

The reset of these, to Marek's point, show that we need to also add "default y if .." for a number of other platforms too.

Which platforms exactly?

So the platforms today which have a default ..size.. if SOC should also be listed as default y if SOC, is that I was I believe getting at.

Yes, this part is already included as of now.

Quoted 35 lines
Quoted 9 lines
Quoted 3 lines

At least the ones
where today we have default limits provided in Kconfig today.

Besides the ones handled above, i.e.
arch/arm/mach-socfpga/Kconfig,
arch/mips/mach-mtmips/Kconfig and
arch/x86/cpu/apollolake/Kconfig,

Quoted 5 lines

there aren't any.

I myself am not very fond of changing that many defconfigs, but I still don't see a way of avoiding it. I guess it would become more clear if you concretely name a few examples.

So, part of the pattern is that we should take this from common/spl/Kconfig:
config SPL_SIZE_LIMIT

        hex "Maximum size of SPL image"
        default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB
        default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
        default 0x30000 if ARCH_MVEBU && ARMADA_32BIT
        default 0x0
        help
	  ...

And it becomes:

config HAS_SPL_SIZE_LIMIT
bool "Enforce a maximum size of the SPL image
default y if ARCH_MX6 || (ARCH_MVEBU && ARMADA_32BIT) || \
ARCH_K3
help
.. What we had talked about in earlier threads to be clear about what .. is / isn't checked by this option.

Quoted 9 lines

config SPL_SIZE_LIMIT

        hex "Maximum size of SPL image"
	depends on HAS_SPL_SIZE_LIMIT
        default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB
        default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
        default 0x30000 if ARCH_MVEBU && ARMADA_32BIT
	help
	  ..

Ok, I agree until here, but ...

Quoted 3 lines

And note that I've added ARCH_K3 to the list here because from a quick grep, TI K3 platforms also set SPL_SIZE_LIMIT and so with this, you won't have to change all of those defconfigs as well.

concerning ARCH_K3 I do not yet agree:

git grep -l ARCH_K3=y configs | wc -l

Quoted 7 lines

gives me 54 ARCH_K3 platforms. But only 24 of them use SPL_SIZE_LIMITs:

git grep -l ARCH_K3=y configs | xargs grep -l SIZE_LIMIT | wc -l

So if I'm not mistaken, we cannot set default HAS_SPL_SIZE_LIMIT for ARCH_K3.

Some of them use different limits.

$ ./tools/qconfig.py -b
... wait
$ ./tools/qconfig.py -f ~SPL_SIZE_LIMIT ARCH_K3
0 matches

So no platforms set ARCH_K3 and do not set SPL_SIZE_LIMIT.

Signature · 1 line
Tom
#18 lore raw

Re: [PATCH v3 2/5] Image size checks: Use HAS_SIZE_LIMIT consistently

Quoted 137 lines · Tom Rini
Quoted 128 lines · Philip Oberfichtner

Hi Tom,

Thank you for the clarification.

Quoted 46 lines · Tom Rini
Quoted 45 lines · Philip Oberfichtner
Quoted 14 lines · Tom Rini
Quoted 12 lines · Philip Oberfichtner

Use a consistent logic for image size checks. No functional change.

Before this commit, there were two concurrent approaches of how image size checks are disabled: Whereas BOARD_SIZE_LIMIT was gated through a dedicated Kconfig symbol to achieve this, all the other size checks were disabled by assigning them a limit of zero bytes.

By this commit we achieve a consistent logic for size limiting, by introducing CONFIG_HAS_XXX_SIZE_LIMIT for all those options that don't have it yet.

<...>

Quoted 15 lines
Quoted 15 lines
arch/x86/cpu/apollolake/Kconfig +4 -1
index 5dd866ffcfe..d70e8def36f 100644
@@ -78,8 +78,11 @@ config MMCONF_BASE_ADDRESS
 	hex
 	default 0xe0000000
 
+config HAS_TPL_SIZE_LIMIT
+	default y
+
 config TPL_SIZE_LIMIT
-	default 0x7800
+	default 0x7800 if HAS_TPL_SIZE_LIMIT
 
Quoted 5 lines

arch/x86/cpu/apollolake/Kconfig config MMCONF_BASE_ADDRESS · line 88

Quoted 2 lines
arch/x86/cpu/apollolake/Kconfig +0 -0
 config CPU_ADDR_BITS
 	default 39

These should be "default y if .." in the main Kconfig entry for the option.

Not sure if I'm following you here. So you mean both of the defaults should be moved to common/spl/Kconfig.tpl? - like

	config HAS_TPL_SIZE_LIMIT
		[...]
		default y if INTEL_APOLLOLAKE
Quoted 5 lines
Quoted 3 lines
	config TPL_SIZE_LIMIT
		[...]
		default 0x7800 if INTEL_APOLLOLAKE

Yes, like that.

Ok.

Quoted 10 lines
Quoted 7 lines
Quoted 5 lines

configs/am62ax_evm_r5_defconfig

Quoted 2 lines
configs/am62ax_evm_r5_defconfig +0 -0

The reset of these, to Marek's point, show that we need to also add "default y if .." for a number of other platforms too.

Which platforms exactly?

So the platforms today which have a default ..size.. if SOC should also be listed as default y if SOC, is that I was I believe getting at.

Yes, this part is already included as of now.

Quoted 35 lines
Quoted 9 lines
Quoted 3 lines

At least the ones
where today we have default limits provided in Kconfig today.

Besides the ones handled above, i.e.
arch/arm/mach-socfpga/Kconfig,
arch/mips/mach-mtmips/Kconfig and
arch/x86/cpu/apollolake/Kconfig,

Quoted 5 lines

there aren't any.

I myself am not very fond of changing that many defconfigs, but I still don't see a way of avoiding it. I guess it would become more clear if you concretely name a few examples.

So, part of the pattern is that we should take this from common/spl/Kconfig:
config SPL_SIZE_LIMIT

        hex "Maximum size of SPL image"
        default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB
        default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
        default 0x30000 if ARCH_MVEBU && ARMADA_32BIT
        default 0x0
        help
	  ...

And it becomes:

config HAS_SPL_SIZE_LIMIT
bool "Enforce a maximum size of the SPL image
default y if ARCH_MX6 || (ARCH_MVEBU && ARMADA_32BIT) || \
ARCH_K3
help
.. What we had talked about in earlier threads to be clear about what .. is / isn't checked by this option.

Quoted 9 lines

config SPL_SIZE_LIMIT

        hex "Maximum size of SPL image"
	depends on HAS_SPL_SIZE_LIMIT
        default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB
        default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
        default 0x30000 if ARCH_MVEBU && ARMADA_32BIT
	help
	  ..

Ok, I agree until here, but ...

Quoted 3 lines

And note that I've added ARCH_K3 to the list here because from a quick grep, TI K3 platforms also set SPL_SIZE_LIMIT and so with this, you won't have to change all of those defconfigs as well.

concerning ARCH_K3 I do not yet agree:

git grep -l ARCH_K3=y configs | wc -l

Quoted 7 lines

gives me 54 ARCH_K3 platforms. But only 24 of them use SPL_SIZE_LIMITs:

git grep -l ARCH_K3=y configs | xargs grep -l SIZE_LIMIT | wc -l

So if I'm not mistaken, we cannot set default HAS_SPL_SIZE_LIMIT for ARCH_K3.

Quoted 7 lines

Some of them use different limits.

$ ./tools/qconfig.py -b
... wait
$ ./tools/qconfig.py -f ~SPL_SIZE_LIMIT ARCH_K3
0 matches

So no platforms set ARCH_K3 and do not set SPL_SIZE_LIMIT.

I wasn't aware of the qconfig tool. Thanks for the hint. However, SPL_SIZE_LIMIT is always defined:

	./tools/qconfig.py ARCH_K3 SPL_SIZE_LIMIT=0x0
	23 matches

Tells us there are 23 boards not using SPL_SIZE_LIMITs.

Nevertheless I'll go ahead and try if "qconfig.py -i" gives us something else which might work instead.

Best regards,
Philip

#19 lore raw

PATCH v3 3/5 Image size checks: Use consistent help texts

In reply to Philip Oberfichtner

The multiple XXX_SIZE_LIMIT options use slightly varying help texts. Their similarities and differences should become more clear if we use consistent help texts.

---
 Kconfig | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
Kconfig +10 -10
index e73dd91a408..aa00669ba20 100644
@@ -538,7 +538,7 @@ config BUILD_TARGET
 menu "Image size limits"
 
 config HAS_BOARD_SIZE_LIMIT
-	bool "Define a maximum size for the U-Boot image"
+	bool "Enable size limit check for the U-Boot image"
 	depends on !COMPILE_TEST
 	default y if RCAR_32 || RCAR_64
 	help
@@ -562,11 +562,11 @@ config HAS_VPL_SIZE_LIMIT
 	depends on VPL
 
 config VPL_SIZE_LIMIT
-	hex "Maximum size of VPL image"
+	hex "Maximum size of VPL image in bytes"
 	depends on HAS_VPL_SIZE_LIMIT
 	help
-	  Specifies the maximum length of the U-Boot VPL image.
-	  If this value is zero, it is ignored.
+	  Maximum size of the VPL image. When defined, the build system checks
+	  that the actual size does not exceed it.
 
 config HAS_TPL_SIZE_LIMIT
 	bool "Enable size limit check for the TPL image"
@@ -574,11 +574,11 @@ config HAS_TPL_SIZE_LIMIT
 	depends on TPL
 
 config TPL_SIZE_LIMIT
-	hex "Maximum size of TPL image"
+	hex "Maximum size of TPL image in bytes"
 	depends on HAS_TPL_SIZE_LIMIT
 	help
-	  Specifies the maximum length of the U-Boot TPL image.
-	  If this value is zero, it is ignored.
+	  Maximum size of the TPL image. When defined, the build system checks
+	  that the actual size does not exceed it.
 
 config HAS_SPL_SIZE_LIMIT
 	bool "Enable size limit check for the SPL image"
@@ -586,14 +586,14 @@ config HAS_SPL_SIZE_LIMIT
 	depends on SPL
 
 config SPL_SIZE_LIMIT
-	hex "Maximum size of SPL image"
+	hex "Maximum size of SPL image in bytes"
 	depends on HAS_SPL_SIZE_LIMIT
 	default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB
 	default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
 	default 0x30000 if ARCH_MVEBU && ARMADA_32BIT
 	help
-	  Specifies the maximum length of the U-Boot SPL image.
-	  If this value is zero, it is ignored.
+	  Maximum size of the SPL image. When defined, the build system checks
+	  that the actual size does not exceed it.
 
 config SPL_SIZE_LIMIT_SUBTRACT_GD
 	bool "SPL image size check: provide space for global data"
Signature · 1 line
2.39.5
#20 lore raw

Re: [PATCH v3 3/5] Image size checks: Use consistent help texts

Quoted 23 lines · Philip Oberfichtner

The multiple XXX_SIZE_LIMIT options use slightly varying help texts. Their similarities and differences should become more clear if we use consistent help texts.

---
  Kconfig | 20 ++++++++++----------
  1 file changed, 10 insertions(+), 10 deletions(-)
Kconfig +1 -1
index e73dd91a408..aa00669ba20 100644
@@ -538,7 +538,7 @@ config BUILD_TARGET
  menu "Image size limits"
 
  config HAS_BOARD_SIZE_LIMIT
-	bool "Define a maximum size for the U-Boot image"
+	bool "Enable size limit check for the U-Boot image"
  	depends on !COMPILE_TEST
  	default y if RCAR_32 || RCAR_64
  	help

Kconfig config HAS_VPL_SIZE_LIMIT · line 568

Quoted 10 lines
Kconfig +2 -3
@@ -562,11 +562,11 @@ config HAS_VPL_SIZE_LIMIT
  	depends on VPL
 
  config VPL_SIZE_LIMIT
-	hex "Maximum size of VPL image"
+	hex "Maximum size of VPL image in bytes"
  	depends on HAS_VPL_SIZE_LIMIT
  	help
-	  Specifies the maximum length of the U-Boot VPL image.
-	  If this value is zero, it is ignored.
+	  Maximum size of the VPL image. When defined, the build system checks

The "when defined ..." part should be in HAS_VPL_SIZE_LIMIT , which gates access to VPL_SIZE_LIMIT . If HAS_VPL_SIZE_LIMIT is set, then this is always defined.

#21 lore raw

Re: [PATCH v3 3/5] Image size checks: Use consistent help texts

Quoted 28 lines · Marek Vasut
Quoted 27 lines · Philip Oberfichtner

The multiple XXX_SIZE_LIMIT options use slightly varying help texts. Their similarities and differences should become more clear if we use consistent help texts.

---
  Kconfig | 20 ++++++++++----------
  1 file changed, 10 insertions(+), 10 deletions(-)
Kconfig +2 -2
index e73dd91a408..aa00669ba20 100644
@@ -538,7 +538,7 @@ config BUILD_TARGET
  menu "Image size limits"
  config HAS_BOARD_SIZE_LIMIT
-	bool "Define a maximum size for the U-Boot image"
+	bool "Enable size limit check for the U-Boot image"
  	depends on !COMPILE_TEST
  	default y if RCAR_32 || RCAR_64
  	help
@@ -562,11 +562,11 @@ config HAS_VPL_SIZE_LIMIT
  	depends on VPL
  config VPL_SIZE_LIMIT
-	hex "Maximum size of VPL image"
+	hex "Maximum size of VPL image in bytes"
  	depends on HAS_VPL_SIZE_LIMIT
Quoted 8 lines

Kconfig config HAS_VPL_SIZE_LIMIT · line 568

Quoted 4 lines
Kconfig +1 -2
  	help
-	  Specifies the maximum length of the U-Boot VPL image.
-	  If this value is zero, it is ignored.
+	  Maximum size of the VPL image. When defined, the build system checks

The "when defined ..." part should be in HAS_VPL_SIZE_LIMIT , which gates access to VPL_SIZE_LIMIT . If HAS_VPL_SIZE_LIMIT is set, then this is always defined.

Yep, you're right. Good point.

#22 lore raw

PATCH v3 4/5 Image size checks: Deduplicate Makefile

In reply to Philip Oberfichtner

Deduplicate some redundancies within the SIZE_CHECK code in the toplevel Makefile. No functional changes.

Note: To make this work for the special case of SPL, spl_size_limit.c has to print an empty string "" instead of zero when there is no size limit in place.

---
 Makefile               | 45 +++++++++++-------------------------------
 tools/spl_size_limit.c |  4 ++--
 2 files changed, 13 insertions(+), 36 deletions(-)
Makefile +11 -34
index a17d8b57196..b6f01591ee9 100644
@@ -428,8 +428,9 @@ KBUILD_HOSTLDLIBS   := $(HOST_LFS_LIBS) $(HOSTLDLIBS)
 # Check ths size of a binary:
 # Args:
 #   $1: File to check
-#   #2: Size limit in bytes (decimal or 0xhex)
+#   #2: Size limit in bytes (decimal or 0xhex), always return OK if undefined
 define size_check
+	test -z "$2" && exit 0; \
 	actual=$$( wc -c $1 | awk '{print $$1}'); \
 	limit=$$( printf "%d" $2 ); \
 	if test $$actual -gt $$limit; then \
@@ -1103,30 +1104,6 @@ LDPPFLAGS += \
 #########################################################################
 #########################################################################
 
-ifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
-BOARD_SIZE_CHECK= @ $(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT))
-else
-BOARD_SIZE_CHECK =
-endif
-
-ifneq ($(CONFIG_SPL_SIZE_LIMIT),)
-SPL_SIZE_CHECK = @$(call size_check,$@,$$(tools/spl_size_limit))
-else
-SPL_SIZE_CHECK =
-endif
-
-ifneq ($(CONFIG_TPL_SIZE_LIMIT),)
-TPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_TPL_SIZE_LIMIT))
-else
-TPL_SIZE_CHECK =
-endif
-
-ifneq ($(CONFIG_VPL_SIZE_LIMIT),)
-VPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_VPL_SIZE_LIMIT))
-else
-VPL_SIZE_CHECK =
-endif
-
 # Statically apply RELA-style relocations (currently arm64 only)
 # This is useful for arm64 where static relocation needs to be performed on
 # the raw binary, but certain simulators only accept an ELF file (but don't
@@ -1470,7 +1447,7 @@ endif
 
 %.imx: $(IMX_DEPS) %.bin
 	$(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
-	$(BOARD_SIZE_CHECK)
+	@$(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT))
 
 %.vyb: %.imx
 	$(Q)$(MAKE) $(build)=arch/arm/cpu/armv7/vf610 $@
@@ -1571,11 +1548,11 @@ endif
 
 u-boot-nodtb.bin: u-boot FORCE
 	$(call if_changed,objcopy_uboot)
-	$(BOARD_SIZE_CHECK)
+	@$(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT))
 
 u-boot.ldr:	u-boot
 		$(LDR) -T $(CONFIG_LDR_CPU) -c $@ $< $(LDR_FLAGS)
-		$(BOARD_SIZE_CHECK)
+		@$(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT))
 
 # binman
 # ---------------------------------------------------------------------------
@@ -1702,7 +1679,7 @@ u-boot-dtb.img u-boot.img u-boot.kwb u-boot.pbl u-boot-ivt.img: \
 			$(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SANDBOX),dts/dt.dtb) \
 		,$(UBOOT_BIN)) FORCE
 	$(call if_changed,mkimage)
-	$(BOARD_SIZE_CHECK)
+	@$(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT))
 
 ifeq ($(CONFIG_SPL_LOAD_FIT_FULL),y)
 MKIMAGEFLAGS_u-boot.itb =
@@ -1717,12 +1694,12 @@ u-boot.itb: u-boot-nodtb.bin \
 		$(if $(CONFIG_MULTI_DTB_FIT),$(FINAL_DTB_CONTAINER)) \
 		$(U_BOOT_ITS) FORCE
 	$(call if_changed,mkfitimage)
-	$(BOARD_SIZE_CHECK)
+	@$(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT))
 endif
 
 u-boot-with-spl.kwb: u-boot.bin spl/u-boot-spl.bin FORCE
 	$(call if_changed,mkimage)
-	$(BOARD_SIZE_CHECK)
+	@$(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT))
 
 u-boot.dis:	u-boot
 		$(OBJDUMP) -d $< > $@
@@ -2346,7 +2323,7 @@ u-boot.lds: $(LDSCRIPT) prepare FORCE
 
 spl/u-boot-spl.bin: spl/u-boot-spl
 	@:
-	$(SPL_SIZE_CHECK)
+	@$(call size_check,$@,$$(tools/spl_size_limit))
 
 spl/u-boot-spl-dtb.bin: spl/u-boot-spl
 	@:
@@ -2371,14 +2348,14 @@ spl/boot.bin: spl/u-boot-spl
 
 tpl/u-boot-tpl.bin: tpl/u-boot-tpl
 	@:
-	$(TPL_SIZE_CHECK)
+	@$(call size_check,$@,$(CONFIG_TPL_SIZE_LIMIT))
 
 tpl/u-boot-tpl: tools prepare $(if $(CONFIG_TPL_OF_CONTROL),dts/dt.dtb)
 	$(Q)$(MAKE) obj=tpl -f $(srctree)/scripts/Makefile.xpl all
 
 vpl/u-boot-vpl.bin: vpl/u-boot-vpl
 	@:
-	$(VPL_SIZE_CHECK)
+	@$(call size_check,$@,$(CONFIG_VPL_SIZE_LIMIT))
 
 vpl/u-boot-vpl: tools prepare $(if $(CONFIG_TPL_OF_CONTROL),dts/dt.dtb)
 	$(Q)$(MAKE) obj=vpl -f $(srctree)/scripts/Makefile.xpl all
tools/spl_size_limit.c +2 -2
index c6c139e834f..c956a0e2624 100644
@@ -10,9 +10,9 @@
 
 int main(int argc, char *argv[])
 {
+#ifdef CONFIG_SPL_SIZE_LIMIT
 	int spl_size_limit = 0;
 
-#ifdef CONFIG_SPL_SIZE_LIMIT
 	spl_size_limit = CONFIG_SPL_SIZE_LIMIT;
 #if defined(CONFIG_IMX_HAB) && defined(CONFIG_CSF_SIZE)
 	spl_size_limit -= CONFIG_CSF_SIZE;
@@ -25,9 +25,9 @@ int main(int argc, char *argv[])
 #endif
 #ifdef CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK
 	spl_size_limit -= CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK;
-#endif
 #endif
 
 	printf("%d", spl_size_limit);
+#endif
 	return 0;
 }
Signature · 1 line
2.39.5
#23 lore raw

Re: [PATCH v3 4/5] Image size checks: Deduplicate Makefile

Quoted 18 lines · Philip Oberfichtner

Deduplicate some redundancies within the SIZE_CHECK code in the toplevel Makefile. No functional changes.

Note: To make this work for the special case of SPL, spl_size_limit.c has to print an empty string "" instead of zero when there is no size limit in place.

---
  Makefile               | 45 +++++++++++-------------------------------
  tools/spl_size_limit.c |  4 ++--
  2 files changed, 13 insertions(+), 36 deletions(-)
Makefile +0 -0
index a17d8b57196..b6f01591ee9 100644

Makefile KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS) · line 431

Quoted 5 lines
Makefile +1 -1
@@ -428,8 +428,9 @@ KBUILD_HOSTLDLIBS   := $(HOST_LFS_LIBS) $(HOSTLDLIBS)
  # Check ths size of a binary:
  # Args:
  #   $1: File to check
-#   #2: Size limit in bytes (decimal or 0xhex)
+#   #2: Size limit in bytes (decimal or 0xhex), always return OK if undefined

You should be able to use the HAS_ variables to correctly test for and handle the undefined case .

#24 lore raw

Re: [PATCH v3 4/5] Image size checks: Deduplicate Makefile

Quoted 14 lines · Marek Vasut
Quoted 13 lines · Philip Oberfichtner

Deduplicate some redundancies within the SIZE_CHECK code in the toplevel Makefile. No functional changes.

Note: To make this work for the special case of SPL, spl_size_limit.c has to print an empty string "" instead of zero when there is no size limit in place.

---
  Makefile               | 45 +++++++++++-------------------------------
  tools/spl_size_limit.c |  4 ++--
  2 files changed, 13 insertions(+), 36 deletions(-)
Quoted 13 lines

Makefile KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS) · line 431

Quoted 10 lines
Makefile +1 -1
index a17d8b57196..b6f01591ee9 100644
@@ -428,8 +428,9 @@ KBUILD_HOSTLDLIBS   := $(HOST_LFS_LIBS) $(HOSTLDLIBS)
  # Check ths size of a binary:
  # Args:
  #   $1: File to check
-#   #2: Size limit in bytes (decimal or 0xhex)
+#   #2: Size limit in bytes (decimal or 0xhex), always return OK if undefined

You should be able to use the HAS_ variables to correctly test for and handle the undefined case .

In general, I agree. But this would mean to reintroduce the multiply duplicated Makefile bloat à la:

	ifeq ($(CONFIG_HAS_BOARD_SIZE_LIMIT),y)
	BOARD_SIZE_CHECK= @ $(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT))
	else
	BOARD_SIZE_CHECK =
	endif

That's why after all I preferred my "test -z" solution. Is there maybe a third way I am missing out on?

What do you think about giving size_check another argument, i.e. call size_check,$@,$(CONFIG_HAS_BOARD_SIZE_LIMIT),$(CONFIG_BOARD_SIZE_LIMIT)

Any other suggestions?

#25 lore raw

Re: [PATCH v3 4/5] Image size checks: Deduplicate Makefile

Quoted 39 lines · Philip Oberfichtner
Quoted 14 lines · Marek Vasut
Quoted 13 lines · Philip Oberfichtner

Deduplicate some redundancies within the SIZE_CHECK code in the toplevel Makefile. No functional changes.

Note: To make this work for the special case of SPL, spl_size_limit.c has to print an empty string "" instead of zero when there is no size limit in place.

---
   Makefile               | 45 +++++++++++-------------------------------
   tools/spl_size_limit.c |  4 ++--
   2 files changed, 13 insertions(+), 36 deletions(-)
Quoted 13 lines

Makefile KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS) · line 431

Quoted 10 lines
Makefile +1 -1
index a17d8b57196..b6f01591ee9 100644
@@ -428,8 +428,9 @@ KBUILD_HOSTLDLIBS   := $(HOST_LFS_LIBS) $(HOSTLDLIBS)
   # Check ths size of a binary:
   # Args:
   #   $1: File to check
-#   #2: Size limit in bytes (decimal or 0xhex)
+#   #2: Size limit in bytes (decimal or 0xhex), always return OK if undefined

You should be able to use the HAS_ variables to correctly test for and handle the undefined case .

In general, I agree. But this would mean to reintroduce the multiply duplicated Makefile bloat à la:

	ifeq ($(CONFIG_HAS_BOARD_SIZE_LIMIT),y)
	BOARD_SIZE_CHECK= @ $(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT))
	else
	BOARD_SIZE_CHECK =
	endif
Quoted 5 lines

That's why after all I preferred my "test -z" solution. Is there maybe a third way I am missing out on?

What do you think about giving size_check another argument, i.e. call size_check,$@,$(CONFIG_HAS_BOARD_SIZE_LIMIT),$(CONFIG_BOARD_SIZE_LIMIT)

This could be an option , yes .

#26 lore raw

Re: [PATCH v3 4/5] Image size checks: Deduplicate Makefile

Quoted 40 lines · Marek Vasut
Quoted 39 lines · Philip Oberfichtner
Quoted 14 lines · Marek Vasut
Quoted 13 lines · Philip Oberfichtner

Deduplicate some redundancies within the SIZE_CHECK code in the toplevel Makefile. No functional changes.

Note: To make this work for the special case of SPL, spl_size_limit.c has to print an empty string "" instead of zero when there is no size limit in place.

---
   Makefile               | 45 +++++++++++-------------------------------
   tools/spl_size_limit.c |  4 ++--
   2 files changed, 13 insertions(+), 36 deletions(-)
Quoted 13 lines

Makefile KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS) · line 431

Quoted 10 lines
Makefile +1 -1
index a17d8b57196..b6f01591ee9 100644
@@ -428,8 +428,9 @@ KBUILD_HOSTLDLIBS   := $(HOST_LFS_LIBS) $(HOSTLDLIBS)
   # Check ths size of a binary:
   # Args:
   #   $1: File to check
-#   #2: Size limit in bytes (decimal or 0xhex)
+#   #2: Size limit in bytes (decimal or 0xhex), always return OK if undefined

You should be able to use the HAS_ variables to correctly test for and handle the undefined case .

In general, I agree. But this would mean to reintroduce the multiply duplicated Makefile bloat à la:

	ifeq ($(CONFIG_HAS_BOARD_SIZE_LIMIT),y)
	BOARD_SIZE_CHECK= @ $(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT))
	else
	BOARD_SIZE_CHECK =
	endif
Quoted 6 lines
Quoted 5 lines

That's why after all I preferred my "test -z" solution. Is there maybe a third way I am missing out on?

What do you think about giving size_check another argument, i.e. call size_check,$@,$(CONFIG_HAS_BOARD_SIZE_LIMIT),$(CONFIG_BOARD_SIZE_LIMIT)

This could be an option , yes .

Okay, I'll try it this way in v4.

Unfortunately I'm on leave the upcoming three weeks. I won't be able to pick up this patch again before the end of this month.

Best regards,
Philip

#27 lore raw

PATCH v3 5/5 Image size checks: Simplify SPL_SIZE_LIMIT logic

In reply to Philip Oberfichtner

Simplify the depends-on logic for SPL_SIZE_LIMIT. No functional change.

---
 Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Kconfig +1 -1
index aa00669ba20..343299eed50 100644
@@ -588,8 +588,8 @@ config HAS_SPL_SIZE_LIMIT
 config SPL_SIZE_LIMIT
 	hex "Maximum size of SPL image in bytes"
 	depends on HAS_SPL_SIZE_LIMIT
-	default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB
 	default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
+	default 0x11000 if ARCH_MX6
 	default 0x30000 if ARCH_MVEBU && ARMADA_32BIT
 	help
 	  Maximum size of the SPL image. When defined, the build system checks
Signature · 1 line
2.39.5
Reviewed-by on v3 5/5
#28 lore raw

Re: [PATCH v3 5/5] Image size checks: Simplify SPL_SIZE_LIMIT logic

Quoted 12 lines · Philip Oberfichtner

Simplify the depends-on logic for SPL_SIZE_LIMIT. No functional change.

---
  Kconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Kconfig +0 -0
index aa00669ba20..343299eed50 100644

Kconfig config HAS_SPL_SIZE_LIMIT · line 595

Quoted 9 lines
Kconfig +1 -1
@@ -588,8 +588,8 @@ config HAS_SPL_SIZE_LIMIT
  config SPL_SIZE_LIMIT
  	hex "Maximum size of SPL image in bytes"
  	depends on HAS_SPL_SIZE_LIMIT
-	default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB
  	default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
+	default 0x11000 if ARCH_MX6
  	default 0x30000 if ARCH_MVEBU && ARMADA_32BIT
  	help
  	  Maximum size of the SPL image. When defined, the build system checks
#29 lore raw

Re: [PATCH v3 5/5] Image size checks: Simplify SPL_SIZE_LIMIT logic

In reply to Philip Oberfichtner
Quoted 12 lines · Philip Oberfichtner

Simplify the depends-on logic for SPL_SIZE_LIMIT. No functional change.

---
  Kconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Kconfig +0 -0
index aa00669ba20..343299eed50 100644

Kconfig config HAS_SPL_SIZE_LIMIT · line 592

Quoted 6 lines
Kconfig +1 -1
@@ -588,8 +588,8 @@ config HAS_SPL_SIZE_LIMIT
  config SPL_SIZE_LIMIT
  	hex "Maximum size of SPL image in bytes"
  	depends on HAS_SPL_SIZE_LIMIT
-	default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB
  	default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
+	default 0x11000 if ARCH_MX6

This makes it less obvious what the other case (!256 kiB SRAM SoCs) covers, why is that an improvement ?

#30 lore raw

Re: [PATCH v3 5/5] Image size checks: Simplify SPL_SIZE_LIMIT logic

Quoted 8 lines · Marek Vasut
Quoted 7 lines · Philip Oberfichtner

Simplify the depends-on logic for SPL_SIZE_LIMIT. No functional change.

---
  Kconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

Kconfig config HAS_SPL_SIZE_LIMIT · line 592

Quoted 11 lines
Kconfig +1 -1
index aa00669ba20..343299eed50 100644
@@ -588,8 +588,8 @@ config HAS_SPL_SIZE_LIMIT
  config SPL_SIZE_LIMIT
  	hex "Maximum size of SPL image in bytes"
  	depends on HAS_SPL_SIZE_LIMIT
-	default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB
  	default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
+	default 0x11000 if ARCH_MX6

This makes it less obvious what the other case (!256 kiB SRAM SoCs) covers, why is that an improvement ?

This was originally Heinrich's idea. I personally find it better this way, but I won't argue about it. Can you please find a consensus the two of you?

#31 lore raw

Re: [PATCH v3 5/5] Image size checks: Simplify SPL_SIZE_LIMIT logic

Quoted 23 lines · Philip Oberfichtner
Quoted 8 lines · Marek Vasut
Quoted 7 lines · Philip Oberfichtner

Simplify the depends-on logic for SPL_SIZE_LIMIT. No functional change.

---
   Kconfig | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

Kconfig config HAS_SPL_SIZE_LIMIT · line 592

Quoted 11 lines
Kconfig +1 -1
index aa00669ba20..343299eed50 100644
@@ -588,8 +588,8 @@ config HAS_SPL_SIZE_LIMIT
   config SPL_SIZE_LIMIT
   	hex "Maximum size of SPL image in bytes"
   	depends on HAS_SPL_SIZE_LIMIT
-	default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB
   	default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
+	default 0x11000 if ARCH_MX6

This makes it less obvious what the other case (!256 kiB SRAM SoCs) covers, why is that an improvement ?

Quoted 3 lines

This was originally Heinrich's idea. I personally find it better this way, but I won't argue about it. Can you please find a consensus the two of you?

We can drop the patch.

Best regards

Heinrich

#32 lore raw

Re: [PATCH v3 5/5] Image size checks: Simplify SPL_SIZE_LIMIT logic

In reply to Philip Oberfichtner
Quoted 23 lines · Philip Oberfichtner
Quoted 8 lines · Marek Vasut
Quoted 7 lines · Philip Oberfichtner

Simplify the depends-on logic for SPL_SIZE_LIMIT. No functional change.

---
   Kconfig | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

Kconfig config HAS_SPL_SIZE_LIMIT · line 592

Quoted 11 lines
Kconfig +1 -1
index aa00669ba20..343299eed50 100644
@@ -588,8 +588,8 @@ config HAS_SPL_SIZE_LIMIT
   config SPL_SIZE_LIMIT
   	hex "Maximum size of SPL image in bytes"
   	depends on HAS_SPL_SIZE_LIMIT
-	default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB
   	default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
+	default 0x11000 if ARCH_MX6

This makes it less obvious what the other case (!256 kiB SRAM SoCs) covers, why is that an improvement ?

Quoted 2 lines

This was originally Heinrich's idea. I personally find it better this way, but I won't argue about it.

Why do you send a patch which you cannot even argue is correct ?

Quoted 1 line

Can you please find a consensus the two of you?

No, you should be able to clarify why this patch should be applied, do not shift this onus to other participants.

#33 lore raw

Re: [PATCH v3 5/5] Image size checks: Simplify SPL_SIZE_LIMIT logic

Quoted 27 lines · Marek Vasut
Quoted 23 lines · Philip Oberfichtner
Quoted 8 lines · Marek Vasut
Quoted 7 lines · Philip Oberfichtner

Simplify the depends-on logic for SPL_SIZE_LIMIT. No functional change.

---
   Kconfig | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

Kconfig config HAS_SPL_SIZE_LIMIT · line 592

Quoted 11 lines
Kconfig +1 -1
index aa00669ba20..343299eed50 100644
@@ -588,8 +588,8 @@ config HAS_SPL_SIZE_LIMIT
   config SPL_SIZE_LIMIT
   	hex "Maximum size of SPL image in bytes"
   	depends on HAS_SPL_SIZE_LIMIT
-	default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB
   	default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
+	default 0x11000 if ARCH_MX6

This makes it less obvious what the other case (!256 kiB SRAM SoCs) covers, why is that an improvement ?

Quoted 2 lines

This was originally Heinrich's idea. I personally find it better this way, but I won't argue about it.

Quoted 6 lines

Why do you send a patch which you cannot even argue is correct ?

Quoted 1 line

Can you please find a consensus the two of you?

No, you should be able to clarify why this patch should be applied, do not shift this onus to other participants.

I prefer conciseness over verbosity. That's all. But I'm okay to step back on this one. There may be different view points.