Skip to contentSkip to conversation

blk: Rework guard around part_init call

PATCH In review Tom Rini 2 participants 3 messages Dec 5, 2018 – Dec 13, 2018

Subsystems (2)
lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 blk: Rework guard around part_init call

The function part_init() will only be built when we have both CONFIG_PARTITIONS and CONFIG_HAVE_BLOCK_DEVICE set. Protect the call to this function with both of these tests now.

Cc Simon Glass <[email protected]>
Cc Philipp Tomsich <[email protected]>
Cc Michal Simek <[email protected]>
Cc York Sun <[email protected]>
Cc Prabhakar Kushwaha <[email protected]>
Cc Mingkai Hu <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Marek Behún <[email protected]>
Cc Vanessa Maegima <[email protected]>
Cc Eugen Hristev <[email protected]>
Cc Adam Ford <[email protected]>
Cc Jagan Teki <[email protected]>
Cc Tom Warren <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Vitaly Andrianov <[email protected]>

---
Changes in v2:
- rockchip: evb-rk3036 and kylin-rk3036 are both targets that do not use CONFIG_SPL_FRAMEWORK but also do not fall into the legacy PowerPC SPL case. In order to avoid fail to builds on these platforms they must now turn off CONFIG_SPL_BLK, which they weren't using before, it was being discarded at link time.
- Re-work common/spl/Kconfig and then various Makefiles to slightly clear up the logic of when we do and don't need both disk/part.o and drivers/block/blk-uclass.o. This is in fact not the greatest but it's all I could come up with to cover all the cases we have today.
- Because of the above, add a note to the CONFIG_BLK migration to note that once we are complete there we need to revisit the symbols I used above as once that migration is done we should be able to rely on just BLK and maybe PARTITIONS.
- Actually build-test the world and confirm the overall results are fairly sane. This results in pushing a few platforms that are using SPL and DM into using SPL_BLK now.
- This also results in a number of 64bit rockchip, nxp and zynqmp platforms that have been enabling CONFIG_SPL_DOS_PARTITION / CONFIG_SPL_ISO_PARTITION now linking it.
- On the 32bit ARM side, some Marvell, i.MX, ateml, TI, Tegra, zynq and rockchip platforms do the same.

The full build log can be seen at:
https://gist.github.com/trini/e3e73afec629bbda2625102120c2a9db

---
 common/spl/Kconfig             | 3 +++
 configs/evb-rk3036_defconfig   | 1 +
 configs/kylin-rk3036_defconfig | 1 +
 doc/driver-model/MIGRATION.txt | 4 +++-
 drivers/Makefile               | 3 +--
 drivers/block/Makefile         | 2 ++
 drivers/block/blk-uclass.c     | 2 +-
 scripts/Makefile.spl           | 4 +++-
 8 files changed, 15 insertions(+), 5 deletions(-)
common/spl/Kconfig +3 -0
index 0ddbffc7d1c6..cab7220c9ace 100644
@@ -449,6 +449,7 @@ config SPL_LIBCOMMON_SUPPORT
 
 config SPL_LIBDISK_SUPPORT
 	bool "Support disk partitions"
+	select PARTITIONS
 	help
 	  Enable support for disk partitions within SPL. 'Disk' is something
 	  of a misnomer as it includes non-spinning media such as flash (as
@@ -480,6 +481,7 @@ config SPL_DM_MAILBOX
 config SPL_MMC_SUPPORT
 	bool "Support MMC"
 	depends on MMC
+	select HAVE_BLOCK_DEVICE
 	help
 	  Enable support for MMC (Multimedia Card) within SPL. This enables
 	  the MMC protocol implementation and allows any enabled drivers to
@@ -754,6 +756,7 @@ config SPL_THERMAL
 
 config SPL_USB_HOST_SUPPORT
 	bool "Support USB host drivers"
+	select HAVE_BLOCK_DEVICE
 	help
 	  Enable access to USB (Universal Serial Bus) host devices so that
 	  SPL can load U-Boot from a connected USB peripheral, such as a USB
configs/evb-rk3036_defconfig +1 -0
index 787d6f95c1bb..439e69138636 100644
@@ -32,6 +32,7 @@ CONFIG_SPL_PARTITION_UUIDS=y
 CONFIG_DEFAULT_DEVICE_TREE="rk3036-sdk"
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
+# CONFIG_SPL_BLK is not set
 CONFIG_CLK=y
 CONFIG_FASTBOOT_FLASH=y
 CONFIG_FASTBOOT_FLASH_MMC_DEV=0
configs/kylin-rk3036_defconfig +1 -0
index eb305e02aaa5..765003095ca1 100644
@@ -30,6 +30,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3036-sdk"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
+# CONFIG_SPL_BLK is not set
 CONFIG_CLK=y
 CONFIG_FASTBOOT_FLASH=y
 CONFIG_FASTBOOT_FLASH_MMC_DEV=0
doc/driver-model/MIGRATION.txt +3 -1
index 6b691338b4e7..dce4aa3e1dc9 100644
@@ -44,7 +44,9 @@ Deadline: 2019.07
 In concert with maintainers migrating their block device usage to the
 appropriate DM driver, CONFIG_BLK needs to be set as well.  The final deadline
 here coincides with the final deadline for migration of the various block
-subsystems.
+subsystems.  At this point we will be able to audit and correct the logic in
+Kconfig around using CONFIG_PARTITIONS and CONFIG_HAVE_BLOCK_DEVICE and make
+use of CONFIG_BLK / CONFIG_SPL_BLK as needed.
 
 CONFIG_DM_SPI
 CONFIG_DM_SPI_FLASH
drivers/Makefile +1 -2
index 55de10926ef4..388d93a069e4 100644
@@ -53,8 +53,7 @@ obj-$(CONFIG_SPL_WATCHDOG_SUPPORT) += watchdog/
 obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += usb/host/
 obj-$(CONFIG_OMAP_USB_PHY) += usb/phy/
 obj-$(CONFIG_SPL_SATA_SUPPORT) += ata/ scsi/
-obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += block/
-obj-$(CONFIG_SPL_MMC_SUPPORT) += block/
+obj-$(CONFIG_HAVE_BLOCK_DEVICE) += block/
 obj-$(CONFIG_SPL_FPGA_SUPPORT) += fpga/
 obj-$(CONFIG_SPL_THERMAL) += thermal/
 
drivers/block/Makefile +2 -0
index 055d42f7d4af..3feb0aa997df 100644
@@ -9,6 +9,8 @@ ifndef CONFIG_$(SPL_)BLK
 obj-y += blk_legacy.o
 endif
 
+ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_IDE) += ide.o
+endif
 obj-$(CONFIG_SANDBOX) += sandbox.o
 obj-$(CONFIG_$(SPL_TPL_)BLOCK_CACHE) += blkcache.o
drivers/block/blk-uclass.c +1 -1
index 65a766e586d6..baaf431e5e0c 100644
@@ -639,7 +639,7 @@ int blk_unbind_all(int if_type)
 
 static int blk_post_probe(struct udevice *dev)
 {
-#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBDISK_SUPPORT)
+#if defined(CONFIG_PARTITIONS) && defined(CONFIG_HAVE_BLOCK_DEVICE)
 	struct blk_desc *desc = dev_get_uclass_platdata(dev);
 
 	part_init(desc);
scripts/Makefile.spl +3 -1
index 22bd8f7c279e..2ef19bf005c9 100644
@@ -81,9 +81,11 @@ libs-$(CONFIG_TPL_LIBGENERIC_SUPPORT) += lib/
 else
 libs-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/ cmd/ env/
 libs-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/
+ifdef CONFIG_SPL_FRAMEWORK
+libs-$(CONFIG_PARTITIONS) += disk/
+endif
 endif
 
-libs-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/
 libs-y += drivers/
 libs-$(CONFIG_SPL_USB_GADGET_SUPPORT) += drivers/usb/dwc3/
 libs-y += dts/
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 blk: Rework guard around part_init call

Quoted 21 lines · Tom Rini

The function part_init() will only be built when we have both CONFIG_PARTITIONS and CONFIG_HAVE_BLOCK_DEVICE set. Protect the call to this function with both of these tests now.

Cc Simon Glass <[email protected]>
Cc Philipp Tomsich <[email protected]>
Cc Michal Simek <[email protected]>
Cc York Sun <[email protected]>
Cc Prabhakar Kushwaha <[email protected]>
Cc Mingkai Hu <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Marek Behún <[email protected]>
Cc Vanessa Maegima <[email protected]>
Cc Eugen Hristev <[email protected]>
Cc Adam Ford <[email protected]>
Cc Jagan Teki <[email protected]>
Cc Tom Warren <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Vitaly Andrianov <[email protected]>
Quoted 15 lines

---
Changes in v2:
- rockchip: evb-rk3036 and kylin-rk3036 are both targets that do not use CONFIG_SPL_FRAMEWORK but also do not fall into the legacy PowerPC SPL case. In order to avoid fail to builds on these platforms they must now turn off CONFIG_SPL_BLK, which they weren't using before, it was being discarded at link time.
- Re-work common/spl/Kconfig and then various Makefiles to slightly clear up the logic of when we do and don't need both disk/part.o and drivers/block/blk-uclass.o. This is in fact not the greatest but it's all I could come up with to cover all the cases we have today.
- Because of the above, add a note to the CONFIG_BLK migration to note that once we are complete there we need to revisit the symbols I used above as once that migration is done we should be able to rely on just BLK and maybe PARTITIONS.

Indeed.

Quoted 11 lines

- Actually build-test the world and confirm the overall results are fairly sane. This results in pushing a few platforms that are using SPL and DM into using SPL_BLK now.
- This also results in a number of 64bit rockchip, nxp and zynqmp platforms that have been enabling CONFIG_SPL_DOS_PARTITION / CONFIG_SPL_ISO_PARTITION now linking it.
- On the 32bit ARM side, some Marvell, i.MX, ateml, TI, Tegra, zynq and rockchip platforms do the same.

The full build log can be seen at:
https://gist.github.com/trini/e3e73afec629bbda2625102120c2a9db

Quoted 10 lines
---
 common/spl/Kconfig             | 3 +++
 configs/evb-rk3036_defconfig   | 1 +
 configs/kylin-rk3036_defconfig | 1 +
 doc/driver-model/MIGRATION.txt | 4 +++-
 drivers/Makefile               | 3 +--
 drivers/block/Makefile         | 2 ++
 drivers/block/blk-uclass.c     | 2 +-
 scripts/Makefile.spl           | 4 +++-
 8 files changed, 15 insertions(+), 5 deletions(-)
author
#2 lore raw
In reply to Tom Rini
Quoted 13 lines · Tom Rini

The function part_init() will only be built when we have both CONFIG_PARTITIONS and CONFIG_HAVE_BLOCK_DEVICE set. Protect the call to this function with both of these tests now.

Cc Simon Glass <[email protected]>
Cc Philipp Tomsich <[email protected]>
Cc Michal Simek <[email protected]>
Cc York Sun <[email protected]>
Cc Prabhakar Kushwaha <[email protected]>
Cc Mingkai Hu <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Marek Behún <[email protected]>
Cc Vanessa Maegima <[email protected]>
Quoted 8 lines
Cc Eugen Hristev <[email protected]>
Cc Adam Ford <[email protected]>
Cc Jagan Teki <[email protected]>
Cc Tom Warren <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Vitaly Andrianov <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181212/bcb2c0f2/attachment.sig>