All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: add legacy block support for TPL
@ 2026-11-09  8:01 Ferass El Hafidi
  2026-11-09 15:10 ` Tom Rini
  2026-11-09 19:51 ` Massimo Pegorer
  0 siblings, 2 replies; 8+ messages in thread
From: Ferass El Hafidi @ 2026-11-09  8:01 UTC (permalink / raw)
  To: u-boot
  Cc: Tom Rini, Heinrich Schuchardt, Alexey Charkov, Casey Connolly,
	Julien Masson, Carlo Caione, Jörg Sommer, Johan Jonker,
	Denis Mukhin, Ferass El Hafidi

Legacy block support is only selectable for SPL. However it is
useful in TPL too, where the full block driver (with DM and whatnot)
will not fit.
Add a TPL_LEGACY_BLOCK kconfig option to enable legacy block support in
TPL. Note that it is hidden in menuconfig (just like the SPL variant).

Signed-off-by: Ferass El Hafidi <funderscore@postmarketos.org>
---
As I've been working on some TPL support for Amlogic I noticed that I
could not choose the legacy block driver (while I could choose it for SPL).
Given we only have 44K available, DM is a tight fit there so I'd rather not
enable it where possible to save space.

Adding the ability to select the legacy block driver in TPL seemed like
a good option for the same reasons it is already available for SPL
builds. And indeed it works just fine there too.
---
 disk/Makefile          |  4 ++--
 drivers/Makefile       |  7 ++++++-
 drivers/block/Kconfig  | 12 +++++++++++-
 drivers/block/Makefile |  2 +-
 4 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/disk/Makefile b/disk/Makefile
index c16876e2073..18b839f6ecd 100644
--- a/disk/Makefile
+++ b/disk/Makefile
@@ -10,8 +10,8 @@ ifdef CONFIG_$(PHASE_)BLK
 obj-$(CONFIG_$(PHASE_)PARTITIONS)  += disk-uclass.o
 endif
 
-# Must have BLK or SPL_LEGACY_BLOCK to support partitions
-ifneq ($(CONFIG_$(PHASE_)BLK),$(CONFIG_SPL_LEGACY_BLOCK),)
+# Must have BLK or LEGACY_BLOCK to support partitions
+ifneq ($(CONFIG_$(PHASE_)BLK),$(CONFIG_$(PHASE_)LEGACY_BLOCK),)
 obj-$(CONFIG_$(PHASE_)DOS_PARTITION)   += part_dos.o
 obj-$(CONFIG_$(PHASE_)ISO_PARTITION)   += part_iso.o
 obj-$(CONFIG_$(PHASE_)EFI_PARTITION)   += part_efi.o
diff --git a/drivers/Makefile b/drivers/Makefile
index 5403206159c..989be07cd02 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -74,7 +74,6 @@ obj-$(CONFIG_SPL_USB_GADGET) += usb/gadget/udc/
 obj-$(CONFIG_SPL_WATCHDOG) += watchdog/
 obj-$(CONFIG_SPL_USB_HOST) += usb/host/
 obj-$(CONFIG_SPL_SATA) += ata/ scsi/
-obj-$(CONFIG_SPL_LEGACY_BLOCK) += block/
 obj-$(CONFIG_SPL_THERMAL) += thermal/
 obj-$(CONFIG_SPL_UFS_SUPPORT) += scsi/ ufs/
 
@@ -82,6 +81,12 @@ endif
 endif
 endif
 
+ifdef CONFIG_XPL_BUILD
+
+obj-$(CONFIG_$(PHASE_)LEGACY_BLOCK) += block/
+
+endif
+
 ifdef CONFIG_TPL_BUILD
 
 obj-$(CONFIG_TPL_MPC8XXX_INIT_DDR) += ddr/fsl/
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index d44cf4bcb6b..e6f1d82267b 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -15,7 +15,17 @@ config SPL_LEGACY_BLOCK
 	default y if SPL_AHCI_PCI
 	help
 	  Some devices require block support whether or not DM is enabled. This
-	  is only supported in SPL. With this, the blk uclass is not used, but
+	  is only supported in SPL and TPL. With this, the blk uclass is not used, but
+	  instead a legacy implementation of block devices is used, with all
+	  devices consisting of 'struct blk_desc' records.
+
+config TPL_LEGACY_BLOCK
+	bool # "Enable Legacy Block Device in TPL"
+	depends on TPL
+	default y if TPL_MMC || SCSI || NVME || IDE
+	help
+	  Some devices require block support whether or not DM is enabled. This
+	  is only supported in SPL and TPL. With this, the blk uclass is not used, but
 	  instead a legacy implementation of block devices is used, with all
 	  devices consisting of 'struct blk_desc' records.
 
diff --git a/drivers/block/Makefile b/drivers/block/Makefile
index c827fa81a2d..e88914db283 100644
--- a/drivers/block/Makefile
+++ b/drivers/block/Makefile
@@ -6,7 +6,7 @@
 obj-$(CONFIG_$(PHASE_)BLK) += blk-uclass.o
 
 ifndef CONFIG_$(PHASE_)BLK
-obj-$(CONFIG_SPL_LEGACY_BLOCK) += blk_legacy.o
+obj-$(CONFIG_$(PHASE_)LEGACY_BLOCK) += blk_legacy.o
 endif
 
 ifndef CONFIG_XPL_BUILD

---
base-commit: ed869863c7e2aca50d57a05d843830dd843138c4
change-id: 20261109-legacy-block-tpl-c5b09e42bc3f

Best regards,
-- 
Ferass


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

* Re: [PATCH] block: add legacy block support for TPL
  2026-11-09  8:01 [PATCH] block: add legacy block support for TPL Ferass El Hafidi
@ 2026-11-09 15:10 ` Tom Rini
  2026-11-09 19:51 ` Massimo Pegorer
  1 sibling, 0 replies; 8+ messages in thread
From: Tom Rini @ 2026-11-09 15:10 UTC (permalink / raw)
  To: Ferass El Hafidi
  Cc: u-boot, Heinrich Schuchardt, Alexey Charkov, Casey Connolly,
	Julien Masson, Carlo Caione, Jörg Sommer, Johan Jonker,
	Denis Mukhin

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

On Mon, Nov 09, 2026 at 08:01:02AM +0000, Ferass El Hafidi wrote:

> Legacy block support is only selectable for SPL. However it is
> useful in TPL too, where the full block driver (with DM and whatnot)
> will not fit.
> Add a TPL_LEGACY_BLOCK kconfig option to enable legacy block support in
> TPL. Note that it is hidden in menuconfig (just like the SPL variant).
> 
> Signed-off-by: Ferass El Hafidi <funderscore@postmarketos.org>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom

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

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

* Re: [PATCH] block: add legacy block support for TPL
  2026-11-09  8:01 [PATCH] block: add legacy block support for TPL Ferass El Hafidi
  2026-11-09 15:10 ` Tom Rini
@ 2026-11-09 19:51 ` Massimo Pegorer
  2026-11-09 19:56   ` Tom Rini
  2026-11-27 14:51   ` Ferass El Hafidi
  1 sibling, 2 replies; 8+ messages in thread
From: Massimo Pegorer @ 2026-11-09 19:51 UTC (permalink / raw)
  To: Ferass El Hafidi
  Cc: u-boot, Tom Rini, Heinrich Schuchardt, Alexey Charkov,
	Casey Connolly, Julien Masson, Carlo Caione, Jörg Sommer,
	Johan Jonker, Denis Mukhin

Hi,

Il giorno lun 9 nov 2026 alle ore 09:01 Ferass El Hafidi ha scritto:
>
> Legacy block support is only selectable for SPL. However it is
> useful in TPL too, where the full block driver (with DM and whatnot)
> will not fit.
> Add a TPL_LEGACY_BLOCK kconfig option to enable legacy block support in
> TPL. Note that it is hidden in menuconfig (just like the SPL variant).
>
> Signed-off-by: Ferass El Hafidi <funderscore@postmarketos.org>
> ---
> As I've been working on some TPL support for Amlogic I noticed that I
> could not choose the legacy block driver (while I could choose it for SPL).
> Given we only have 44K available, DM is a tight fit there so I'd rather not
> enable it where possible to save space.
>
> Adding the ability to select the legacy block driver in TPL seemed like
> a good option for the same reasons it is already available for SPL
> builds. And indeed it works just fine there too.
> ---
>  disk/Makefile          |  4 ++--
>  drivers/Makefile       |  7 ++++++-
>  drivers/block/Kconfig  | 12 +++++++++++-
>  drivers/block/Makefile |  2 +-
>  4 files changed, 20 insertions(+), 5 deletions(-)
>
> diff --git a/disk/Makefile b/disk/Makefile
> index c16876e2073..18b839f6ecd 100644
> --- a/disk/Makefile
> +++ b/disk/Makefile
> @@ -10,8 +10,8 @@ ifdef CONFIG_$(PHASE_)BLK
>  obj-$(CONFIG_$(PHASE_)PARTITIONS)  += disk-uclass.o
>  endif
>
> -# Must have BLK or SPL_LEGACY_BLOCK to support partitions
> -ifneq ($(CONFIG_$(PHASE_)BLK),$(CONFIG_SPL_LEGACY_BLOCK),)
> +# Must have BLK or LEGACY_BLOCK to support partitions
> +ifneq ($(CONFIG_$(PHASE_)BLK),$(CONFIG_$(PHASE_)LEGACY_BLOCK),)
>  obj-$(CONFIG_$(PHASE_)DOS_PARTITION)   += part_dos.o
>  obj-$(CONFIG_$(PHASE_)ISO_PARTITION)   += part_iso.o
>  obj-$(CONFIG_$(PHASE_)EFI_PARTITION)   += part_efi.o
> diff --git a/drivers/Makefile b/drivers/Makefile
> index 5403206159c..989be07cd02 100644
> --- a/drivers/Makefile
> +++ b/drivers/Makefile
> @@ -74,7 +74,6 @@ obj-$(CONFIG_SPL_USB_GADGET) += usb/gadget/udc/
>  obj-$(CONFIG_SPL_WATCHDOG) += watchdog/
>  obj-$(CONFIG_SPL_USB_HOST) += usb/host/
>  obj-$(CONFIG_SPL_SATA) += ata/ scsi/
> -obj-$(CONFIG_SPL_LEGACY_BLOCK) += block/
>  obj-$(CONFIG_SPL_THERMAL) += thermal/
>  obj-$(CONFIG_SPL_UFS_SUPPORT) += scsi/ ufs/
>
> @@ -82,6 +81,12 @@ endif
>  endif
>  endif
>
> +ifdef CONFIG_XPL_BUILD
> +
> +obj-$(CONFIG_$(PHASE_)LEGACY_BLOCK) += block/
> +
> +endif

What's the purpose of the ifdeffery? I would expect it to work with or without
ifdeffery exactly in the same way. If CONFIG_XPL_BUILD is not defined,
CONFIG_$(PHASE_)LEGACY_BLOCK becomes CONFIG_LEGACY_BLOCK which does not exists.

> +
>  ifdef CONFIG_TPL_BUILD
>
>  obj-$(CONFIG_TPL_MPC8XXX_INIT_DDR) += ddr/fsl/
> diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
> index d44cf4bcb6b..e6f1d82267b 100644
> --- a/drivers/block/Kconfig
> +++ b/drivers/block/Kconfig
> @@ -15,7 +15,17 @@ config SPL_LEGACY_BLOCK
>         default y if SPL_AHCI_PCI
>         help
>           Some devices require block support whether or not DM is enabled. This
> -         is only supported in SPL. With this, the blk uclass is not used, but
> +         is only supported in SPL and TPL. With this, the blk uclass is not used, but
> +         instead a legacy implementation of block devices is used, with all
> +         devices consisting of 'struct blk_desc' records.
> +
> +config TPL_LEGACY_BLOCK
> +       bool # "Enable Legacy Block Device in TPL"
> +       depends on TPL
> +       default y if TPL_MMC || SCSI || NVME || IDE
> +       help
> +         Some devices require block support whether or not DM is enabled. This
> +         is only supported in SPL and TPL. With this, the blk uclass is not used, but
>           instead a legacy implementation of block devices is used, with all
>           devices consisting of 'struct blk_desc' records.
>
> diff --git a/drivers/block/Makefile b/drivers/block/Makefile
> index c827fa81a2d..e88914db283 100644
> --- a/drivers/block/Makefile
> +++ b/drivers/block/Makefile
> @@ -6,7 +6,7 @@
>  obj-$(CONFIG_$(PHASE_)BLK) += blk-uclass.o
>
>  ifndef CONFIG_$(PHASE_)BLK
> -obj-$(CONFIG_SPL_LEGACY_BLOCK) += blk_legacy.o
> +obj-$(CONFIG_$(PHASE_)LEGACY_BLOCK) += blk_legacy.o

Should we have VPL_LEGACY_BLOCK too?
Right now, this breaks sandbox_vpl_defconfig build.

Regards,
Massimo

>  endif
>
>  ifndef CONFIG_XPL_BUILD
>
> ---
> base-commit: ed869863c7e2aca50d57a05d843830dd843138c4
> change-id: 20261109-legacy-block-tpl-c5b09e42bc3f
>
> Best regards,
> --
> Ferass
>

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

* Re: [PATCH] block: add legacy block support for TPL
  2026-11-09 19:51 ` Massimo Pegorer
@ 2026-11-09 19:56   ` Tom Rini
  2026-11-27 14:51   ` Ferass El Hafidi
  1 sibling, 0 replies; 8+ messages in thread
From: Tom Rini @ 2026-11-09 19:56 UTC (permalink / raw)
  To: Massimo Pegorer
  Cc: Ferass El Hafidi, u-boot, Heinrich Schuchardt, Alexey Charkov,
	Casey Connolly, Julien Masson, Carlo Caione, Jörg Sommer,
	Johan Jonker, Denis Mukhin

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

On Mon, Nov 09, 2026 at 08:51:15PM +0100, Massimo Pegorer wrote:
> Hi,
> 
> Il giorno lun 9 nov 2026 alle ore 09:01 Ferass El Hafidi ha scritto:
> >
> > Legacy block support is only selectable for SPL. However it is
> > useful in TPL too, where the full block driver (with DM and whatnot)
> > will not fit.
> > Add a TPL_LEGACY_BLOCK kconfig option to enable legacy block support in
> > TPL. Note that it is hidden in menuconfig (just like the SPL variant).
> >
> > Signed-off-by: Ferass El Hafidi <funderscore@postmarketos.org>
> > ---
> > As I've been working on some TPL support for Amlogic I noticed that I
> > could not choose the legacy block driver (while I could choose it for SPL).
> > Given we only have 44K available, DM is a tight fit there so I'd rather not
> > enable it where possible to save space.
> >
> > Adding the ability to select the legacy block driver in TPL seemed like
> > a good option for the same reasons it is already available for SPL
> > builds. And indeed it works just fine there too.
> > ---
> >  disk/Makefile          |  4 ++--
> >  drivers/Makefile       |  7 ++++++-
> >  drivers/block/Kconfig  | 12 +++++++++++-
> >  drivers/block/Makefile |  2 +-
> >  4 files changed, 20 insertions(+), 5 deletions(-)
> >
> > diff --git a/disk/Makefile b/disk/Makefile
> > index c16876e2073..18b839f6ecd 100644
> > --- a/disk/Makefile
> > +++ b/disk/Makefile
> > @@ -10,8 +10,8 @@ ifdef CONFIG_$(PHASE_)BLK
> >  obj-$(CONFIG_$(PHASE_)PARTITIONS)  += disk-uclass.o
> >  endif
> >
> > -# Must have BLK or SPL_LEGACY_BLOCK to support partitions
> > -ifneq ($(CONFIG_$(PHASE_)BLK),$(CONFIG_SPL_LEGACY_BLOCK),)
> > +# Must have BLK or LEGACY_BLOCK to support partitions
> > +ifneq ($(CONFIG_$(PHASE_)BLK),$(CONFIG_$(PHASE_)LEGACY_BLOCK),)
> >  obj-$(CONFIG_$(PHASE_)DOS_PARTITION)   += part_dos.o
> >  obj-$(CONFIG_$(PHASE_)ISO_PARTITION)   += part_iso.o
> >  obj-$(CONFIG_$(PHASE_)EFI_PARTITION)   += part_efi.o
> > diff --git a/drivers/Makefile b/drivers/Makefile
> > index 5403206159c..989be07cd02 100644
> > --- a/drivers/Makefile
> > +++ b/drivers/Makefile
> > @@ -74,7 +74,6 @@ obj-$(CONFIG_SPL_USB_GADGET) += usb/gadget/udc/
> >  obj-$(CONFIG_SPL_WATCHDOG) += watchdog/
> >  obj-$(CONFIG_SPL_USB_HOST) += usb/host/
> >  obj-$(CONFIG_SPL_SATA) += ata/ scsi/
> > -obj-$(CONFIG_SPL_LEGACY_BLOCK) += block/
> >  obj-$(CONFIG_SPL_THERMAL) += thermal/
> >  obj-$(CONFIG_SPL_UFS_SUPPORT) += scsi/ ufs/
> >
> > @@ -82,6 +81,12 @@ endif
> >  endif
> >  endif
> >
> > +ifdef CONFIG_XPL_BUILD
> > +
> > +obj-$(CONFIG_$(PHASE_)LEGACY_BLOCK) += block/
> > +
> > +endif
> 
> What's the purpose of the ifdeffery? I would expect it to work with or without
> ifdeffery exactly in the same way. If CONFIG_XPL_BUILD is not defined,
> CONFIG_$(PHASE_)LEGACY_BLOCK becomes CONFIG_LEGACY_BLOCK which does not exists.
> 
> > +
> >  ifdef CONFIG_TPL_BUILD
> >
> >  obj-$(CONFIG_TPL_MPC8XXX_INIT_DDR) += ddr/fsl/
> > diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
> > index d44cf4bcb6b..e6f1d82267b 100644
> > --- a/drivers/block/Kconfig
> > +++ b/drivers/block/Kconfig
> > @@ -15,7 +15,17 @@ config SPL_LEGACY_BLOCK
> >         default y if SPL_AHCI_PCI
> >         help
> >           Some devices require block support whether or not DM is enabled. This
> > -         is only supported in SPL. With this, the blk uclass is not used, but
> > +         is only supported in SPL and TPL. With this, the blk uclass is not used, but
> > +         instead a legacy implementation of block devices is used, with all
> > +         devices consisting of 'struct blk_desc' records.
> > +
> > +config TPL_LEGACY_BLOCK
> > +       bool # "Enable Legacy Block Device in TPL"
> > +       depends on TPL
> > +       default y if TPL_MMC || SCSI || NVME || IDE
> > +       help
> > +         Some devices require block support whether or not DM is enabled. This
> > +         is only supported in SPL and TPL. With this, the blk uclass is not used, but
> >           instead a legacy implementation of block devices is used, with all
> >           devices consisting of 'struct blk_desc' records.
> >
> > diff --git a/drivers/block/Makefile b/drivers/block/Makefile
> > index c827fa81a2d..e88914db283 100644
> > --- a/drivers/block/Makefile
> > +++ b/drivers/block/Makefile
> > @@ -6,7 +6,7 @@
> >  obj-$(CONFIG_$(PHASE_)BLK) += blk-uclass.o
> >
> >  ifndef CONFIG_$(PHASE_)BLK
> > -obj-$(CONFIG_SPL_LEGACY_BLOCK) += blk_legacy.o
> > +obj-$(CONFIG_$(PHASE_)LEGACY_BLOCK) += blk_legacy.o
> 
> Should we have VPL_LEGACY_BLOCK too?
> Right now, this breaks sandbox_vpl_defconfig build.

Ugh. We should, yes, add a VPL_LEGACY_BLOCK symbol too, for
bisecability.

-- 
Tom

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

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

* Re: [PATCH] block: add legacy block support for TPL
  2026-11-09 19:51 ` Massimo Pegorer
  2026-11-09 19:56   ` Tom Rini
@ 2026-11-27 14:51   ` Ferass El Hafidi
  2026-11-27 15:34     ` Ferass El Hafidi
  1 sibling, 1 reply; 8+ messages in thread
From: Ferass El Hafidi @ 2026-11-27 14:51 UTC (permalink / raw)
  To: Massimo Pegorer
  Cc: u-boot, Tom Rini, Heinrich Schuchardt, Alexey Charkov,
	Casey Connolly, Julien Masson, Carlo Caione, Jörg Sommer,
	Johan Jonker, Denis Mukhin

Hi Massimo, sorry for the delay ^^

On Mon, 09 Nov 2026 19:51, Massimo Pegorer <massimo.pegorer+oss@gmail.com> wrote:
>Hi,
>
>Il giorno lun 9 nov 2026 alle ore 09:01 Ferass El Hafidi ha scritto:
>>
>> Legacy block support is only selectable for SPL. However it is
>> useful in TPL too, where the full block driver (with DM and whatnot)
>> will not fit.
>> Add a TPL_LEGACY_BLOCK kconfig option to enable legacy block support in
>> TPL. Note that it is hidden in menuconfig (just like the SPL variant).
>>
>> Signed-off-by: Ferass El Hafidi <funderscore@postmarketos.org>
>> ---
>> As I've been working on some TPL support for Amlogic I noticed that I
>> could not choose the legacy block driver (while I could choose it for SPL).
>> Given we only have 44K available, DM is a tight fit there so I'd rather not
>> enable it where possible to save space.
>>
>> Adding the ability to select the legacy block driver in TPL seemed like
>> a good option for the same reasons it is already available for SPL
>> builds. And indeed it works just fine there too.
>> ---
>>  disk/Makefile          |  4 ++--
>>  drivers/Makefile       |  7 ++++++-
>>  drivers/block/Kconfig  | 12 +++++++++++-
>>  drivers/block/Makefile |  2 +-
>>  4 files changed, 20 insertions(+), 5 deletions(-)
>>
>> diff --git a/disk/Makefile b/disk/Makefile
>> index c16876e2073..18b839f6ecd 100644
>> --- a/disk/Makefile
>> +++ b/disk/Makefile
>> @@ -10,8 +10,8 @@ ifdef CONFIG_$(PHASE_)BLK
>>  obj-$(CONFIG_$(PHASE_)PARTITIONS)  += disk-uclass.o
>>  endif
>>
>> -# Must have BLK or SPL_LEGACY_BLOCK to support partitions
>> -ifneq ($(CONFIG_$(PHASE_)BLK),$(CONFIG_SPL_LEGACY_BLOCK),)
>> +# Must have BLK or LEGACY_BLOCK to support partitions
>> +ifneq ($(CONFIG_$(PHASE_)BLK),$(CONFIG_$(PHASE_)LEGACY_BLOCK),)
>>  obj-$(CONFIG_$(PHASE_)DOS_PARTITION)   += part_dos.o
>>  obj-$(CONFIG_$(PHASE_)ISO_PARTITION)   += part_iso.o
>>  obj-$(CONFIG_$(PHASE_)EFI_PARTITION)   += part_efi.o
>> diff --git a/drivers/Makefile b/drivers/Makefile
>> index 5403206159c..989be07cd02 100644
>> --- a/drivers/Makefile
>> +++ b/drivers/Makefile
>> @@ -74,7 +74,6 @@ obj-$(CONFIG_SPL_USB_GADGET) += usb/gadget/udc/
>>  obj-$(CONFIG_SPL_WATCHDOG) += watchdog/
>>  obj-$(CONFIG_SPL_USB_HOST) += usb/host/
>>  obj-$(CONFIG_SPL_SATA) += ata/ scsi/
>> -obj-$(CONFIG_SPL_LEGACY_BLOCK) += block/
>>  obj-$(CONFIG_SPL_THERMAL) += thermal/
>>  obj-$(CONFIG_SPL_UFS_SUPPORT) += scsi/ ufs/
>>
>> @@ -82,6 +81,12 @@ endif
>>  endif
>>  endif
>>
>> +ifdef CONFIG_XPL_BUILD
>> +
>> +obj-$(CONFIG_$(PHASE_)LEGACY_BLOCK) += block/
>> +
>> +endif
>
>What's the purpose of the ifdeffery? I would expect it to work with or without
>ifdeffery exactly in the same way. If CONFIG_XPL_BUILD is not defined,
>CONFIG_$(PHASE_)LEGACY_BLOCK becomes CONFIG_LEGACY_BLOCK which does not exists.
>

Yes, CONFIG_LEGACY_BLOCK does not exist. I believe there was a reason as
to why the legacy block driver could not be chosen for U-Boot proper so
I didn't question it. That's why there's this `ifdef`.

Is it something you'd like me to change in the next revision?

>> +
>>  ifdef CONFIG_TPL_BUILD
>>
>>  obj-$(CONFIG_TPL_MPC8XXX_INIT_DDR) += ddr/fsl/
>> diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
>> index d44cf4bcb6b..e6f1d82267b 100644
>> --- a/drivers/block/Kconfig
>> +++ b/drivers/block/Kconfig
>> @@ -15,7 +15,17 @@ config SPL_LEGACY_BLOCK
>>         default y if SPL_AHCI_PCI
>>         help
>>           Some devices require block support whether or not DM is enabled. This
>> -         is only supported in SPL. With this, the blk uclass is not used, but
>> +         is only supported in SPL and TPL. With this, the blk uclass is not used, but
>> +         instead a legacy implementation of block devices is used, with all
>> +         devices consisting of 'struct blk_desc' records.
>> +
>> +config TPL_LEGACY_BLOCK
>> +       bool # "Enable Legacy Block Device in TPL"
>> +       depends on TPL
>> +       default y if TPL_MMC || SCSI || NVME || IDE
>> +       help
>> +         Some devices require block support whether or not DM is enabled. This
>> +         is only supported in SPL and TPL. With this, the blk uclass is not used, but
>>           instead a legacy implementation of block devices is used, with all
>>           devices consisting of 'struct blk_desc' records.
>>
>> diff --git a/drivers/block/Makefile b/drivers/block/Makefile
>> index c827fa81a2d..e88914db283 100644
>> --- a/drivers/block/Makefile
>> +++ b/drivers/block/Makefile
>> @@ -6,7 +6,7 @@
>>  obj-$(CONFIG_$(PHASE_)BLK) += blk-uclass.o
>>
>>  ifndef CONFIG_$(PHASE_)BLK
>> -obj-$(CONFIG_SPL_LEGACY_BLOCK) += blk_legacy.o
>> +obj-$(CONFIG_$(PHASE_)LEGACY_BLOCK) += blk_legacy.o
>
>Should we have VPL_LEGACY_BLOCK too?
>Right now, this breaks sandbox_vpl_defconfig build.

Yes, I overlooked it but yes we definitely should. I'll add it to the
next revision. Thanks for pointing it out!

Best regards,
Ferass

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

* Re: [PATCH] block: add legacy block support for TPL
  2026-11-27 14:51   ` Ferass El Hafidi
@ 2026-11-27 15:34     ` Ferass El Hafidi
  2026-11-28  9:54       ` Massimo Pegorer
  0 siblings, 1 reply; 8+ messages in thread
From: Ferass El Hafidi @ 2026-11-27 15:34 UTC (permalink / raw)
  To: Massimo Pegorer
  Cc: u-boot, Tom Rini, Heinrich Schuchardt, Alexey Charkov,
	Casey Connolly, Julien Masson, Carlo Caione, Jörg Sommer,
	Johan Jonker, Denis Mukhin

On Fri, 27 Nov 2026 14:51, Ferass El Hafidi <funderscore@postmarketos.org> wrote:
>Hi Massimo, sorry for the delay ^^
>
>On Mon, 09 Nov 2026 19:51, Massimo Pegorer <massimo.pegorer+oss@gmail.com> wrote:
>>Hi,
>>
>>Il giorno lun 9 nov 2026 alle ore 09:01 Ferass El Hafidi ha scritto:
>>>
>>> Legacy block support is only selectable for SPL. However it is
>>> useful in TPL too, where the full block driver (with DM and whatnot)
>>> will not fit.
>>> Add a TPL_LEGACY_BLOCK kconfig option to enable legacy block support in
>>> TPL. Note that it is hidden in menuconfig (just like the SPL variant).
>>>
>>> Signed-off-by: Ferass El Hafidi <funderscore@postmarketos.org>
>>> ---
>>> As I've been working on some TPL support for Amlogic I noticed that I
>>> could not choose the legacy block driver (while I could choose it for SPL).
>>> Given we only have 44K available, DM is a tight fit there so I'd rather not
>>> enable it where possible to save space.
>>>
>>> Adding the ability to select the legacy block driver in TPL seemed like
>>> a good option for the same reasons it is already available for SPL
>>> builds. And indeed it works just fine there too.
>>> ---
>>>  disk/Makefile          |  4 ++--
>>>  drivers/Makefile       |  7 ++++++-
>>>  drivers/block/Kconfig  | 12 +++++++++++-
>>>  drivers/block/Makefile |  2 +-
>>>  4 files changed, 20 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/disk/Makefile b/disk/Makefile
>>> index c16876e2073..18b839f6ecd 100644
>>> --- a/disk/Makefile
>>> +++ b/disk/Makefile
>>> @@ -10,8 +10,8 @@ ifdef CONFIG_$(PHASE_)BLK
>>>  obj-$(CONFIG_$(PHASE_)PARTITIONS)  += disk-uclass.o
>>>  endif
>>>
>>> -# Must have BLK or SPL_LEGACY_BLOCK to support partitions
>>> -ifneq ($(CONFIG_$(PHASE_)BLK),$(CONFIG_SPL_LEGACY_BLOCK),)
>>> +# Must have BLK or LEGACY_BLOCK to support partitions
>>> +ifneq ($(CONFIG_$(PHASE_)BLK),$(CONFIG_$(PHASE_)LEGACY_BLOCK),)
>>>  obj-$(CONFIG_$(PHASE_)DOS_PARTITION)   += part_dos.o
>>>  obj-$(CONFIG_$(PHASE_)ISO_PARTITION)   += part_iso.o
>>>  obj-$(CONFIG_$(PHASE_)EFI_PARTITION)   += part_efi.o
>>> diff --git a/drivers/Makefile b/drivers/Makefile
>>> index 5403206159c..989be07cd02 100644
>>> --- a/drivers/Makefile
>>> +++ b/drivers/Makefile
>>> @@ -74,7 +74,6 @@ obj-$(CONFIG_SPL_USB_GADGET) += usb/gadget/udc/
>>>  obj-$(CONFIG_SPL_WATCHDOG) += watchdog/
>>>  obj-$(CONFIG_SPL_USB_HOST) += usb/host/
>>>  obj-$(CONFIG_SPL_SATA) += ata/ scsi/
>>> -obj-$(CONFIG_SPL_LEGACY_BLOCK) += block/
>>>  obj-$(CONFIG_SPL_THERMAL) += thermal/
>>>  obj-$(CONFIG_SPL_UFS_SUPPORT) += scsi/ ufs/
>>>
>>> @@ -82,6 +81,12 @@ endif
>>>  endif
>>>  endif
>>>
>>> +ifdef CONFIG_XPL_BUILD
>>> +
>>> +obj-$(CONFIG_$(PHASE_)LEGACY_BLOCK) += block/
>>> +
>>> +endif
>>
>>What's the purpose of the ifdeffery? I would expect it to work with or without
>>ifdeffery exactly in the same way. If CONFIG_XPL_BUILD is not defined,
>>CONFIG_$(PHASE_)LEGACY_BLOCK becomes CONFIG_LEGACY_BLOCK which does not exists.
>>
>
>Yes, CONFIG_LEGACY_BLOCK does not exist. I believe there was a reason as
>to why the legacy block driver could not be chosen for U-Boot proper so
>I didn't question it. That's why there's this `ifdef`.
>
>Is it something you'd like me to change in the next revision?
>

I got pointed out offlist (on IRC, thanks!) that your point might've
been that the ifdef is unnecessary and can be removed for the same effect. And
indeed your feedback makes a lot more sense that way. Sorry for the
misunderstanding, I'll fix that in v2.

Thanks a lot!

Best regards,
Ferass

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

* Re: [PATCH] block: add legacy block support for TPL
  2026-11-27 15:34     ` Ferass El Hafidi
@ 2026-11-28  9:54       ` Massimo Pegorer
  2026-11-28 20:55         ` Ferass El Hafidi
  0 siblings, 1 reply; 8+ messages in thread
From: Massimo Pegorer @ 2026-11-28  9:54 UTC (permalink / raw)
  To: Ferass El Hafidi
  Cc: u-boot, Tom Rini, Heinrich Schuchardt, Alexey Charkov,
	Casey Connolly, Julien Masson, Carlo Caione, Jörg Sommer,
	Johan Jonker, Denis Mukhin

Hi Ferass,

Il giorno ven 27 nov 2026 alle ore 16:37 Ferass El Hafidi
<funderscore@postmarketos.org> ha scritto:
> On Fri, 27 Nov 2026 14:51, Ferass El Hafidi <funderscore@postmarketos.org> wrote:
> >Hi Massimo, sorry for the delay ^^
> >
> >On Mon, 09 Nov 2026 19:51, Massimo Pegorer <massimo.pegorer+oss@gmail.com> wrote:
> >>Hi,
> >>
> >>Il giorno lun 9 nov 2026 alle ore 09:01 Ferass El Hafidi ha scritto:
> >>>
> >>> Legacy block support is only selectable for SPL. However it is
> >>> useful in TPL too, where the full block driver (with DM and whatnot)
> >>> will not fit.
> >>> Add a TPL_LEGACY_BLOCK kconfig option to enable legacy block support in
> >>> TPL. Note that it is hidden in menuconfig (just like the SPL variant).
> >>>
> >>> Signed-off-by: Ferass El Hafidi <funderscore@postmarketos.org>
> >>> ---
> >>> As I've been working on some TPL support for Amlogic I noticed that I
> >>> could not choose the legacy block driver (while I could choose it for SPL).
> >>> Given we only have 44K available, DM is a tight fit there so I'd rather not
> >>> enable it where possible to save space.
> >>>
> >>> Adding the ability to select the legacy block driver in TPL seemed like
> >>> a good option for the same reasons it is already available for SPL
> >>> builds. And indeed it works just fine there too.
> >>> ---
> >>>  disk/Makefile          |  4 ++--
> >>>  drivers/Makefile       |  7 ++++++-
> >>>  drivers/block/Kconfig  | 12 +++++++++++-
> >>>  drivers/block/Makefile |  2 +-
> >>>  4 files changed, 20 insertions(+), 5 deletions(-)
> >>>
> >>> diff --git a/disk/Makefile b/disk/Makefile
> >>> index c16876e2073..18b839f6ecd 100644
> >>> --- a/disk/Makefile
> >>> +++ b/disk/Makefile
> >>> @@ -10,8 +10,8 @@ ifdef CONFIG_$(PHASE_)BLK
> >>>  obj-$(CONFIG_$(PHASE_)PARTITIONS)  += disk-uclass.o
> >>>  endif
> >>>
> >>> -# Must have BLK or SPL_LEGACY_BLOCK to support partitions
> >>> -ifneq ($(CONFIG_$(PHASE_)BLK),$(CONFIG_SPL_LEGACY_BLOCK),)
> >>> +# Must have BLK or LEGACY_BLOCK to support partitions
> >>> +ifneq ($(CONFIG_$(PHASE_)BLK),$(CONFIG_$(PHASE_)LEGACY_BLOCK),)
> >>>  obj-$(CONFIG_$(PHASE_)DOS_PARTITION)   += part_dos.o
> >>>  obj-$(CONFIG_$(PHASE_)ISO_PARTITION)   += part_iso.o
> >>>  obj-$(CONFIG_$(PHASE_)EFI_PARTITION)   += part_efi.o
> >>> diff --git a/drivers/Makefile b/drivers/Makefile
> >>> index 5403206159c..989be07cd02 100644
> >>> --- a/drivers/Makefile
> >>> +++ b/drivers/Makefile
> >>> @@ -74,7 +74,6 @@ obj-$(CONFIG_SPL_USB_GADGET) += usb/gadget/udc/
> >>>  obj-$(CONFIG_SPL_WATCHDOG) += watchdog/
> >>>  obj-$(CONFIG_SPL_USB_HOST) += usb/host/
> >>>  obj-$(CONFIG_SPL_SATA) += ata/ scsi/
> >>> -obj-$(CONFIG_SPL_LEGACY_BLOCK) += block/
> >>>  obj-$(CONFIG_SPL_THERMAL) += thermal/
> >>>  obj-$(CONFIG_SPL_UFS_SUPPORT) += scsi/ ufs/
> >>>
> >>> @@ -82,6 +81,12 @@ endif
> >>>  endif
> >>>  endif
> >>>
> >>> +ifdef CONFIG_XPL_BUILD
> >>> +
> >>> +obj-$(CONFIG_$(PHASE_)LEGACY_BLOCK) += block/
> >>> +
> >>> +endif
> >>
> >>What's the purpose of the ifdeffery? I would expect it to work with or without
> >>ifdeffery exactly in the same way. If CONFIG_XPL_BUILD is not defined,
> >>CONFIG_$(PHASE_)LEGACY_BLOCK becomes CONFIG_LEGACY_BLOCK which does not exists.
> >>
> >
> >Yes, CONFIG_LEGACY_BLOCK does not exist. I believe there was a reason as
> >to why the legacy block driver could not be chosen for U-Boot proper so
> >I didn't question it. That's why there's this `ifdef`.
> >
> >Is it something you'd like me to change in the next revision?
> >
>
> I got pointed out offlist (on IRC, thanks!) that your point might've
> been that the ifdef is unnecessary and can be removed for the same effect. And
> indeed your feedback makes a lot more sense that way. Sorry for the
> misunderstanding, I'll fix that in v2.

I should have been more straightforward and thus clear.
But I had doubts that I was missing something.

Regards,
Massimo

>
> Thanks a lot!
>
> Best regards,
> Ferass

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

* Re: [PATCH] block: add legacy block support for TPL
  2026-11-28  9:54       ` Massimo Pegorer
@ 2026-11-28 20:55         ` Ferass El Hafidi
  0 siblings, 0 replies; 8+ messages in thread
From: Ferass El Hafidi @ 2026-11-28 20:55 UTC (permalink / raw)
  To: Massimo Pegorer
  Cc: u-boot, Tom Rini, Heinrich Schuchardt, Alexey Charkov,
	Casey Connolly, Julien Masson, Carlo Caione, Jörg Sommer,
	Johan Jonker, Denis Mukhin

Hi Massimo,

On Sat, 28 Nov 2026 09:54, Massimo Pegorer <massimo.pegorer+oss@gmail.com> wrote:
>Hi Ferass,
>
>Il giorno ven 27 nov 2026 alle ore 16:37 Ferass El Hafidi
><funderscore@postmarketos.org> ha scritto:
>> On Fri, 27 Nov 2026 14:51, Ferass El Hafidi <funderscore@postmarketos.org> wrote:
>> >Hi Massimo, sorry for the delay ^^
>> >
>> >On Mon, 09 Nov 2026 19:51, Massimo Pegorer <massimo.pegorer+oss@gmail.com> wrote:
>> >>Hi,
>> >>
>> >>Il giorno lun 9 nov 2026 alle ore 09:01 Ferass El Hafidi ha scritto:
>> >>>
>> >>> Legacy block support is only selectable for SPL. However it is
>> >>> useful in TPL too, where the full block driver (with DM and whatnot)
>> >>> will not fit.
>> >>> Add a TPL_LEGACY_BLOCK kconfig option to enable legacy block support in
>> >>> TPL. Note that it is hidden in menuconfig (just like the SPL variant).
>> >>>
>> >>> Signed-off-by: Ferass El Hafidi <funderscore@postmarketos.org>
>> >>> ---
>> >>> As I've been working on some TPL support for Amlogic I noticed that I
>> >>> could not choose the legacy block driver (while I could choose it for SPL).
>> >>> Given we only have 44K available, DM is a tight fit there so I'd rather not
>> >>> enable it where possible to save space.
>> >>>
>> >>> Adding the ability to select the legacy block driver in TPL seemed like
>> >>> a good option for the same reasons it is already available for SPL
>> >>> builds. And indeed it works just fine there too.
>> >>> ---
>> >>>  disk/Makefile          |  4 ++--
>> >>>  drivers/Makefile       |  7 ++++++-
>> >>>  drivers/block/Kconfig  | 12 +++++++++++-
>> >>>  drivers/block/Makefile |  2 +-
>> >>>  4 files changed, 20 insertions(+), 5 deletions(-)
>> >>>
>> >>> diff --git a/disk/Makefile b/disk/Makefile
>> >>> index c16876e2073..18b839f6ecd 100644
>> >>> --- a/disk/Makefile
>> >>> +++ b/disk/Makefile
>> >>> @@ -10,8 +10,8 @@ ifdef CONFIG_$(PHASE_)BLK
>> >>>  obj-$(CONFIG_$(PHASE_)PARTITIONS)  += disk-uclass.o
>> >>>  endif
>> >>>
>> >>> -# Must have BLK or SPL_LEGACY_BLOCK to support partitions
>> >>> -ifneq ($(CONFIG_$(PHASE_)BLK),$(CONFIG_SPL_LEGACY_BLOCK),)
>> >>> +# Must have BLK or LEGACY_BLOCK to support partitions
>> >>> +ifneq ($(CONFIG_$(PHASE_)BLK),$(CONFIG_$(PHASE_)LEGACY_BLOCK),)
>> >>>  obj-$(CONFIG_$(PHASE_)DOS_PARTITION)   += part_dos.o
>> >>>  obj-$(CONFIG_$(PHASE_)ISO_PARTITION)   += part_iso.o
>> >>>  obj-$(CONFIG_$(PHASE_)EFI_PARTITION)   += part_efi.o
>> >>> diff --git a/drivers/Makefile b/drivers/Makefile
>> >>> index 5403206159c..989be07cd02 100644
>> >>> --- a/drivers/Makefile
>> >>> +++ b/drivers/Makefile
>> >>> @@ -74,7 +74,6 @@ obj-$(CONFIG_SPL_USB_GADGET) += usb/gadget/udc/
>> >>>  obj-$(CONFIG_SPL_WATCHDOG) += watchdog/
>> >>>  obj-$(CONFIG_SPL_USB_HOST) += usb/host/
>> >>>  obj-$(CONFIG_SPL_SATA) += ata/ scsi/
>> >>> -obj-$(CONFIG_SPL_LEGACY_BLOCK) += block/
>> >>>  obj-$(CONFIG_SPL_THERMAL) += thermal/
>> >>>  obj-$(CONFIG_SPL_UFS_SUPPORT) += scsi/ ufs/
>> >>>
>> >>> @@ -82,6 +81,12 @@ endif
>> >>>  endif
>> >>>  endif
>> >>>
>> >>> +ifdef CONFIG_XPL_BUILD
>> >>> +
>> >>> +obj-$(CONFIG_$(PHASE_)LEGACY_BLOCK) += block/
>> >>> +
>> >>> +endif
>> >>
>> >>What's the purpose of the ifdeffery? I would expect it to work with or without
>> >>ifdeffery exactly in the same way. If CONFIG_XPL_BUILD is not defined,
>> >>CONFIG_$(PHASE_)LEGACY_BLOCK becomes CONFIG_LEGACY_BLOCK which does not exists.
>> >>
>> >
>> >Yes, CONFIG_LEGACY_BLOCK does not exist. I believe there was a reason as
>> >to why the legacy block driver could not be chosen for U-Boot proper so
>> >I didn't question it. That's why there's this `ifdef`.
>> >
>> >Is it something you'd like me to change in the next revision?
>> >
>>
>> I got pointed out offlist (on IRC, thanks!) that your point might've
>> been that the ifdef is unnecessary and can be removed for the same effect. And
>> indeed your feedback makes a lot more sense that way. Sorry for the
>> misunderstanding, I'll fix that in v2.
>
>I should have been more straightforward and thus clear.
>But I had doubts that I was missing something.

No worries, I appreciate your feedback. I sent a v2 just now, let me
know of anything else.

Thanks!

Best regards,
Ferass

>
>Regards,
>Massimo
>
>>
>> Thanks a lot!
>>
>> Best regards,
>> Ferass

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

end of thread, other threads:[~2026-11-30  7:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-09  8:01 [PATCH] block: add legacy block support for TPL Ferass El Hafidi
2026-11-09 15:10 ` Tom Rini
2026-11-09 19:51 ` Massimo Pegorer
2026-11-09 19:56   ` Tom Rini
2026-11-27 14:51   ` Ferass El Hafidi
2026-11-27 15:34     ` Ferass El Hafidi
2026-11-28  9:54       ` Massimo Pegorer
2026-11-28 20:55         ` Ferass El Hafidi

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.