All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] SPL: Do not allow enabling SPL symbols for non-SPL builds
@ 2022-05-09 18:53 Pali Rohár
  2022-05-09 20:22 ` Tom Rini
  2022-05-24  9:11 ` [PATCH v2] " Pali Rohár
  0 siblings, 2 replies; 6+ messages in thread
From: Pali Rohár @ 2022-05-09 18:53 UTC (permalink / raw)
  To: Simon Glass, Stefan Roese; +Cc: u-boot

It does not make sense to enable SPL options when not building SPL binary.

So disallow selecting SPL options for non-SPL builds.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 arch/arm/Kconfig                |  6 +++++-
 arch/arm/cpu/armv8/Kconfig      |  2 ++
 common/Kconfig                  |  5 +++++
 common/spl/Kconfig              |  4 ++--
 drivers/firmware/Kconfig        |  1 +
 drivers/gpio/Kconfig            |  1 +
 drivers/misc/Kconfig            |  1 +
 drivers/mmc/Kconfig             |  5 +++++
 drivers/mtd/spi/Kconfig         |  1 +
 drivers/power/Kconfig           |  1 +
 drivers/power/acpi_pmc/Kconfig  |  1 +
 drivers/power/regulator/Kconfig |  1 +
 fs/cbfs/Kconfig                 |  1 +
 lib/Kconfig                     | 10 +++++++++-
 14 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0afec5155b1b..e4b2b76650fe 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -985,7 +985,7 @@ config ARCH_MX6
 	imply SYS_THUMB_BUILD
 	imply SPL_SEPARATE_BSS
 
-if ARCH_MX6
+if ARCH_MX6 && SPL
 config SPL_LDSCRIPT
 	default "arch/arm/mach-omap2/u-boot-spl.lds"
 endif
@@ -2343,7 +2343,11 @@ source "arch/arm/Kconfig.debug"
 
 endmenu
 
+if SPL
+
 config SPL_LDSCRIPT
 	default "arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds" if (ARCH_MX23 || ARCH_MX28) && !SPL_FRAMEWORK
 	default "arch/arm/cpu/arm1136/u-boot-spl.lds" if CPU_ARM1136
 	default "arch/arm/cpu/armv8/u-boot-spl.lds" if ARM64
+
+endif
diff --git a/arch/arm/cpu/armv8/Kconfig b/arch/arm/cpu/armv8/Kconfig
index 09f3f50fa22f..0476446bc5ba 100644
--- a/arch/arm/cpu/armv8/Kconfig
+++ b/arch/arm/cpu/armv8/Kconfig
@@ -76,6 +76,7 @@ config ARMV8_SEC_FIRMWARE_SUPPORT
 
 config SPL_ARMV8_SEC_FIRMWARE_SUPPORT
 	bool "Enable ARMv8 secure monitor firmware framework support for SPL"
+	depends on SPL
 	select SPL_FIT
 	select SPL_OF_LIBFDT
 	help
@@ -83,6 +84,7 @@ config SPL_ARMV8_SEC_FIRMWARE_SUPPORT
 
 config SPL_RECOVER_DATA_SECTION
 	bool "save/restore SPL data section"
+	depends on SPL
 	help
 	  Say Y here to save SPL data section for cold boot, and restore
 	  at warm boot in SPL phase.
diff --git a/common/Kconfig b/common/Kconfig
index a96842a5c11d..8e59dcef4b8b 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -81,10 +81,14 @@ config LOGLEVEL
 	    8 - debug content
 	    9 - debug hardware I/O
 
+if SPL
+
 config SPL_LOGLEVEL
 	int
 	default LOGLEVEL
 
+endif
+
 config TPL_LOGLEVEL
 	int
 	default LOGLEVEL
@@ -241,6 +245,7 @@ config SYS_STDIO_DEREGISTER
 
 config SPL_SYS_STDIO_DEREGISTER
 	bool "Allow deregistering stdio devices in SPL"
+	depends on SPL
 	help
 	  Generally there is no need to deregister stdio devices since they
 	  are never deactivated. But if a stdio device is used which can be
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 84f2847c724b..3cfb19331272 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -19,6 +19,8 @@ config SPL
 	help
 	  If you want to build SPL as well as the normal image, say Y.
 
+if SPL
+
 config SPL_FRAMEWORK
 	bool "Support SPL based upon the common SPL framework"
 	depends on SPL
@@ -150,8 +152,6 @@ config HANDOFF
 	  in boot. It is available in gd->handoff. The state state is set up
 	  in SPL (or TPL if that is being used).
 
-if SPL
-
 config SPL_HANDOFF
 	bool "Pass hand-off information from SPL to U-Boot proper"
 	depends on HANDOFF && SPL_BLOBLIST
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index ef958b3a7a4e..55069e395ff2 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -3,6 +3,7 @@ config FIRMWARE
 
 config SPL_FIRMWARE
 	bool "Enable Firmware driver support in SPL"
+	depends on SPL
 	depends on FIRMWARE
 
 config SPL_ARM_PSCI_FW
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 149a62ffe611..3ba97515b718 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -490,6 +490,7 @@ config DM_PCA953X
 
 config SPL_DM_PCA953X
 	bool "PCA95[357]x, PCA9698, TCA64xx, and MAX7310 I/O ports in SPL"
+	depends on SPL
 	depends on DM_GPIO
 	help
 	  Say yes here to provide access to several register-oriented
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 9af806a20ae9..b99e7c25b807 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -492,6 +492,7 @@ config FS_LOADER
 
 config SPL_FS_LOADER
 	bool "Enable loader driver for file system"
+	depends on SPL
 	help
 	  This is file system generic loader which can be used to load
 	  the file image from the storage into target such as memory.
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index f04cc44e1973..a3f0cd00ed74 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -123,6 +123,7 @@ config MMC_IO_VOLTAGE
 
 config SPL_MMC_IO_VOLTAGE
 	bool "Support IO voltage configuration in SPL"
+	depends on SPL
 	help
 	  IO voltage configuration allows selecting the voltage level of the IO
 	  lines (not the level of main supply). This is required for UHS
@@ -153,6 +154,7 @@ config MMC_HS400_ES_SUPPORT
 
 config SPL_MMC_HS400_ES_SUPPORT
 	bool "enable HS400 Enhanced Strobe support in SPL"
+	depends on SPL
 	help
 	  The HS400 Enhanced Strobe mode is support by some eMMC. The bus
 	  frequency is up to 200MHz. This mode does not tune the IO.
@@ -166,6 +168,7 @@ config MMC_HS400_SUPPORT
 
 config SPL_MMC_HS400_SUPPORT
 	bool "enable HS400 support in SPL"
+	depends on SPL
 	select SPL_MMC_HS200_SUPPORT
 	help
 	  The HS400 mode is support by some eMMC. The bus frequency is up to
@@ -179,6 +182,7 @@ config MMC_HS200_SUPPORT
 
 config SPL_MMC_HS200_SUPPORT
 	bool "enable HS200 support in SPL"
+	depends on SPL
 	help
 	  The HS200 mode is support by some eMMC. The bus frequency is up to
 	  200MHz. This mode requires tuning the IO.
@@ -478,6 +482,7 @@ config MMC_SDHCI_ADMA
 
 config SPL_MMC_SDHCI_ADMA
 	bool "Support SDHCI ADMA2 in SPL"
+	depends on SPL
 	depends on MMC_SDHCI
 	select MMC_SDHCI_ADMA_HELPERS
 	help
diff --git a/drivers/mtd/spi/Kconfig b/drivers/mtd/spi/Kconfig
index f350c7e5dc21..eed51bb22b09 100644
--- a/drivers/mtd/spi/Kconfig
+++ b/drivers/mtd/spi/Kconfig
@@ -248,6 +248,7 @@ config SPI_FLASH_MTD
 
 config SPL_SPI_FLASH_MTD
 	bool "SPI flash MTD support for SPL"
+	depends on SPL
 	depends on SPI_FLASH
 	help
           Enable the MTD support for the SPI flash layer in SPL.
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index 2c20dc7c8318..1d184b285875 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -29,6 +29,7 @@ config POWER_LEGACY
 
 config SPL_POWER_LEGACY
 	bool "Legacy power support in SPL"
+	depends on SPL
 	default y if POWER_LEGACY
 	help
 	  Note: This is a legacy option. Use SPL_DM_PMIC instead.
diff --git a/drivers/power/acpi_pmc/Kconfig b/drivers/power/acpi_pmc/Kconfig
index fcd50e36cad4..8b712abc41e9 100644
--- a/drivers/power/acpi_pmc/Kconfig
+++ b/drivers/power/acpi_pmc/Kconfig
@@ -8,6 +8,7 @@ config ACPI_PMC
 
 config SPL_ACPI_PMC
 	bool "Power Manager (x86 PMC) support in SPL"
+	depends on SPL
 	default y if ACPI_PMC
 	help
 	  Enable support for an x86-style power-management controller which
diff --git a/drivers/power/regulator/Kconfig b/drivers/power/regulator/Kconfig
index cd253b95f2f0..dde694a5c44b 100644
--- a/drivers/power/regulator/Kconfig
+++ b/drivers/power/regulator/Kconfig
@@ -148,6 +148,7 @@ config DM_REGULATOR_FIXED
 
 config SPL_DM_REGULATOR_FIXED
 	bool "Enable Driver Model for REGULATOR Fixed value in SPL"
+	depends on SPL_DM_REGULATOR
 	depends on DM_REGULATOR_FIXED
 	select SPL_DM_REGULATOR_COMMON
 	---help---
diff --git a/fs/cbfs/Kconfig b/fs/cbfs/Kconfig
index 03980d830d30..b6639928f4af 100644
--- a/fs/cbfs/Kconfig
+++ b/fs/cbfs/Kconfig
@@ -9,6 +9,7 @@ config FS_CBFS
 
 config SPL_FS_CBFS
 	bool "Enable CBFS (Coreboot Filesystem) in SPL"
+	depends on SPL
 	help
 	  Define this to enable support for reading from a Coreboot
 	  filesystem. This is a ROM-based filesystem used for accessing files
diff --git a/lib/Kconfig b/lib/Kconfig
index acc0ac081a44..299381ac80d5 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -239,6 +239,7 @@ config GENERATE_ACPI_TABLE
 
 config SPL_TINY_MEMSET
 	bool "Use a very small memset() in SPL"
+	depends on SPL
 	help
 	  The faster memset() is the arch-specific one (if available) enabled
 	  by CONFIG_USE_ARCH_MEMSET. If that is not enabled, we can still get
@@ -556,6 +557,7 @@ config MD5
 
 config SPL_MD5
 	bool "Support MD5 algorithm in SPL"
+	depends on SPL
 	help
 	  This option enables MD5 support in SPL. MD5 is an algorithm designed
 	  in 1991 that produces a 16-byte digest (or checksum) from its input
@@ -642,6 +644,7 @@ config ZSTD
 
 config SPL_LZ4
 	bool "Enable LZ4 decompression support in SPL"
+	depends on SPL
 	help
 	  This enables support for the LZ4 decompression algorithm in SPL. LZ4
 	  is a lossless data compression algorithm that is focused on
@@ -650,6 +653,7 @@ config SPL_LZ4
 
 config SPL_LZMA
 	bool "Enable LZMA decompression support for SPL build"
+	depends on SPL
 	help
 	  This enables support for LZMA compression algorithm for SPL boot.
 
@@ -661,22 +665,26 @@ config VPL_LZMA
 
 config SPL_LZO
 	bool "Enable LZO decompression support in SPL"
+	depends on SPL
 	help
 	  This enables support for LZO compression algorithm in the SPL.
 
 config SPL_GZIP
 	bool "Enable gzip decompression support for SPL build"
+	depends on SPL
 	select SPL_ZLIB
 	help
 	  This enables support for the GZIP compression algorithm for SPL boot.
 
 config SPL_ZLIB
 	bool
+	depends on SPL
 	help
 	  This enables compression lib for SPL boot.
 
 config SPL_ZSTD
 	bool "Enable Zstandard decompression support in SPL"
+	depends on SPL
 	select XXHASH
 	help
 	  This enables Zstandard decompression library in the SPL.
@@ -749,7 +757,7 @@ config SPL_OF_LIBFDT
 
 config SPL_OF_LIBFDT_ASSUME_MASK
 	hex "Mask of conditions to assume for libfdt"
-	depends on SPL_OF_LIBFDT || FIT
+	depends on SPL_OF_LIBFDT || (SPL && FIT)
 	default 0xff
 	help
 	  Use this to change the assumptions made by libfdt in SPL about the
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] SPL: Do not allow enabling SPL symbols for non-SPL builds
  2022-05-09 18:53 [PATCH] SPL: Do not allow enabling SPL symbols for non-SPL builds Pali Rohár
@ 2022-05-09 20:22 ` Tom Rini
  2022-05-10 11:29   ` Pali Rohár
  2022-05-24  9:11 ` [PATCH v2] " Pali Rohár
  1 sibling, 1 reply; 6+ messages in thread
From: Tom Rini @ 2022-05-09 20:22 UTC (permalink / raw)
  To: Pali Rohár; +Cc: Simon Glass, Stefan Roese, u-boot

[-- Attachment #1: Type: text/plain, Size: 3281 bytes --]

On Mon, May 09, 2022 at 08:53:50PM +0200, Pali Rohár wrote:

> It does not make sense to enable SPL options when not building SPL binary.
> 
> So disallow selecting SPL options for non-SPL builds.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>

Some of this makes sense, where you add SPL as an explicit dependency.
But others:

> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 0afec5155b1b..e4b2b76650fe 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -985,7 +985,7 @@ config ARCH_MX6
>  	imply SYS_THUMB_BUILD
>  	imply SPL_SEPARATE_BSS
>  
> -if ARCH_MX6
> +if ARCH_MX6 && SPL
>  config SPL_LDSCRIPT
>  	default "arch/arm/mach-omap2/u-boot-spl.lds"
>  endif
> @@ -2343,7 +2343,11 @@ source "arch/arm/Kconfig.debug"
>  
>  endmenu
>  
> +if SPL
> +
>  config SPL_LDSCRIPT
>  	default "arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds" if (ARCH_MX23 || ARCH_MX28) && !SPL_FRAMEWORK
>  	default "arch/arm/cpu/arm1136/u-boot-spl.lds" if CPU_ARM1136
>  	default "arch/arm/cpu/armv8/u-boot-spl.lds" if ARM64
> +
> +endif

Where it's like this and we're providing default values and the option
itself is prompt'd elsewhere don't as it's not cluttering the resulting
.config file.

> diff --git a/lib/Kconfig b/lib/Kconfig
> index acc0ac081a44..299381ac80d5 100644
> --- a/lib/Kconfig
> +++ b/lib/Kconfig
> @@ -239,6 +239,7 @@ config GENERATE_ACPI_TABLE
>  
>  config SPL_TINY_MEMSET
>  	bool "Use a very small memset() in SPL"
> +	depends on SPL
>  	help
>  	  The faster memset() is the arch-specific one (if available) enabled
>  	  by CONFIG_USE_ARCH_MEMSET. If that is not enabled, we can still get
> @@ -556,6 +557,7 @@ config MD5
>  
>  config SPL_MD5
>  	bool "Support MD5 algorithm in SPL"
> +	depends on SPL
>  	help
>  	  This option enables MD5 support in SPL. MD5 is an algorithm designed
>  	  in 1991 that produces a 16-byte digest (or checksum) from its input
> @@ -642,6 +644,7 @@ config ZSTD
>  
>  config SPL_LZ4
>  	bool "Enable LZ4 decompression support in SPL"
> +	depends on SPL
>  	help
>  	  This enables support for the LZ4 decompression algorithm in SPL. LZ4
>  	  is a lossless data compression algorithm that is focused on
> @@ -650,6 +653,7 @@ config SPL_LZ4
>  
>  config SPL_LZMA
>  	bool "Enable LZMA decompression support for SPL build"
> +	depends on SPL
>  	help
>  	  This enables support for LZMA compression algorithm for SPL boot.
>  
> @@ -661,22 +665,26 @@ config VPL_LZMA
>  
>  config SPL_LZO
>  	bool "Enable LZO decompression support in SPL"
> +	depends on SPL
>  	help
>  	  This enables support for LZO compression algorithm in the SPL.
>  
>  config SPL_GZIP
>  	bool "Enable gzip decompression support for SPL build"
> +	depends on SPL
>  	select SPL_ZLIB
>  	help
>  	  This enables support for the GZIP compression algorithm for SPL boot.
>  
>  config SPL_ZLIB
>  	bool
> +	depends on SPL
>  	help
>  	  This enables compression lib for SPL boot.
>  
>  config SPL_ZSTD
>  	bool "Enable Zstandard decompression support in SPL"
> +	depends on SPL
>  	select XXHASH
>  	help
>  	  This enables Zstandard decompression library in the SPL.

Most of these should all be under one big if SPL ... endif

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] SPL: Do not allow enabling SPL symbols for non-SPL builds
  2022-05-09 20:22 ` Tom Rini
@ 2022-05-10 11:29   ` Pali Rohár
  2022-05-10 12:34     ` Tom Rini
  0 siblings, 1 reply; 6+ messages in thread
From: Pali Rohár @ 2022-05-10 11:29 UTC (permalink / raw)
  To: Tom Rini; +Cc: Simon Glass, Stefan Roese, u-boot

On Monday 09 May 2022 16:22:50 Tom Rini wrote:
> On Mon, May 09, 2022 at 08:53:50PM +0200, Pali Rohár wrote:
> 
> > It does not make sense to enable SPL options when not building SPL binary.
> > 
> > So disallow selecting SPL options for non-SPL builds.
> > 
> > Signed-off-by: Pali Rohár <pali@kernel.org>
> 
> Some of this makes sense, where you add SPL as an explicit dependency.
> But others:
> 
> > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> > index 0afec5155b1b..e4b2b76650fe 100644
> > --- a/arch/arm/Kconfig
> > +++ b/arch/arm/Kconfig
> > @@ -985,7 +985,7 @@ config ARCH_MX6
> >  	imply SYS_THUMB_BUILD
> >  	imply SPL_SEPARATE_BSS
> >  
> > -if ARCH_MX6
> > +if ARCH_MX6 && SPL
> >  config SPL_LDSCRIPT
> >  	default "arch/arm/mach-omap2/u-boot-spl.lds"
> >  endif
> > @@ -2343,7 +2343,11 @@ source "arch/arm/Kconfig.debug"
> >  
> >  endmenu
> >  
> > +if SPL
> > +
> >  config SPL_LDSCRIPT
> >  	default "arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds" if (ARCH_MX23 || ARCH_MX28) && !SPL_FRAMEWORK
> >  	default "arch/arm/cpu/arm1136/u-boot-spl.lds" if CPU_ARM1136
> >  	default "arch/arm/cpu/armv8/u-boot-spl.lds" if ARM64
> > +
> > +endif
> 
> Where it's like this and we're providing default values and the option
> itself is prompt'd elsewhere don't as it's not cluttering the resulting
> .config file.

Apparently it clutters the resulting .config file. Espressobin with
mvebu_espressobin-88f3720_defconfig has CONFIG_SPL_LDSCRIPT in .config
even there is no SPL for Espressobin.

> > diff --git a/lib/Kconfig b/lib/Kconfig
> > index acc0ac081a44..299381ac80d5 100644
> > --- a/lib/Kconfig
> > +++ b/lib/Kconfig
> > @@ -239,6 +239,7 @@ config GENERATE_ACPI_TABLE
> >  
> >  config SPL_TINY_MEMSET
> >  	bool "Use a very small memset() in SPL"
> > +	depends on SPL
> >  	help
> >  	  The faster memset() is the arch-specific one (if available) enabled
> >  	  by CONFIG_USE_ARCH_MEMSET. If that is not enabled, we can still get
> > @@ -556,6 +557,7 @@ config MD5
> >  
> >  config SPL_MD5
> >  	bool "Support MD5 algorithm in SPL"
> > +	depends on SPL
> >  	help
> >  	  This option enables MD5 support in SPL. MD5 is an algorithm designed
> >  	  in 1991 that produces a 16-byte digest (or checksum) from its input
> > @@ -642,6 +644,7 @@ config ZSTD
> >  
> >  config SPL_LZ4
> >  	bool "Enable LZ4 decompression support in SPL"
> > +	depends on SPL
> >  	help
> >  	  This enables support for the LZ4 decompression algorithm in SPL. LZ4
> >  	  is a lossless data compression algorithm that is focused on
> > @@ -650,6 +653,7 @@ config SPL_LZ4
> >  
> >  config SPL_LZMA
> >  	bool "Enable LZMA decompression support for SPL build"
> > +	depends on SPL
> >  	help
> >  	  This enables support for LZMA compression algorithm for SPL boot.
> >  
> > @@ -661,22 +665,26 @@ config VPL_LZMA
> >  
> >  config SPL_LZO
> >  	bool "Enable LZO decompression support in SPL"
> > +	depends on SPL
> >  	help
> >  	  This enables support for LZO compression algorithm in the SPL.
> >  
> >  config SPL_GZIP
> >  	bool "Enable gzip decompression support for SPL build"
> > +	depends on SPL
> >  	select SPL_ZLIB
> >  	help
> >  	  This enables support for the GZIP compression algorithm for SPL boot.
> >  
> >  config SPL_ZLIB
> >  	bool
> > +	depends on SPL
> >  	help
> >  	  This enables compression lib for SPL boot.
> >  
> >  config SPL_ZSTD
> >  	bool "Enable Zstandard decompression support in SPL"
> > +	depends on SPL
> >  	select XXHASH
> >  	help
> >  	  This enables Zstandard decompression library in the SPL.
> 
> Most of these should all be under one big if SPL ... endif
> 
> -- 
> Tom

Ok, I can change it.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] SPL: Do not allow enabling SPL symbols for non-SPL builds
  2022-05-10 11:29   ` Pali Rohár
@ 2022-05-10 12:34     ` Tom Rini
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2022-05-10 12:34 UTC (permalink / raw)
  To: Pali Rohár; +Cc: Simon Glass, Stefan Roese, u-boot

[-- Attachment #1: Type: text/plain, Size: 1810 bytes --]

On Tue, May 10, 2022 at 01:29:30PM +0200, Pali Rohár wrote:
> On Monday 09 May 2022 16:22:50 Tom Rini wrote:
> > On Mon, May 09, 2022 at 08:53:50PM +0200, Pali Rohár wrote:
> > 
> > > It does not make sense to enable SPL options when not building SPL binary.
> > > 
> > > So disallow selecting SPL options for non-SPL builds.
> > > 
> > > Signed-off-by: Pali Rohár <pali@kernel.org>
> > 
> > Some of this makes sense, where you add SPL as an explicit dependency.
> > But others:
> > 
> > > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> > > index 0afec5155b1b..e4b2b76650fe 100644
> > > --- a/arch/arm/Kconfig
> > > +++ b/arch/arm/Kconfig
> > > @@ -985,7 +985,7 @@ config ARCH_MX6
> > >  	imply SYS_THUMB_BUILD
> > >  	imply SPL_SEPARATE_BSS
> > >  
> > > -if ARCH_MX6
> > > +if ARCH_MX6 && SPL
> > >  config SPL_LDSCRIPT
> > >  	default "arch/arm/mach-omap2/u-boot-spl.lds"
> > >  endif
> > > @@ -2343,7 +2343,11 @@ source "arch/arm/Kconfig.debug"
> > >  
> > >  endmenu
> > >  
> > > +if SPL
> > > +
> > >  config SPL_LDSCRIPT
> > >  	default "arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds" if (ARCH_MX23 || ARCH_MX28) && !SPL_FRAMEWORK
> > >  	default "arch/arm/cpu/arm1136/u-boot-spl.lds" if CPU_ARM1136
> > >  	default "arch/arm/cpu/armv8/u-boot-spl.lds" if ARM64
> > > +
> > > +endif
> > 
> > Where it's like this and we're providing default values and the option
> > itself is prompt'd elsewhere don't as it's not cluttering the resulting
> > .config file.
> 
> Apparently it clutters the resulting .config file. Espressobin with
> mvebu_espressobin-88f3720_defconfig has CONFIG_SPL_LDSCRIPT in .config
> even there is no SPL for Espressobin.

Ah, OK, that is odd.  I think we need to move these to where the
question is asked then, instead.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] SPL: Do not allow enabling SPL symbols for non-SPL builds
  2022-05-09 18:53 [PATCH] SPL: Do not allow enabling SPL symbols for non-SPL builds Pali Rohár
  2022-05-09 20:22 ` Tom Rini
@ 2022-05-24  9:11 ` Pali Rohár
  2022-06-08 12:51   ` Tom Rini
  1 sibling, 1 reply; 6+ messages in thread
From: Pali Rohár @ 2022-05-24  9:11 UTC (permalink / raw)
  To: Simon Glass, Stefan Roese, Tom Rini; +Cc: u-boot

It does not make sense to enable SPL options when not building SPL binary.

So disallow selecting SPL options for non-SPL builds.

Signed-off-by: Pali Rohár <pali@kernel.org>

---
Changes in v2:
* Move SPL compression options under one big if SPL ... endif
---
 arch/arm/Kconfig                |  6 +++++-
 arch/arm/cpu/armv8/Kconfig      |  2 ++
 common/Kconfig                  |  5 +++++
 common/spl/Kconfig              |  4 ++--
 drivers/firmware/Kconfig        |  1 +
 drivers/gpio/Kconfig            |  1 +
 drivers/misc/Kconfig            |  1 +
 drivers/mmc/Kconfig             |  5 +++++
 drivers/mtd/spi/Kconfig         |  1 +
 drivers/power/Kconfig           |  1 +
 drivers/power/acpi_pmc/Kconfig  |  1 +
 drivers/power/regulator/Kconfig |  1 +
 fs/cbfs/Kconfig                 |  1 +
 lib/Kconfig                     | 20 +++++++++++++-------
 14 files changed, 40 insertions(+), 10 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 9898c7d68e1b..0492cc53678e 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -991,7 +991,7 @@ config ARCH_MX6
 	imply SYS_THUMB_BUILD
 	imply SPL_SEPARATE_BSS
 
-if ARCH_MX6
+if ARCH_MX6 && SPL
 config SPL_LDSCRIPT
 	default "arch/arm/mach-omap2/u-boot-spl.lds"
 endif
@@ -2349,7 +2349,11 @@ source "arch/arm/Kconfig.debug"
 
 endmenu
 
+if SPL
+
 config SPL_LDSCRIPT
 	default "arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds" if (ARCH_MX23 || ARCH_MX28) && !SPL_FRAMEWORK
 	default "arch/arm/cpu/arm1136/u-boot-spl.lds" if CPU_ARM1136
 	default "arch/arm/cpu/armv8/u-boot-spl.lds" if ARM64
+
+endif
diff --git a/arch/arm/cpu/armv8/Kconfig b/arch/arm/cpu/armv8/Kconfig
index 09f3f50fa22f..0476446bc5ba 100644
--- a/arch/arm/cpu/armv8/Kconfig
+++ b/arch/arm/cpu/armv8/Kconfig
@@ -76,6 +76,7 @@ config ARMV8_SEC_FIRMWARE_SUPPORT
 
 config SPL_ARMV8_SEC_FIRMWARE_SUPPORT
 	bool "Enable ARMv8 secure monitor firmware framework support for SPL"
+	depends on SPL
 	select SPL_FIT
 	select SPL_OF_LIBFDT
 	help
@@ -83,6 +84,7 @@ config SPL_ARMV8_SEC_FIRMWARE_SUPPORT
 
 config SPL_RECOVER_DATA_SECTION
 	bool "save/restore SPL data section"
+	depends on SPL
 	help
 	  Say Y here to save SPL data section for cold boot, and restore
 	  at warm boot in SPL phase.
diff --git a/common/Kconfig b/common/Kconfig
index a96842a5c11d..8e59dcef4b8b 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -81,10 +81,14 @@ config LOGLEVEL
 	    8 - debug content
 	    9 - debug hardware I/O
 
+if SPL
+
 config SPL_LOGLEVEL
 	int
 	default LOGLEVEL
 
+endif
+
 config TPL_LOGLEVEL
 	int
 	default LOGLEVEL
@@ -241,6 +245,7 @@ config SYS_STDIO_DEREGISTER
 
 config SPL_SYS_STDIO_DEREGISTER
 	bool "Allow deregistering stdio devices in SPL"
+	depends on SPL
 	help
 	  Generally there is no need to deregister stdio devices since they
 	  are never deactivated. But if a stdio device is used which can be
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 50ff113cab21..6f40e11c8f3b 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -19,6 +19,8 @@ config SPL
 	help
 	  If you want to build SPL as well as the normal image, say Y.
 
+if SPL
+
 config SPL_FRAMEWORK
 	bool "Support SPL based upon the common SPL framework"
 	depends on SPL
@@ -150,8 +152,6 @@ config HANDOFF
 	  in boot. It is available in gd->handoff. The state state is set up
 	  in SPL (or TPL if that is being used).
 
-if SPL
-
 config SPL_HANDOFF
 	bool "Pass hand-off information from SPL to U-Boot proper"
 	depends on HANDOFF && SPL_BLOBLIST
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index ef958b3a7a4e..55069e395ff2 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -3,6 +3,7 @@ config FIRMWARE
 
 config SPL_FIRMWARE
 	bool "Enable Firmware driver support in SPL"
+	depends on SPL
 	depends on FIRMWARE
 
 config SPL_ARM_PSCI_FW
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 149a62ffe611..3ba97515b718 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -490,6 +490,7 @@ config DM_PCA953X
 
 config SPL_DM_PCA953X
 	bool "PCA95[357]x, PCA9698, TCA64xx, and MAX7310 I/O ports in SPL"
+	depends on SPL
 	depends on DM_GPIO
 	help
 	  Say yes here to provide access to several register-oriented
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 85ae7f62e911..209cd4272ac0 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -504,6 +504,7 @@ config FS_LOADER
 
 config SPL_FS_LOADER
 	bool "Enable loader driver for file system"
+	depends on SPL
 	help
 	  This is file system generic loader which can be used to load
 	  the file image from the storage into target such as memory.
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index f04cc44e1973..a3f0cd00ed74 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -123,6 +123,7 @@ config MMC_IO_VOLTAGE
 
 config SPL_MMC_IO_VOLTAGE
 	bool "Support IO voltage configuration in SPL"
+	depends on SPL
 	help
 	  IO voltage configuration allows selecting the voltage level of the IO
 	  lines (not the level of main supply). This is required for UHS
@@ -153,6 +154,7 @@ config MMC_HS400_ES_SUPPORT
 
 config SPL_MMC_HS400_ES_SUPPORT
 	bool "enable HS400 Enhanced Strobe support in SPL"
+	depends on SPL
 	help
 	  The HS400 Enhanced Strobe mode is support by some eMMC. The bus
 	  frequency is up to 200MHz. This mode does not tune the IO.
@@ -166,6 +168,7 @@ config MMC_HS400_SUPPORT
 
 config SPL_MMC_HS400_SUPPORT
 	bool "enable HS400 support in SPL"
+	depends on SPL
 	select SPL_MMC_HS200_SUPPORT
 	help
 	  The HS400 mode is support by some eMMC. The bus frequency is up to
@@ -179,6 +182,7 @@ config MMC_HS200_SUPPORT
 
 config SPL_MMC_HS200_SUPPORT
 	bool "enable HS200 support in SPL"
+	depends on SPL
 	help
 	  The HS200 mode is support by some eMMC. The bus frequency is up to
 	  200MHz. This mode requires tuning the IO.
@@ -478,6 +482,7 @@ config MMC_SDHCI_ADMA
 
 config SPL_MMC_SDHCI_ADMA
 	bool "Support SDHCI ADMA2 in SPL"
+	depends on SPL
 	depends on MMC_SDHCI
 	select MMC_SDHCI_ADMA_HELPERS
 	help
diff --git a/drivers/mtd/spi/Kconfig b/drivers/mtd/spi/Kconfig
index f350c7e5dc21..eed51bb22b09 100644
--- a/drivers/mtd/spi/Kconfig
+++ b/drivers/mtd/spi/Kconfig
@@ -248,6 +248,7 @@ config SPI_FLASH_MTD
 
 config SPL_SPI_FLASH_MTD
 	bool "SPI flash MTD support for SPL"
+	depends on SPL
 	depends on SPI_FLASH
 	help
           Enable the MTD support for the SPI flash layer in SPL.
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index 2c20dc7c8318..1d184b285875 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -29,6 +29,7 @@ config POWER_LEGACY
 
 config SPL_POWER_LEGACY
 	bool "Legacy power support in SPL"
+	depends on SPL
 	default y if POWER_LEGACY
 	help
 	  Note: This is a legacy option. Use SPL_DM_PMIC instead.
diff --git a/drivers/power/acpi_pmc/Kconfig b/drivers/power/acpi_pmc/Kconfig
index fcd50e36cad4..8b712abc41e9 100644
--- a/drivers/power/acpi_pmc/Kconfig
+++ b/drivers/power/acpi_pmc/Kconfig
@@ -8,6 +8,7 @@ config ACPI_PMC
 
 config SPL_ACPI_PMC
 	bool "Power Manager (x86 PMC) support in SPL"
+	depends on SPL
 	default y if ACPI_PMC
 	help
 	  Enable support for an x86-style power-management controller which
diff --git a/drivers/power/regulator/Kconfig b/drivers/power/regulator/Kconfig
index d6cea8ec6667..6248e68e57c7 100644
--- a/drivers/power/regulator/Kconfig
+++ b/drivers/power/regulator/Kconfig
@@ -163,6 +163,7 @@ config DM_REGULATOR_FIXED
 
 config SPL_DM_REGULATOR_FIXED
 	bool "Enable Driver Model for REGULATOR Fixed value in SPL"
+	depends on SPL_DM_REGULATOR
 	depends on DM_REGULATOR_FIXED
 	select SPL_DM_REGULATOR_COMMON
 	---help---
diff --git a/fs/cbfs/Kconfig b/fs/cbfs/Kconfig
index 03980d830d30..b6639928f4af 100644
--- a/fs/cbfs/Kconfig
+++ b/fs/cbfs/Kconfig
@@ -9,6 +9,7 @@ config FS_CBFS
 
 config SPL_FS_CBFS
 	bool "Enable CBFS (Coreboot Filesystem) in SPL"
+	depends on SPL
 	help
 	  Define this to enable support for reading from a Coreboot
 	  filesystem. This is a ROM-based filesystem used for accessing files
diff --git a/lib/Kconfig b/lib/Kconfig
index acc0ac081a44..38b281162121 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -239,6 +239,7 @@ config GENERATE_ACPI_TABLE
 
 config SPL_TINY_MEMSET
 	bool "Use a very small memset() in SPL"
+	depends on SPL
 	help
 	  The faster memset() is the arch-specific one (if available) enabled
 	  by CONFIG_USE_ARCH_MEMSET. If that is not enabled, we can still get
@@ -556,6 +557,7 @@ config MD5
 
 config SPL_MD5
 	bool "Support MD5 algorithm in SPL"
+	depends on SPL
 	help
 	  This option enables MD5 support in SPL. MD5 is an algorithm designed
 	  in 1991 that produces a 16-byte digest (or checksum) from its input
@@ -640,6 +642,14 @@ config ZSTD
 	help
 	  This enables Zstandard decompression library.
 
+config VPL_LZMA
+	bool "Enable LZMA decompression support for VPL build"
+	default y if LZMA
+	help
+	  This enables support for LZMA compression algorithm for VPL boot.
+
+if SPL
+
 config SPL_LZ4
 	bool "Enable LZ4 decompression support in SPL"
 	help
@@ -653,12 +663,6 @@ config SPL_LZMA
 	help
 	  This enables support for LZMA compression algorithm for SPL boot.
 
-config VPL_LZMA
-	bool "Enable LZMA decompression support for VPL build"
-	default y if LZMA
-	help
-	  This enables support for LZMA compression algorithm for VPL boot.
-
 config SPL_LZO
 	bool "Enable LZO decompression support in SPL"
 	help
@@ -681,6 +685,8 @@ config SPL_ZSTD
 	help
 	  This enables Zstandard decompression library in the SPL.
 
+endif
+
 endmenu
 
 config ERRNO_STR
@@ -749,7 +755,7 @@ config SPL_OF_LIBFDT
 
 config SPL_OF_LIBFDT_ASSUME_MASK
 	hex "Mask of conditions to assume for libfdt"
-	depends on SPL_OF_LIBFDT || FIT
+	depends on SPL_OF_LIBFDT || (SPL && FIT)
 	default 0xff
 	help
 	  Use this to change the assumptions made by libfdt in SPL about the
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] SPL: Do not allow enabling SPL symbols for non-SPL builds
  2022-05-24  9:11 ` [PATCH v2] " Pali Rohár
@ 2022-06-08 12:51   ` Tom Rini
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2022-06-08 12:51 UTC (permalink / raw)
  To: Pali Rohár; +Cc: Simon Glass, Stefan Roese, u-boot

[-- Attachment #1: Type: text/plain, Size: 536 bytes --]

On Tue, May 24, 2022 at 11:11:01AM +0200, Pali Rohár wrote:

> It does not make sense to enable SPL options when not building SPL binary.
> 
> So disallow selecting SPL options for non-SPL builds.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
> Changes in v2:
> * Move SPL compression options under one big if SPL ... endif

This one I'll pick up and v3 myself as there's a few symbols here I did
miss in:
https://patchwork.ozlabs.org/project/uboot/patch/20220608122440.4114272-16-trini@konsulko.com/

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-08 12:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09 18:53 [PATCH] SPL: Do not allow enabling SPL symbols for non-SPL builds Pali Rohár
2022-05-09 20:22 ` Tom Rini
2022-05-10 11:29   ` Pali Rohár
2022-05-10 12:34     ` Tom Rini
2022-05-24  9:11 ` [PATCH v2] " Pali Rohár
2022-06-08 12:51   ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.