Skip to contentSkip to conversation

SPL NVMe support

PATCH In review Mayuresh Chitale 3 participants 12 messages Jun 3, 2023 – Jul 20, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v4 cover SPL NVMe support

This patchset adds support to load images of the SPL's next booting stage from a NVMe device.

Changes in v4:
- Drop patch 4
- Modify patch 2 to use generic fs.h APIs

Changes in v3:
- Add generic API to fetch payload from Ext or FAT filesystems
- Remove reduntant SPL_PCI_PNP config check

Changes in v2:
- Rebase on v2023.07-rc1
- Use uclass ID for blk APIs
- Add support to load FIT images from ext filesystem

Mayuresh Chitale (5):
spl: Add Kconfig options for NVME
spl: blk: Support loading images from fs
nvme: pci: Enable for SPL
spl: Support loading a FIT from ext FS
common: spl: Add spl NVMe boot support

Mayuresh Chitale (4):
spl: Add Kconfig options for NVME
spl: blk: Support loading images from fs
nvme: pci: Enable for SPL
common: spl: Add spl NVMe boot support

 arch/riscv/include/asm/spl.h |   1 +
 common/spl/Kconfig           |  27 +++++++
 common/spl/Makefile          |   2 +
 common/spl/spl_blk_fs.c      | 134 +++++++++++++++++++++++++++++++++++
 common/spl/spl_nvme.c        |  32 +++++++++
 disk/part.c                  |  10 +--
 drivers/Makefile             |   1 +
 drivers/block/Kconfig        |   7 ++
 drivers/nvme/Makefile        |   2 +-
 drivers/pci/Kconfig          |   6 ++
 include/spl.h                |   3 +
 11 files changed, 220 insertions(+), 5 deletions(-)
 create mode 100644 common/spl/spl_blk_fs.c
 create mode 100644 common/spl/spl_nvme.c
Signature · 1 line
2.34.1
#1 lore raw

PATCH v4 1/4 spl: Add Kconfig options for NVME

Add kconfig options to enable NVME and PCI NVMe support in SPL

---
 common/spl/Kconfig | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
common/spl/Kconfig +26 -0
index 2c042ad306..94b13f7a7f 100644
@@ -1263,6 +1263,32 @@ config SPL_SATA_RAW_U_BOOT_SECTOR
 	  Sector on the SATA disk to load U-Boot from, when the SATA disk is being
 	  used in raw mode. Units: SATA disk sectors (1 sector = 512 bytes).
 
+config SPL_NVME
+	bool "NVM Express device support"
+	depends on BLK
+	select HAVE_BLOCK_DEVICE
+	select FS_LOADER
+	help
+	  This option enables support for NVM Express devices.
+	  It supports basic functions of NVMe (read/write).
+
+config SPL_NVME_PCI
+	bool "NVM Express PCI device support for SPL"
+	depends on SPL_PCI && SPL_NVME
+	help
+	  This option enables support for NVM Express PCI devices.
+	  This allows use of NVMe devices for loading u-boot.
+
+config SPL_NVME_BOOT_DEVICE
+	hex "NVMe boot device number"
+	depends on SPL_NVME
+	default 0x0
+
+config SYS_NVME_BOOT_PARTITION
+	hex "NVMe boot partition number"
+	depends on SPL_NVME
+	default	0x1
+
 config SPL_SERIAL
 	bool "Support serial"
 	select SPL_PRINTF
Signature · 1 line
2.34.1
#2 lore raw

PATCH v4 2/4 spl: blk: Support loading images from fs

In reply to Mayuresh Chitale

Add a generic API to support loading of SPL payload from any supported filesystem on a given partition of a block device.

---
 common/spl/Kconfig      |   1 +
 common/spl/Makefile     |   1 +
 common/spl/spl_blk_fs.c | 134 ++++++++++++++++++++++++++++++++++++++++
 drivers/block/Kconfig   |   7 +++
 include/spl.h           |   3 +
 5 files changed, 146 insertions(+)
 create mode 100644 common/spl/spl_blk_fs.c
common/spl/Kconfig +1 -0
index 94b13f7a7f..3f705f4fb8 100644
@@ -1268,6 +1268,7 @@ config SPL_NVME
 	depends on BLK
 	select HAVE_BLOCK_DEVICE
 	select FS_LOADER
+	select SPL_BLK_FS
 	help
 	  This option enables support for NVM Express devices.
 	  It supports basic functions of NVMe (read/write).
common/spl/Makefile +1 -0
index 13db3df993..5210ad0248 100644
@@ -10,6 +10,7 @@ ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_$(SPL_TPL_)FRAMEWORK) += spl.o
 obj-$(CONFIG_$(SPL_TPL_)BOOTROM_SUPPORT) += spl_bootrom.o
 obj-$(CONFIG_$(SPL_TPL_)LOAD_FIT) += spl_fit.o
+obj-$(CONFIG_$(SPL_TPL_)BLK_FS) += spl_blk_fs.o
 obj-$(CONFIG_$(SPL_TPL_)LEGACY_IMAGE_FORMAT) += spl_legacy.o
 obj-$(CONFIG_$(SPL_TPL_)NOR_SUPPORT) += spl_nor.o
 obj-$(CONFIG_$(SPL_TPL_)XIP_SUPPORT) += spl_xip.o
common/spl/spl_blk_fs.c new file +134 -0

134 lines not on this page · raw message

drivers/block/Kconfig +7 -0
index 5a1aeb3d2b..6baaa6f071 100644
@@ -107,6 +107,13 @@ config EFI_MEDIA
 
 	  For sandbox there is a test driver.
 
+config SPL_BLK_FS
+	bool "Load images from filesystems on block devices"
+	depends on SPL_BLK
+	help
+	  Use generic support to load images from fat/ext filesystems on
+	  different types of block devices such as NVMe.
+
 if EFI_MEDIA
 
 config EFI_MEDIA_SANDBOX
include/spl.h +3 -0
index 7e0f5ac63b..20e1eb32a4 100644
@@ -672,6 +672,9 @@ int spl_load_image_ext(struct spl_image_info *spl_image,
 int spl_load_image_ext_os(struct spl_image_info *spl_image,
 			  struct spl_boot_device *bootdev,
 			  struct blk_desc *block_dev, int partition);
+int spl_blk_load_image(struct spl_image_info *spl_image,
+		       struct spl_boot_device *bootdev,
+		       enum uclass_id uclass_id, int devnum, int partnum);
 
 /**
  * spl_early_init() - Set up device tree and driver model in SPL if enabled
Signature · 1 line
2.34.1
#3 lore raw

PATCH v4 3/4 nvme: pci: Enable for SPL

In reply to Mayuresh Chitale

Enable NVME and PCI NVMe drivers for SPL builds. Also enable PCI_PNP for SPL which is required to auto configure the PCIe devices.

---
 drivers/Makefile      | 1 +
 drivers/nvme/Makefile | 2 +-
 drivers/pci/Kconfig   | 6 ++++++
 3 files changed, 8 insertions(+), 1 deletion(-)
drivers/Makefile +1 -0
index 58be410135..dc559ea7f7 100644
@@ -34,6 +34,7 @@ obj-$(CONFIG_$(SPL_)DM_MAILBOX) += mailbox/
 obj-$(CONFIG_$(SPL_)REMOTEPROC) += remoteproc/
 obj-$(CONFIG_$(SPL_)SYSINFO) += sysinfo/
 obj-$(CONFIG_$(SPL_TPL_)TPM) += tpm/
+obj-$(CONFIG_$(SPL_)NVME) += nvme/
 obj-$(CONFIG_XEN) += xen/
 obj-$(CONFIG_$(SPL_)FPGA) += fpga/
 obj-y += bus/
drivers/nvme/Makefile +1 -1
index fa7b619446..fd3e68a91d 100644
@@ -4,4 +4,4 @@
 
 obj-y += nvme-uclass.o nvme.o nvme_show.o
 obj-$(CONFIG_NVME_APPLE) += nvme_apple.o
-obj-$(CONFIG_NVME_PCI) += nvme_pci.o
+obj-$(CONFIG_$(SPL_)NVME_PCI) += nvme_pci.o
drivers/pci/Kconfig +6 -0
index ef328d2652..dca71ef504 100644
@@ -40,6 +40,12 @@ config PCI_PNP
 	help
 	  Enable PCI memory and I/O space resource allocation and assignment.
 
+config SPL_PCI_PNP
+	bool "Enable Plug & Play support for PCI"
+	help
+	  Enable PCI memory and I/O space resource allocation and assignment.
+	  This is required to auto configure the enumerated devices.
+
 config PCI_REGION_MULTI_ENTRY
 	bool "Enable Multiple entries of region type MEMORY in ranges for PCI"
 	help
Signature · 1 line
2.34.1
#4 lore raw

PATCH v4 4/4 common: spl: Add spl NVMe boot support

In reply to Mayuresh Chitale

Add support to load the next stage image from an NVMe disk which may be formatted as an EXT or FAT filesystem. Also protect the call to env_get in blk_get_device_part_str with CONFIG_SPL_ENV_SUPPORT macro to avoid link error when SPL_ENV_SUPPORT is not enabled.

---
 arch/riscv/include/asm/spl.h |  1 +
 common/spl/Makefile          |  1 +
 common/spl/spl_nvme.c        | 32 ++++++++++++++++++++++++++++++++
 disk/part.c                  | 10 ++++++----
 4 files changed, 40 insertions(+), 4 deletions(-)
 create mode 100644 common/spl/spl_nvme.c
arch/riscv/include/asm/spl.h +1 -0
index 2898a770ee..9c0bf9755c 100644
@@ -20,6 +20,7 @@ enum {
 	BOOT_DEVICE_SPI,
 	BOOT_DEVICE_USB,
 	BOOT_DEVICE_SATA,
+	BOOT_DEVICE_NVME,
 	BOOT_DEVICE_I2C,
 	BOOT_DEVICE_BOARD,
 	BOOT_DEVICE_DFU,
common/spl/Makefile +1 -0
index 5210ad0248..bad2bbf6cf 100644
@@ -29,6 +29,7 @@ obj-$(CONFIG_$(SPL_TPL_)USB_STORAGE) += spl_usb.o
 obj-$(CONFIG_$(SPL_TPL_)FS_FAT) += spl_fat.o
 obj-$(CONFIG_$(SPL_TPL_)FS_EXT4) += spl_ext.o
 obj-$(CONFIG_$(SPL_TPL_)SATA) += spl_sata.o
+obj-$(CONFIG_$(SPL_TPL_)NVME) += spl_nvme.o
 obj-$(CONFIG_$(SPL_TPL_)SEMIHOSTING) += spl_semihosting.o
 obj-$(CONFIG_$(SPL_TPL_)DFU) += spl_dfu.o
 obj-$(CONFIG_$(SPL_TPL_)SPI_LOAD) += spl_spi.o
common/spl/spl_nvme.c new file +32 -0
new file mode 100644
index 0000000000..2af63f1dc8
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2023
+ * Ventana Micro Systems Inc.
+ *
+ */
+
+#include <common.h>
+#include <spl.h>
+#include <init.h>
+#include <nvme.h>
+
+static int spl_nvme_load_image(struct spl_image_info *spl_image,
+			       struct spl_boot_device *bootdev)
+{
+	int ret;
+
+	ret = pci_init();
+	if (ret < 0)
+		return ret;
+
+	ret = nvme_scan_namespace();
+	if (ret < 0)
+		return ret;
+
+	ret = spl_blk_load_image(spl_image, bootdev, UCLASS_NVME,
+				 CONFIG_SPL_NVME_BOOT_DEVICE,
+				 CONFIG_SYS_NVME_BOOT_PARTITION);
+	return ret;
+}
+
+SPL_LOAD_IMAGE_METHOD("NVME", 0, BOOT_DEVICE_NVME, spl_nvme_load_image);
disk/part.c +6 -4
index 35300df590..d330c57ab4 100644
@@ -467,10 +467,12 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
 	}
 #endif
 
-	/* If no dev_part_str, use bootdevice environment variable */
-	if (!dev_part_str || !strlen(dev_part_str) ||
-	    !strcmp(dev_part_str, "-"))
-		dev_part_str = env_get("bootdevice");
+	if (IS_ENABLED(CONFIG_SPL_ENV_SUPPORT)) {
+		/* If no dev_part_str, use bootdevice environment variable */
+		if (!dev_part_str || !strlen(dev_part_str) ||
+		    !strcmp(dev_part_str, "-"))
+			dev_part_str = env_get("bootdevice");
+	}
 
 	/* If still no dev_part_str, it's an error */
 	if (!dev_part_str) {
Signature · 1 line
2.34.1
#5 lore raw
In reply to Mayuresh Chitale
Quoted 8 lines · Mayuresh Chitale

This patchset adds support to load images of the SPL's next booting stage from a NVMe device.

Changes in v4:
- Drop patch 4
- Modify patch 2 to use generic fs.h APIs

[...]

With one change, which is that the "disk/part.c" in 4/4 were not required for any platform in tree and also broke testcases, and so was dropped, this has now been applied to u-boot/next. If you can explain a bit more what the problem you had was, we can look in to it. I suspect you need to test for not SPL_ENV_SUPPORT but ENV_SUPPORT itself.

Signature · 1 line
Tom
#6 lore raw

Hi Tom,

Quoted 11 lines · Tom Rini
Quoted 8 lines · Mayuresh Chitale

This patchset adds support to load images of the SPL's next booting stage from a NVMe device.

Changes in v4:
- Drop patch 4
- Modify patch 2 to use generic fs.h APIs

[...]

Quoted 9 lines

With one change, which is that the "disk/part.c" in 4/4 were not required for
any platform in tree and also broke testcases, and so was dropped, this has now
been applied to u-boot/next. If you can explain a bit more what the problem you
had was, we can look in to it. I suspect you need to test for not SPL_ENV_SUPPORT but ENV_SUPPORT itself.

Thanks.
When SPL_NVME is enabled the build breaks with the following error:
riscv64-unknown-linux-gnu-ld.bfd: disk/part.o: in function `blk_get_device_part_str':
u-boot/disk/part.c:473: undefined reference to `env_get' make[2]: *** [u-boot/scripts/Makefile.spl:527: spl/u-boot-spl] Error 1 make[1]: *** [/u-boot/Makefile:2053: spl/u-boot-spl] Error 2

One possible fix is:

if ((!IS_ENABLED(CONFIG_SPL) && IS_ENABLED(CONFIG_ENV_SUPPORT)) ||

       (IS_ENABLED(CONFIG_SPL) && IS_ENABLED(CONFIG_SPL_ENV_SUPPORT)))
	if (!dev_part_str || !strlen(dev_part_str)
|| !strcmp(dev_part_str, "-"))
	dev_part_str = env_get("bootdevice");
#7 lore raw
Quoted 31 lines · On 12.07.23 15:06, [email protected] wrote:

Hi Tom,

Quoted 11 lines · Tom Rini
Quoted 8 lines · Mayuresh Chitale

This patchset adds support to load images of the SPL's next booting stage from a NVMe device.

Changes in v4:
- Drop patch 4
- Modify patch 2 to use generic fs.h APIs

[...]

Quoted 9 lines

With one change, which is that the "disk/part.c" in 4/4 were not required for
any platform in tree and also broke testcases, and so was dropped, this has now
been applied to u-boot/next. If you can explain a bit more what the problem you
had was, we can look in to it. I suspect you need to test for not SPL_ENV_SUPPORT but ENV_SUPPORT itself.

Thanks.
When SPL_NVME is enabled the build breaks with the following error:
riscv64-unknown-linux-gnu-ld.bfd: disk/part.o: in function `blk_get_device_part_str':
u-boot/disk/part.c:473: undefined reference to `env_get' make[2]: *** [u-boot/scripts/Makefile.spl:527: spl/u-boot-spl] Error 1 make[1]: *** [/u-boot/Makefile:2053: spl/u-boot-spl] Error 2

Quoted 9 lines

One possible fix is:

if ((!IS_ENABLED(CONFIG_SPL) && IS_ENABLED(CONFIG_ENV_SUPPORT)) ||

        (IS_ENABLED(CONFIG_SPL) && IS_ENABLED(CONFIG_SPL_ENV_SUPPORT)))
	if (!dev_part_str || !strlen(dev_part_str)
|| !strcmp(dev_part_str, "-"))
	dev_part_str = env_get("bootdevice");

I think CONFIG_SPL_ENV_SUPPORT should depend on CONFIG_ENV_SUPPORT in common/spl/Kconfig.

Best regards

Heinrich

#8 lore raw
Quoted 42 lines · Heinrich Schuchardt
Quoted 31 lines · On 12.07.23 15:06, [email protected] wrote:

Hi Tom,

Quoted 11 lines · Tom Rini
Quoted 8 lines · Mayuresh Chitale

This patchset adds support to load images of the SPL's next booting stage from a NVMe device.

Changes in v4:
- Drop patch 4
- Modify patch 2 to use generic fs.h APIs

[...]

Quoted 9 lines

With one change, which is that the "disk/part.c" in 4/4 were not required for
any platform in tree and also broke testcases, and so was dropped, this has now
been applied to u-boot/next. If you can explain a bit more what the problem you
had was, we can look in to it. I suspect you need to test for not SPL_ENV_SUPPORT but ENV_SUPPORT itself.

Thanks.
When SPL_NVME is enabled the build breaks with the following error:
riscv64-unknown-linux-gnu-ld.bfd: disk/part.o: in function `blk_get_device_part_str':
u-boot/disk/part.c:473: undefined reference to `env_get' make[2]: *** [u-boot/scripts/Makefile.spl:527: spl/u-boot-spl] Error 1 make[1]: *** [/u-boot/Makefile:2053: spl/u-boot-spl] Error 2

Quoted 9 lines

One possible fix is:

if ((!IS_ENABLED(CONFIG_SPL) && IS_ENABLED(CONFIG_ENV_SUPPORT)) ||

        (IS_ENABLED(CONFIG_SPL) && IS_ENABLED(CONFIG_SPL_ENV_SUPPORT)))
	if (!dev_part_str || !strlen(dev_part_str)
|| !strcmp(dev_part_str, "-"))
	dev_part_str = env_get("bootdevice");
Quoted 2 lines

I think CONFIG_SPL_ENV_SUPPORT should depend on CONFIG_ENV_SUPPORT in common/spl/Kconfig.

Not strictly, but checking for CONFIG_IS_ENABLED(ENV_SUPPORT) should do what's desired here?

Signature · 1 line
Tom
#9 lore raw
Quoted 52 lines · Tom Rini
Quoted 51 lines · Heinrich Schuchardt
Quoted 49 lines · On 12.07.23 15:06, [email protected] wrote:

Hi Tom,

Quoted 12 lines · Tom Rini
Quoted 9 lines · Mayuresh Chitale

This patchset adds support to load images of the SPL's next booting
stage from a NVMe device.

Changes in v4:
- Drop patch 4
- Modify patch 2 to use generic fs.h APIs

[...]

Quoted 13 lines

With one change, which is that the "disk/part.c" in 4/4 were not
required for
any platform in tree and also broke testcases, and so was dropped,
this has now
been applied to u-boot/next. If you can explain a bit more what the
problem you
had was, we can look in to it. I suspect you need to test for not
SPL_ENV_SUPPORT but ENV_SUPPORT itself.

Thanks.
When SPL_NVME is enabled the build breaks with the following error:
riscv64-unknown-linux-gnu-ld.bfd: disk/part.o: in function `blk_get_device_part_str':
u-boot/disk/part.c:473: undefined reference to `env_get' make[2]: *** [u-boot/scripts/Makefile.spl:527: spl/u-boot-spl] Error 1
make[1]: *** [/u-boot/Makefile:2053: spl/u-boot-spl] Error 2

One possible fix is:

if ((!IS_ENABLED(CONFIG_SPL) && IS_ENABLED(CONFIG_ENV_SUPPORT)) ||

        (IS_ENABLED(CONFIG_SPL) &&
IS_ENABLED(CONFIG_SPL_ENV_SUPPORT)))
	if (!dev_part_str || !strlen(dev_part_str)
Quoted 1 line
Quoted 1 line

!strcmp(dev_part_str, "-"))

	dev_part_str = env_get("bootdevice");
Quoted 7 lines
Quoted 3 lines

I think CONFIG_SPL_ENV_SUPPORT should depend on CONFIG_ENV_SUPPORT in
common/spl/Kconfig.

Not strictly, but checking for CONFIG_IS_ENABLED(ENV_SUPPORT) should do
what's desired here?

When SPL_NVME & SPL_BLK_FS is enabled, the spl_blk_fs driver calls fs_set_blk_dev to the set the device & partition before accessing it and fs_set_blk_dev internally tries to get the device & partition from the bootdevice env variable if it was not passed by the caller. However for SPL build, when SPL_ENV_SUPPORT is not enabled nothing provides env_get and hence the build fails.

#10 lore raw
Quoted 61 lines · On Mon, Jul 17, 2023 at 01:39:52PM +0530, [email protected] wrote:
Quoted 52 lines · Tom Rini
Quoted 51 lines · Heinrich Schuchardt
Quoted 49 lines · On 12.07.23 15:06, [email protected] wrote:

Hi Tom,

Quoted 12 lines · Tom Rini
Quoted 9 lines · Mayuresh Chitale

This patchset adds support to load images of the SPL's next booting
stage from a NVMe device.

Changes in v4:
- Drop patch 4
- Modify patch 2 to use generic fs.h APIs

[...]

Quoted 13 lines

With one change, which is that the "disk/part.c" in 4/4 were not
required for
any platform in tree and also broke testcases, and so was dropped,
this has now
been applied to u-boot/next. If you can explain a bit more what the
problem you
had was, we can look in to it. I suspect you need to test for not
SPL_ENV_SUPPORT but ENV_SUPPORT itself.

Thanks.
When SPL_NVME is enabled the build breaks with the following error:
riscv64-unknown-linux-gnu-ld.bfd: disk/part.o: in function `blk_get_device_part_str':
u-boot/disk/part.c:473: undefined reference to `env_get' make[2]: *** [u-boot/scripts/Makefile.spl:527: spl/u-boot-spl] Error 1
make[1]: *** [/u-boot/Makefile:2053: spl/u-boot-spl] Error 2

One possible fix is:

if ((!IS_ENABLED(CONFIG_SPL) && IS_ENABLED(CONFIG_ENV_SUPPORT)) ||

        (IS_ENABLED(CONFIG_SPL) &&
IS_ENABLED(CONFIG_SPL_ENV_SUPPORT)))
	if (!dev_part_str || !strlen(dev_part_str)
Quoted 1 line
Quoted 1 line

!strcmp(dev_part_str, "-"))

	dev_part_str = env_get("bootdevice");
Quoted 7 lines
Quoted 3 lines

I think CONFIG_SPL_ENV_SUPPORT should depend on CONFIG_ENV_SUPPORT in
common/spl/Kconfig.

Not strictly, but checking for CONFIG_IS_ENABLED(ENV_SUPPORT) should do
what's desired here?

Quoted 6 lines

When SPL_NVME & SPL_BLK_FS is enabled, the spl_blk_fs driver calls fs_set_blk_dev to the set the device & partition before accessing it and fs_set_blk_dev internally tries to get the device & partition from the bootdevice env variable if it was not passed by the caller. However for SPL build, when SPL_ENV_SUPPORT is not enabled nothing provides env_get and hence the build fails.

OK. So in the code we should be able to test with CONFIG_IS_ENABLED(ENV_SUPPORT) is that will be true for ((SPL and SPL environment support) or (Main U-Boot and environment support) or (TPL and TPL env)).

Signature · 1 line
Tom
#11 lore raw
Quoted 81 lines · Tom Rini
Quoted 69 lines · On Mon, Jul 17, 2023 at 01:39:52PM +0530, [email protected] wrote:
Quoted 63 lines · Tom Rini
Quoted 52 lines · Heinrich Schuchardt
Quoted 51 lines · On 12.07.23 15:06, [email protected] wrote:

Hi Tom,

Quoted 13 lines · Tom Rini
Quoted 10 lines · Mayuresh Chitale

This patchset adds support to load images of the SPL's next
booting
stage from a NVMe device.

Changes in v4:
- Drop patch 4
- Modify patch 2 to use generic fs.h APIs

[...]

Quoted 16 lines

With one change, which is that the "disk/part.c" in 4/4 were
not
required for
any platform in tree and also broke testcases, and so was dropped,
this has now
been applied to u-boot/next. If you can explain a bit more what
the
problem you
had was, we can look in to it. I suspect you need to test for
not
SPL_ENV_SUPPORT but ENV_SUPPORT itself.

Thanks.
When SPL_NVME is enabled the build breaks with the following error:
riscv64-unknown-linux-gnu-ld.bfd: disk/part.o: in function `blk_get_device_part_str':
u-boot/disk/part.c:473: undefined reference to `env_get' make[2]: *** [u-boot/scripts/Makefile.spl:527: spl/u-boot- spl]
Error 1
make[1]: *** [/u-boot/Makefile:2053: spl/u-boot-spl] Error 2

One possible fix is:

if ((!IS_ENABLED(CONFIG_SPL) &&
IS_ENABLED(CONFIG_ENV_SUPPORT))

        (IS_ENABLED(CONFIG_SPL) &&
IS_ENABLED(CONFIG_SPL_ENV_SUPPORT)))
	if (!dev_part_str || !strlen(dev_part_str)
Quoted 1 line
Quoted 1 line

!strcmp(dev_part_str, "-"))

Quoted 8 lines
Quoted 3 lines
	dev_part_str = env_get("bootdevice");

I think CONFIG_SPL_ENV_SUPPORT should depend on
CONFIG_ENV_SUPPORT
in
common/spl/Kconfig.

Quoted 4 lines

Not strictly, but checking for CONFIG_IS_ENABLED(ENV_SUPPORT) should
do
what's desired here?

Quoted 9 lines

When SPL_NVME & SPL_BLK_FS is enabled, the spl_blk_fs driver calls fs_set_blk_dev to the set the device & partition before accessing it
and fs_set_blk_dev internally tries to get the device & partition from
the bootdevice env variable if it was not passed by the caller. However
for SPL build, when SPL_ENV_SUPPORT is not enabled nothing provides env_get and hence the build fails.

Quoted 4 lines

OK. So in the code we should be able to test with CONFIG_IS_ENABLED(ENV_SUPPORT) is that will be true for ((SPL and SPL environment support) or (Main U-Boot and environment support) or (TPL and TPL env)).

Thanks! I will send the patch with this change.

Quoted 1 line