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

Tom Rini trini at konsulko.com
Thu Oct 2 23:19:10 CEST 2025


On Thu, Oct 02, 2025 at 10:55:19AM +0200, Philip Oberfichtner wrote:
> Hi Tom,
> 
> Thank you for the clarification.
> 
> On Tue, Sep 30, 2025 at 08:45:36AM -0600, Tom Rini wrote:
> > On Tue, Sep 30, 2025 at 10:33:13AM +0200, Philip Oberfichtner wrote:
> > > On Fri, Sep 05, 2025 at 08:19:59AM -0600, Tom Rini wrote:
> > > > On Wed, Sep 03, 2025 at 12:56:50PM +0200, Philip Oberfichtner wrote:
> > > > 
> > > > > 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.
> > > > > 
> > > > > Signed-off-by: Philip Oberfichtner <pro at denx.de>
> > > <...>
> > > > > diff --git a/arch/x86/cpu/apollolake/Kconfig b/arch/x86/cpu/apollolake/Kconfig
> > > > > index 5dd866ffcfe..d70e8def36f 100644
> > > > > --- a/arch/x86/cpu/apollolake/Kconfig
> > > > > +++ b/arch/x86/cpu/apollolake/Kconfig
> > > > > @@ -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
> > > > 
> > > > 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
> > 
> > Yes, like that.
> 
> Ok.
> 
> > 
> > > > > diff --git a/configs/am62ax_evm_r5_defconfig b/configs/am62ax_evm_r5_defconfig
> > > > 
> > > > 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.
> 
> > 
> > > > 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.
> > 
> > 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
> > 	  ..
> > 
> 
> Ok, I agree until here, but ...
> 
> 
> > 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.

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.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20251002/686b25df/attachment.sig>


More information about the U-Boot mailing list