On Fri, Sep 18, 2026 at 10:57:33AM +0400, Alexey Charkov wrote:
> On Thu, Sep 17, 2026 at 11:52 PM Tom Rini <[email protected]> wrote:
> >
> > On Thu, Sep 17, 2026 at 06:02:25PM +0400, Alexey Charkov wrote:
> >
> > > spl_decompression_enabled() names the two algorithms SPL happened to
> > > support, so every algorithm added to image_decomp() requires editing the
> > > header. It also asks about CONFIG_SPL_* from a header included in every
> > > phase, so a VPL build with VPL_LZMA reads SPL_LZMA and answers about the
> > > wrong phase.
> > >
> > > Add a hidden per-phase symbol selected by any of the compression
> > > algorithms and ask about that instead, which also matches how
> > > image_decomp() gates its own cases.
> > >
> > > SPL_BZIP2 is out of scope: lib/bzip2 has no phase-aware build rule.
> > >
> > > Signed-off-by: Alexey Charkov <[email protected]>
> > > ---
> > >  include/spl.h |  6 +++---
> > >  lib/Kconfig   | 30 ++++++++++++++++++++++++++++++
> > >  2 files changed, 33 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/include/spl.h b/include/spl.h
> > > index 8a9f799f192a..50b41a3a3908 100644
> > > --- a/include/spl.h
> > > +++ b/include/spl.h
> > > @@ -1204,13 +1204,13 @@ int spl_load_fit_image(struct spl_image_info 
> > > *spl_image,
> > >                      const struct legacy_img_hdr *header);
> > >
> > >  /*
> > > - * spl_decompression_enabled() - check decompression support is enabled 
> > > for SPL build
> > > + * spl_decompression_enabled() - check decompression support is enabled 
> > > for this phase
> > >   *
> > > - * Returns  true  if decompression support is enabled, else False
> > > + * Returns  true  if any decompression algorithm is enabled, else False
> > >   */
> > >  static inline bool spl_decompression_enabled(void)
> > >  {
> > > -     return IS_ENABLED(CONFIG_SPL_GZIP) || IS_ENABLED(CONFIG_SPL_LZMA);
> > > +     return CONFIG_IS_ENABLED(DECOMPRESSION);
> > >  }
> > >
> >
> > Is this build time check really required, or shouldn't the callers fail
> > out appropriately already?
> 
> The build time check keeps the size at bay. At first I tried dropping
> the conditional altogether, but it then caused the decompression
> helpers (like the image header parsing function) to be compiled in
> even on boards with no compression enabled, and several of them
> overflowed their SRAM size by ~500 bytes.
> 
> I guess I could either inline this Kconfig check into the callers and
> drop this indirection from the header - now that it's a one-liner
> anyway - or try and introduce a compile-time short-circuit path in the
> decompression helper functions themselves for the !DECOMPRESSION case.
> Do you have any preference?

Dang. I was hoping we could avoid adding the DECOMPRESSION symbol as
well. You've looked at all the paths I can think of too, already, so
lets go with the first option of just doing this inline in the one place
that needs it. Thanks.

-- 
Tom

Attachment: signature.asc
Description: PGP signature

Reply via email to