Skip to contentSkip to conversation

arm: snapdragon: Add snagboot support for Lemans-EVK

PATCH Superseded Balaji Selvanathan 3 participants 21 messages Jun 16 – Jun 19

Subsystems (4)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover arm: snapdragon: Add snagboot support for Lemans-EVK

This series adds support for running U-Boot in snagboot mode on Qualcomm Snapdragon platforms, targeting the Lemans-EVK board.

Snagboot is an open-source, scriptable flashing framework that provides an alternative to the proprietary Firehose protocol for device provisioning. Like the traditional EDL+Firehose flow, Snagboot uses the Qualcomm boot ROM recovery mode (EDL) and Sahara protocol to download and execute bootloaders. However, instead of using the proprietary Firehose programmer, Snagboot loads U-Boot into DDR and uses the standard fastboot protocol for device flashing.

The framework consists of three modular components: snagrecover (downloads XBL/QCLib to initialize DDR and load U-Boot into RAM), snagflash (communicates with U-Boot over USB using fastboot to flash system images), and snagfactory (orchestrates parallel factory flashing tasks).

In the snagboot execution flow, ROM code in recovery mode loads snagrecover, which downloads XBL to internal memory. XBL executes and initializes DDR, then snagrecover downloads U-Boot into DDR and transfers control to it. At this point, XBL has left the MMU enabled with its own page tables and has not initialized PSCI firmware or populated the Command DB. U-Boot must handle this non-standard boot environment to enter fastboot mode for device flashing.

This series addresses the specific requirements of the snagboot flow:

Patch 1 changes SYSRESET_PSCI from 'select' to 'imply' so it can be disabled on platforms where PSCI firmware is unavailable.

Patch 2 guards show_psci_version() and qcom_psci_fixup() with CONFIG_ARM_SMCCC to prevent build failures when SMCCC is disabled.

Patch 3 adds CONFIG_QCOM_SNAGBOOT_SUPPORT option to enable snagboot mode support on Qualcomm platforms.

Patch 4 disables the MMU and invalidates TLBs at the earliest entry point to clear stale page tables left by previous bootloader before U-Boot sets up its own MMU.

Patch 5 adds QCOM_COMMAND_DB_OPTIONAL to allow the CMD DB driver to bind successfully when CMD DB data is not populated by XBL, logging a warning instead of failing.

Patch 6 adds qcom_lemans_snagboot_defconfig for Lemans-EVK, based on qcom_defconfig with snagboot-specific settings.

---
Changes in v3:
- Brought the MMU disable logic under CONFIG_QCOM_SNAGBOOT_SUPPORT
ifdef condition
- Moved the MMU disable codes to a new seperate file
- Used "if (IS_ENABLED(CONFIG_QCOM_COMMAND_DB_OPTIONAL))" instead
of #ifdef
- Removed enabling QCOM_COMMAND_DB_OPTIONAL, ENABLE_ARM_SOC_BOOT0_HOOK
and SKIP_RELOCATE as they are now automatically enabled by
QCOM_SNAGBOOT_SUPPORT selection
- Removed updating MAINTAINERS as the defconfig file is picked up by
the "N: qcom" line
- Link to v2: https://lore.kernel.org/u-boot/[email protected]/

Changes in v2:
- Changed SYSRESET_PSCI from 'select' to 'imply'
- Guard show_psci_version() and qcom_psci_fixup() with CONFIG_ARM_SMCCC
- Disables the MMU and invalidates TLBs at the earliest entry point
- Add qcom_lemans_snagboot_defconfig for Lemans-EVK
- Link to v1: https://lore.kernel.org/u-boot/[email protected]/

---
Balaji Selvanathan (6):
arm: snapdragon: Make SYSRESET_PSCI optional
arm: snapdragon: Guard PSCI functions with CONFIG_ARM_SMCCC
arm: snapdragon: Add CONFIG_QCOM_SNAGBOOT_SUPPORT option
arm: snapdragon: Disable MMU early before U-Boot reset vector
soc: qcom: cmd-db: Allow boot without CMD DB data
configs: add qcom_lemans_snagboot_defconfig for Lemans-EVK

 arch/arm/Kconfig                                   |  2 +-
 arch/arm/mach-snapdragon/Kconfig                   | 13 ++++++
 arch/arm/mach-snapdragon/board.c                   |  6 +++
 arch/arm/mach-snapdragon/include/mach/boot0.h      |  2 +
 .../mach-snapdragon/include/mach/snagboot_boot0.h  | 53 ++++++++++++++++++++++
 configs/qcom_lemans_snagboot_defconfig             | 45 ++++++++++++++++++
 drivers/soc/qcom/Kconfig                           | 18 ++++++++
 drivers/soc/qcom/cmd-db.c                          | 14 +++++-
 8 files changed, 150 insertions(+), 3 deletions(-)

---
base-commit: e1c3db1f788ed8106840e81b795e030cbe0020b7
change-id: 20260616-sngboot-760714938d18

Best regards,

Signature · 1 line
Balaji Selvanathan <[email protected]>
#1 lore raw

PATCH v3 1/6 arm: snapdragon: Make SYSRESET_PSCI optional

In snagboot mode, U-Boot is loaded directly by XBL without a prior bootloader to initialize PSCI firmware. Forcing SYSRESET_PSCI via 'select' causes failures in this scenario. Change to 'imply' to allow it to be disabled when PSCI is unavailable.

---
Changes in v3:
- No changes

Changes in v2:
- Newly introduced in v2

---
 arch/arm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/Kconfig +1 -1
index 514bf2000b4..a6d36f39069 100644
@@ -1150,7 +1150,7 @@ config ARCH_SNAPDRAGON
 	select SAVE_PREV_BL_FDT_ADDR if !ENABLE_ARM_SOC_BOOT0_HOOK
 	select LINUX_KERNEL_IMAGE_HEADER if !ENABLE_ARM_SOC_BOOT0_HOOK
 	select SYSRESET
-	select SYSRESET_PSCI
+	imply SYSRESET_PSCI
 	select ANDROID_BOOT_IMAGE_IGNORE_BLOB_ADDR
 	select MMU_PGPROT
 	imply OF_UPSTREAM
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v3 1/6] arm: snapdragon: Make SYSRESET_PSCI optional

Hi Balaji,

Quoted 4 lines · Balaji Selvanathan

In snagboot mode, U-Boot is loaded directly by XBL without a prior bootloader to initialize PSCI firmware. Forcing SYSRESET_PSCI via 'select' causes failures in this scenario. Change to 'imply' to allow it to be disabled when PSCI is unavailable.

General feedback, I assume you're not writing these descriptions by hand, they are overly verbose and don't convey much useful context. This doesn't need to be a paragraph, just:

"In snagboot mode, there is no PSCI firmware and U-Boot will crash if it attempts to make PSCI calls so disable it in this case."

It isn't acceptable to send me patches like this that have a full sentence explaining how it changes a 'select' and an 'imply', i can see that from the diff.

Please do better, take 30 seconds to write a sensible commit message. This goes for everyone with an @oss.qualcomm.com email

Quoted 18 lines

---
Changes in v3:
- No changes

Changes in v2:
- Newly introduced in v2

---
 arch/arm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/Kconfig +0 -0
index 514bf2000b4..a6d36f39069 100644

arch/arm/Kconfig config ARCH_SNAPDRAGON · line 1153

Quoted 5 lines
arch/arm/Kconfig +1 -1
@@ -1150,7 +1150,7 @@ config ARCH_SNAPDRAGON
 	select SAVE_PREV_BL_FDT_ADDR if !ENABLE_ARM_SOC_BOOT0_HOOK
 	select LINUX_KERNEL_IMAGE_HEADER if !ENABLE_ARM_SOC_BOOT0_HOOK
 	select SYSRESET
-	select SYSRESET_PSCI
+	imply SYSRESET_PSCI

Let's not allow disabling SYSRESET_PSCI in defconfigs.

select SYSRESET_PSCI if !QCOM_SNAGBOOT_MODE

Quoted 4 lines
arch/arm/Kconfig +0 -0
 	select ANDROID_BOOT_IMAGE_IGNORE_BLOB_ADDR
 	select MMU_PGPROT
 	imply OF_UPSTREAM
Signature · 1 line
// Casey (she/her)
#3 lore raw

Re: [PATCH v3 1/6] arm: snapdragon: Make SYSRESET_PSCI optional

Hi Casey,

Quoted 14 lines · Casey Connolly

Hi Balaji,

Quoted 4 lines · Balaji Selvanathan

In snagboot mode, U-Boot is loaded directly by XBL without a prior bootloader to initialize PSCI firmware. Forcing SYSRESET_PSCI via 'select' causes failures in this scenario. Change to 'imply' to allow it to be disabled when PSCI is unavailable.

General feedback, I assume you're not writing these descriptions by hand, they are overly verbose and don't convey much useful context. This doesn't need to be a paragraph, just:

"In snagboot mode, there is no PSCI firmware and U-Boot will crash if it attempts to make PSCI calls so disable it in this case."

Quoted 6 lines

It isn't acceptable to send me patches like this that have a full sentence explaining how it changes a 'select' and an 'imply', i can see that from the diff.

Please do better, take 30 seconds to write a sensible commit message. This goes for everyone with an @oss.qualcomm.com email

Apologies!! We will try to be consise in our commit descriptions going forward.

Regards,

Balaji

Quoted 31 lines
Quoted 18 lines

---
Changes in v3:
- No changes

Changes in v2:
- Newly introduced in v2

---
  arch/arm/Kconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/Kconfig +0 -0
index 514bf2000b4..a6d36f39069 100644

arch/arm/Kconfig config ARCH_SNAPDRAGON · line 1153

Quoted 5 lines
arch/arm/Kconfig +1 -1
@@ -1150,7 +1150,7 @@ config ARCH_SNAPDRAGON
  	select SAVE_PREV_BL_FDT_ADDR if !ENABLE_ARM_SOC_BOOT0_HOOK
  	select LINUX_KERNEL_IMAGE_HEADER if !ENABLE_ARM_SOC_BOOT0_HOOK
  	select SYSRESET
-	select SYSRESET_PSCI
+	imply SYSRESET_PSCI

Let's not allow disabling SYSRESET_PSCI in defconfigs.

select SYSRESET_PSCI if !QCOM_SNAGBOOT_MODE

Quoted 4 lines
arch/arm/Kconfig +0 -0
  	select ANDROID_BOOT_IMAGE_IGNORE_BLOB_ADDR
  	select MMU_PGPROT
  	imply OF_UPSTREAM
#4 lore raw

PATCH v3 2/6 arm: snapdragon: Guard PSCI functions with CONFIG_ARM_SMCCC

In reply to Balaji Selvanathan

In snagboot mode, U-Boot is loaded directly by XBL without PSCI firmware support. The functions show_psci_version() and qcom_psci_fixup() call arm_smccc_smc() which is unavailable when CONFIG_ARM_SMCCC is disabled, causing build failures.

Hence, added CONFIG_ARM_SMCCC guards to both functions.

---
Changes in v3:
- Added CONFIG_ARM_SMCCC guards

Changes in v2:
- Newly introduced in v2

---
 arch/arm/mach-snapdragon/board.c | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/mach-snapdragon/board.c +6 -0
index 829a0109ac7..0066951a6a2 100644
@@ -162,6 +162,9 @@ static void show_psci_version(void)
 {
 	struct arm_smccc_res res;
 
+	if (!IS_ENABLED(CONFIG_ARM_SMCCC))
+		return;
+
 	arm_smccc_smc(ARM_PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0, 0, 0, 0, 0, &res);
 
 	/* Some older SoCs like MSM8916 don't always support PSCI */
@@ -185,6 +188,9 @@ static void qcom_psci_fixup(void *fdt)
 	int offset, ret;
 	struct arm_smccc_res res;
 
+	if (!IS_ENABLED(CONFIG_ARM_SMCCC))
+		return;
+
 	arm_smccc_smc(ARM_PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0, 0, 0, 0, 0, &res);
 
 	if ((int)res.a0 != PSCI_RET_NOT_SUPPORTED)
Signature · 1 line
2.34.1
#5 lore raw

PATCH v3 3/6 arm: snapdragon: Add CONFIG_QCOM_SNAGBOOT_SUPPORT option

In reply to Balaji Selvanathan

Add CONFIG_QCOM_SNAGBOOT_SUPPORT to the boot0.h workaround choice block to enable snagboot mode support on Qualcomm platforms.

This config option automatically selects the
required dependencies: QCOM_COMMAND_DB_OPTIONAL, ENABLE_ARM_SOC_BOOT0_HOOK to enable early boot hooks, and SKIP_RELOCATE.

---
Changes in v3:
- Newly introduced in v3

---
 arch/arm/mach-snapdragon/Kconfig | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/mach-snapdragon/Kconfig +13 -0
index 931d25c1023..e173af1ce45 100644
@@ -63,6 +63,19 @@ config QCOM_EL2_GUNYAH_EXIT_SUPPORT
 	  Exit Gunyah hypervisor and switch to EL2 during early boot. This must
 	  happen before EL register configuration in start.S so that U-Boot can
 	  run properly at EL2.
+
+config QCOM_SNAGBOOT_SUPPORT
+	bool "Enable snagboot mode support"
+	select QCOM_COMMAND_DB_OPTIONAL
+	select ENABLE_ARM_SOC_BOOT0_HOOK
+	select SKIP_RELOCATE
+	help
+	  Enable support for running U-Boot in snagboot mode on Qualcomm
+	  platforms. In snagboot mode, XBL loads U-Boot directly for
+	  manufacturing and recovery use cases.
+
+	  This option performs early boot initialization to ensure a clean
+	  state for U-Boot when loaded by XBL in snagboot mode.
 endchoice
 
 endif
Signature · 1 line
2.34.1
#6 lore raw

Re: [PATCH v3 3/6] arm: snapdragon: Add CONFIG_QCOM_SNAGBOOT_SUPPORT option

Hi Balaji,

Quoted 20 lines · Balaji Selvanathan

Add CONFIG_QCOM_SNAGBOOT_SUPPORT to the boot0.h workaround choice block to enable snagboot mode support on Qualcomm platforms.

This config option automatically selects the
required dependencies: QCOM_COMMAND_DB_OPTIONAL, ENABLE_ARM_SOC_BOOT0_HOOK to enable early boot hooks, and SKIP_RELOCATE.

---
Changes in v3:
- Newly introduced in v3

---
 arch/arm/mach-snapdragon/Kconfig | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/mach-snapdragon/Kconfig +0 -0
index 931d25c1023..e173af1ce45 100644

arch/arm/mach-snapdragon/Kconfig config QCOM_EL2_GUNYAH_EXIT_SUPPORT · line 67

Quoted 5 lines
arch/arm/mach-snapdragon/Kconfig +2 -0
@@ -63,6 +63,19 @@ config QCOM_EL2_GUNYAH_EXIT_SUPPORT
 	  Exit Gunyah hypervisor and switch to EL2 during early boot. This must
 	  happen before EL register configuration in start.S so that U-Boot can
 	  run properly at EL2.
+
+config QCOM_SNAGBOOT_SUPPORT

SNAGBOOT_SUPPORT implies that this adds support for some feature, but presumably this shouldn't be enabled in normal U-Boot builds, rather enabled to configure U-Boot for a particular usecase right?

I think it would make sense to rename this to QCOM_SNAGBOOT_MODE, then we can probably also avoid adding "QCOM_COMMAND_DB_OPTIONAL" later and just check this option instead.

Please also move this option out of the boot0 hook choice, since it really doesn't belong under there, add a QCOM_BOOT0_SNAGBOOT_MODE option there and select it instead.

arch/arm/mach-snapdragon/Kconfig config QCOM_EL2_GUNYAH_EXIT_SUPPORT · line 71

Quoted 4 lines
arch/arm/mach-snapdragon/Kconfig +4 -0
+	bool "Enable snagboot mode support"
+	select QCOM_COMMAND_DB_OPTIONAL
+	select ENABLE_ARM_SOC_BOOT0_HOOK
+	select SKIP_RELOCATE

I see in the new defconfig you add later that there are some other changes that seem to be required for snagboot, like disabling IOMMU, those dependencies should be expressed here.

arch/arm/mach-snapdragon/Kconfig config QCOM_EL2_GUNYAH_EXIT_SUPPORT · line 75

Quoted 4 lines
arch/arm/mach-snapdragon/Kconfig +4 -0
+	help
+	  Enable support for running U-Boot in snagboot mode on Qualcomm
+	  platforms. In snagboot mode, XBL loads U-Boot directly for
+	  manufacturing and recovery use cases.

This is not very clearly phrased, just be clear that this build of U-Boot is to be loaded in EDL mode.

arch/arm/mach-snapdragon/Kconfig config QCOM_EL2_GUNYAH_EXIT_SUPPORT · line 78

Quoted 3 lines
arch/arm/mach-snapdragon/Kconfig +3 -0
+
+	  This option performs early boot initialization to ensure a clean
+	  state for U-Boot when loaded by XBL in snagboot mode.

I'd just drop this sentence.

Quoted 4 lines
arch/arm/mach-snapdragon/Kconfig +0 -0
 endchoice
 
 endif
Signature · 1 line
// Casey (she/her)
#7 lore raw

PATCH v3 4/6 arm: snapdragon: Disable MMU early before U-Boot reset vector

In reply to Balaji Selvanathan

When U-Boot is loaded by XBL in snagboot mode, XBL leaves the MMU enabled with its own page tables. This causes stale TLB entries and incorrect memory mappings when U-Boot initializes its own MMU.

Disable the MMU and invalidate TLBs at the earliest entry point, before branching to the reset vector, handling EL1, EL2, and EL3. This ensures a clean MMU state for U-Boot initialization.

The changes in this patch are based on:
https://lore.kernel.org/all/[email protected]/
https://lore.kernel.org/u-boot/[email protected]/

---
Changes in v3:
- Brought the MMU disable logic under CONFIG_QCOM_SNAGBOOT_SUPPORT ifdef condition
- Moved the MMU disable codes to a new seperate file

Changes in v2:
- Newly introduced in v2

---
 arch/arm/mach-snapdragon/include/mach/boot0.h      |  2 +
 .../mach-snapdragon/include/mach/snagboot_boot0.h  | 53 ++++++++++++++++++++++
 2 files changed, 55 insertions(+)
arch/arm/mach-snapdragon/include/mach/boot0.h +2 -0
index 032a9fbdb12..60ad15dba57 100644
@@ -7,6 +7,8 @@
 #include "msm8916_boot0.h"
 #elif defined(CONFIG_QCOM_EL2_GUNYAH_EXIT_SUPPORT)
 #include "gunyah_exit_boot0.h"
+#elif defined(CONFIG_QCOM_SNAGBOOT_SUPPORT)
+#include "snagboot_boot0.h"
 #else
 	b	reset
 #endif
arch/arm/mach-snapdragon/include/mach/snagboot_boot0.h new file +53 -0

53 lines not on this page · raw message

Signature · 1 line
2.34.1
#8 lore raw

PATCH v3 5/6 soc: qcom: cmd-db: Allow boot without CMD DB data

In reply to Balaji Selvanathan

In snagboot mode, XBL loads U-Boot directly without populating CMD DB. The cmd-db driver fails to bind when CMD DB magic is invalid, blocking boot even when CMD DB is not strictly required.

Add QCOM_COMMAND_DB_OPTIONAL config to allow the driver to bind successfully when CMD DB data is absent. When enabled, a warning is logged and cmd_db_header is set to NULL, so consumer drivers receive errors on resource queries rather than preventing boot entirely.

---
Changes in v3:
- Used "if (IS_ENABLED(CONFIG_QCOM_COMMAND_DB_OPTIONAL))" instead of #ifdef

Changes in v2:
- No changes

---
 drivers/soc/qcom/Kconfig  | 18 ++++++++++++++++++
 drivers/soc/qcom/cmd-db.c | 14 ++++++++++++--
 2 files changed, 30 insertions(+), 2 deletions(-)
drivers/soc/qcom/Kconfig +18 -0
index 8243805e46a..7f4cf1b9a98 100644
@@ -18,6 +18,24 @@ config QCOM_COMMAND_DB
 	  resource on a RPM-hardened platform must use this database to get
 	  SoC specific identifier and information for the shared resources.
 
+config QCOM_COMMAND_DB_OPTIONAL
+	bool "Allow operation without Command DB data"
+	depends on QCOM_COMMAND_DB
+	help
+	  Allow the Command DB driver to bind successfully even when CMD DB
+	  data is not populated or has an invalid magic number.
+
+	  This is useful for platforms where CMD DB is not populated by the
+	  previous bootloader (e.g., snagboot mode where XBL loads U-Boot
+	  directly without initializing CMD DB).
+
+	  When enabled, missing CMD DB will generate warnings but allow boot
+	  to continue. Consumer drivers must handle cmd_db API failures
+	  gracefully by checking return values.
+
+	  If unsure, say N. Most production Qualcomm platforms require
+	  valid CMD DB data.
+
 config QCOM_RPMH
 	bool "Qualcomm RPMh support"
 	depends on QCOM_COMMAND_DB
drivers/soc/qcom/cmd-db.c +12 -2
index d0a6047b8a6..9b5091f5b5a 100644
@@ -252,8 +252,18 @@ static int cmd_db_bind(struct udevice *dev)
 
 	cmd_db_header = base;
 	if (!cmd_db_magic_matches(cmd_db_header)) {
-		log_err("%s: Invalid Command DB Magic\n", __func__);
-		return -EINVAL;
+		if (IS_ENABLED(CONFIG_QCOM_COMMAND_DB_OPTIONAL)) {
+			log_warning("%s: CMD DB magic not found (0x%02x%02x%02x%02x)\n",
+				    __func__, cmd_db_header->magic[0], cmd_db_header->magic[1],
+				    cmd_db_header->magic[2], cmd_db_header->magic[3]);
+			log_warning("%s: CMD DB data unavailable, resource queries will fail\n",
+				    __func__);
+			cmd_db_header = NULL;
+			return 0;
+		} else {
+			log_err("%s: Invalid Command DB Magic\n", __func__);
+			return -EINVAL;
+		}
 	}
 
 	return 0;
Signature · 1 line
2.34.1
#9 lore raw

Re: [PATCH v3 5/6] soc: qcom: cmd-db: Allow boot without CMD DB data

Hi Balaji,

Quoted 8 lines · Balaji Selvanathan

In snagboot mode, XBL loads U-Boot directly without populating CMD DB. The cmd-db driver fails to bind when CMD DB magic is invalid, blocking boot even when CMD DB is not strictly required.

Add QCOM_COMMAND_DB_OPTIONAL config to allow the driver to bind successfully when CMD DB data is absent. When enabled, a warning is logged and cmd_db_header is set to NULL, so consumer drivers receive errors on resource queries rather than preventing boot entirely.

Since we know we're in snagboot mode, as I mentioned before we don't need this additional option, just check for CONFIG_QCOM_SNAGBOOT_MODE instead rather than introduce another footgun.

Quoted 49 lines

---
Changes in v3:
- Used "if (IS_ENABLED(CONFIG_QCOM_COMMAND_DB_OPTIONAL))" instead of #ifdef

Changes in v2:
- No changes

---
 drivers/soc/qcom/Kconfig  | 18 ++++++++++++++++++
 drivers/soc/qcom/cmd-db.c | 14 ++++++++++++--
 2 files changed, 30 insertions(+), 2 deletions(-)
drivers/soc/qcom/Kconfig +18 -0
index 8243805e46a..7f4cf1b9a98 100644
@@ -18,6 +18,24 @@ config QCOM_COMMAND_DB
 	  resource on a RPM-hardened platform must use this database to get
 	  SoC specific identifier and information for the shared resources.
 
+config QCOM_COMMAND_DB_OPTIONAL
+	bool "Allow operation without Command DB data"
+	depends on QCOM_COMMAND_DB
+	help
+	  Allow the Command DB driver to bind successfully even when CMD DB
+	  data is not populated or has an invalid magic number.
+
+	  This is useful for platforms where CMD DB is not populated by the
+	  previous bootloader (e.g., snagboot mode where XBL loads U-Boot
+	  directly without initializing CMD DB).
+
+	  When enabled, missing CMD DB will generate warnings but allow boot
+	  to continue. Consumer drivers must handle cmd_db API failures
+	  gracefully by checking return values.
+
+	  If unsure, say N. Most production Qualcomm platforms require
+	  valid CMD DB data.
+
 config QCOM_RPMH
 	bool "Qualcomm RPMh support"
 	depends on QCOM_COMMAND_DB
drivers/soc/qcom/cmd-db.c +0 -0
index d0a6047b8a6..9b5091f5b5a 100644
@@ -252,8 +252,18 @@ static int cmd_db_bind(struct udevice *dev)
 

drivers/soc/qcom/cmd-db.c static int cmd_db_bind(struct udevice *dev) · line 260

Quoted 10 lines
drivers/soc/qcom/cmd-db.c +6 -2
 	cmd_db_header = base;
 	if (!cmd_db_magic_matches(cmd_db_header)) {
-		log_err("%s: Invalid Command DB Magic\n", __func__);
-		return -EINVAL;
+		if (IS_ENABLED(CONFIG_QCOM_COMMAND_DB_OPTIONAL)) {
+			log_warning("%s: CMD DB magic not found (0x%02x%02x%02x%02x)\n",
+				    __func__, cmd_db_header->magic[0], cmd_db_header->magic[1],
+				    cmd_db_header->magic[2], cmd_db_header->magic[3]);
+			log_warning("%s: CMD DB data unavailable, resource queries will fail\n",
+				    __func__);

You can drop these warnings if snagboot mode is enabled since that's the expected case. I think it would be more appropriate to log a warning if snagboot is enabled and we DO have a valid cmd-db, since that isn't an expected usecase right?

Kind regards,

Quoted 10 lines
drivers/soc/qcom/cmd-db.c +6 -0
+			cmd_db_header = NULL;
+			return 0;
+		} else {
+			log_err("%s: Invalid Command DB Magic\n", __func__);
+			return -EINVAL;
+		}
 	}
 
 	return 0;
Signature · 1 line
// Casey (she/her)
#10 lore raw

PATCH v3 6/6 configs: add qcom_lemans_snagboot_defconfig for Lemans-EVK

In reply to Balaji Selvanathan

Add a defconfig for booting U-Boot in snagboot mode on Lemans-EVK development boards. In this mode, XBL loads U-Boot directly and U-Boot immediately enters fastboot over USB for partition flashing.

---
Changes in v3:
- Removed enabling QCOM_COMMAND_DB_OPTIONAL, ENABLE_ARM_SOC_BOOT0_HOOK and SKIP_RELOCATE as they are now automatically enabled by QCOM_SNAGBOOT_SUPPORT selection

Changes in v2:
- Newly introduced in v2

---
 configs/qcom_lemans_snagboot_defconfig | 45 ++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
configs/qcom_lemans_snagboot_defconfig new file +45 -0
new file mode 100644
index 00000000000..c7ac07a6cf3
@@ -0,0 +1,45 @@
+# Configuration for building U-Boot for snagboot/recovery mode
+# on Lemans-EVK dev boards.
+#
+# For normal production boot, use qcom_lemans_defconfig instead.
+
+#include "qcom_defconfig"
+
+# Address where U-Boot will be loaded
+CONFIG_TEXT_BASE=0x1c100000
+CONFIG_REMAKE_ELF=y
+CONFIG_FASTBOOT_BUF_ADDR=0xdb300000
+CONFIG_DEFAULT_DEVICE_TREE="qcom/lemans-evk"
+CONFIG_ENV_IS_IN_SCSI=y
+CONFIG_ENV_SCSI_PART_USE_TYPE_GUID=y
+# SCSI partition type GUID for logfs partition
+CONFIG_ENV_SCSI_PART_TYPE_GUID="bc0330eb-3410-4951-a617-03898dbe3372"
+# CONFIG_ENV_IS_DEFAULT is not set
+# CONFIG_ENV_IS_NOWHERE is not set
+
+CONFIG_QCOM_SNAGBOOT_SUPPORT=y
+
+CONFIG_FASTBOOT_FLASH_BLOCK=y
+CONFIG_FASTBOOT_FLASH_BLOCK_INTERFACE_NAME="scsi"
+CONFIG_FASTBOOT_FLASH_BLOCK_DEVICE_ID=4
+CONFIG_FASTBOOT_GPT_NAME="gpt"
+CONFIG_FASTBOOT_MBR_NAME="mbr"
+
+# CONFIG_PSCI_RESET is not set
+
+CONFIG_COUNTER_FREQUENCY=19200000
+
+# CONFIG_SAVE_PREV_BL_INITRAMFS_START_ADDR is not set
+
+# CONFIG_IOMMU is not set
+
+# CONFIG_REBOOT_MODE_ENV_UPDATE is not set
+
+# Disable default env file to use CONFIG_BOOTCOMMAND instead
+# This allows snagboot-specific bootcmd without modifying shared default.env
+# CONFIG_ENV_USE_DEFAULT_ENV_TEXT_FILE is not set
+
+# Auto-enter fastboot mode for snagboot
+CONFIG_USE_BOOTCOMMAND=y
+CONFIG_BOOTCOMMAND="fastboot -l $fastboot_addr_r usb 0"
+CONFIG_BOOTDELAY=0
Signature · 1 line
2.34.1
#11 lore raw

Re: [PATCH v3 6/6] configs: add qcom_lemans_snagboot_defconfig for Lemans-EVK

Hi Balaji,

Quoted 3 lines · Balaji Selvanathan

Add a defconfig for booting U-Boot in snagboot mode on Lemans-EVK development boards. In this mode, XBL loads U-Boot directly and U-Boot immediately enters fastboot over USB for partition flashing.

Assuming this would be used on other platforms too, I'd much rather you put this in a config fragment.

On the topic of adding snagboot documentation, you should include a section describing board enablement, what config options are required (e.g. COUNTER_FREQUENCY).

Quoted 28 lines

---
Changes in v3:
- Removed enabling QCOM_COMMAND_DB_OPTIONAL, ENABLE_ARM_SOC_BOOT0_HOOK and SKIP_RELOCATE as they are now automatically enabled by QCOM_SNAGBOOT_SUPPORT selection

Changes in v2:
- Newly introduced in v2

---
 configs/qcom_lemans_snagboot_defconfig | 45 ++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
configs/qcom_lemans_snagboot_defconfig new file +8 -0
new file mode 100644
index 00000000000..c7ac07a6cf3
@@ -0,0 +1,45 @@
+# Configuration for building U-Boot for snagboot/recovery mode
+# on Lemans-EVK dev boards.
+#
+# For normal production boot, use qcom_lemans_defconfig instead.
+
+#include "qcom_defconfig"
+
+# Address where U-Boot will be loaded

configs/qcom_lemans_snagboot_defconfig line 18

Quoted 10 lines
configs/qcom_lemans_snagboot_defconfig new file +10 -0
+CONFIG_TEXT_BASE=0x1c100000
+CONFIG_REMAKE_ELF=y
+CONFIG_FASTBOOT_BUF_ADDR=0xdb300000
+CONFIG_DEFAULT_DEVICE_TREE="qcom/lemans-evk"
+CONFIG_ENV_IS_IN_SCSI=y
+CONFIG_ENV_SCSI_PART_USE_TYPE_GUID=y
+# SCSI partition type GUID for logfs partition
+CONFIG_ENV_SCSI_PART_TYPE_GUID="bc0330eb-3410-4951-a617-03898dbe3372"
+# CONFIG_ENV_IS_DEFAULT is not set
+# CONFIG_ENV_IS_NOWHERE is not set

I'd also like to understand why you have ENV_IS_IN_SCSI enabled here, if I "snag" my board for example by breaking stdin/out/err and saving the environment so I no longer get a shell and then I go to run snagboot it would fail in the same way.

For a recovery mechanism it really shouldn't load a potentially broken or untrusted environment from the board.

Quoted 4 lines
configs/qcom_lemans_snagboot_defconfig new file +4 -0
+
+CONFIG_QCOM_SNAGBOOT_SUPPORT=y
+
+CONFIG_FASTBOOT_FLASH_BLOCK=y

configs/qcom_lemans_snagboot_defconfig line 32

Quoted 10 lines
configs/qcom_lemans_snagboot_defconfig new file +10 -0
+CONFIG_FASTBOOT_FLASH_BLOCK_INTERFACE_NAME="scsi"
+CONFIG_FASTBOOT_FLASH_BLOCK_DEVICE_ID=4
+CONFIG_FASTBOOT_GPT_NAME="gpt"
+CONFIG_FASTBOOT_MBR_NAME="mbr"
+
+# CONFIG_PSCI_RESET is not set
+
+CONFIG_COUNTER_FREQUENCY=19200000
+
+# CONFIG_SAVE_PREV_BL_INITRAMFS_START_ADDR is not set

Does this cause problems? Please also disable it in the SNAGBOOT_MODE kconfig option and explain why it has to be disabled.

configs/qcom_lemans_snagboot_defconfig line 40

Quoted 8 lines
configs/qcom_lemans_snagboot_defconfig new file +8 -0
+
+# CONFIG_IOMMU is not set
+
+# CONFIG_REBOOT_MODE_ENV_UPDATE is not set
+
+# Disable default env file to use CONFIG_BOOTCOMMAND instead
+# This allows snagboot-specific bootcmd without modifying shared default.env
+# CONFIG_ENV_USE_DEFAULT_ENV_TEXT_FILE is not set

It would be nice if we could use #include on .env files...

configs/qcom_lemans_snagboot_defconfig line 45

Quoted 5 lines
configs/qcom_lemans_snagboot_defconfig new file +5 -0
+
+# Auto-enter fastboot mode for snagboot
+CONFIG_USE_BOOTCOMMAND=y
+CONFIG_BOOTCOMMAND="fastboot -l $fastboot_addr_r usb 0"
+CONFIG_BOOTDELAY=0

I'd suggest putting this in a new configs/qcom-snagboot.config and have this defconfig include it.

Thanks,

Quoted 1 line
Signature · 1 line
// Casey (she/her)
#12 lore raw
In reply to Balaji Selvanathan

Hi Balaji,

Quoted 2 lines · Balaji Selvanathan

This series adds support for running U-Boot in snagboot mode on Qualcomm Snapdragon platforms, targeting the Lemans-EVK board.

You didn't respond to my reply on v2 of this series.

Quoted 8 lines

Snagboot is an open-source, scriptable flashing framework that provides an alternative to the proprietary Firehose protocol for device provisioning. Like the traditional EDL+Firehose flow, Snagboot uses the Qualcomm boot ROM recovery mode (EDL) and Sahara protocol to download and execute bootloaders. However, instead of using the proprietary Firehose programmer, Snagboot loads U-Boot into DDR and uses the standard fastboot protocol for device flashing.

Glad to have some more info here. Please also add a doc page with this information as well as a list of supported platforms.

I would hope that this support will be expanded to other platforms, and I'll make that assumption with my feedback.

Quoted 8 lines

The framework consists of three modular components: snagrecover (downloads XBL/QCLib to initialize DDR and load U-Boot into RAM), snagflash (communicates with U-Boot over USB using fastboot to flash system images), and snagfactory (orchestrates parallel factory flashing tasks).

In the snagboot execution flow, ROM code in recovery mode loads

recovery mode?? Please be consistent and just say EDL or boot ROM.

Quoted 74 lines

snagrecover, which downloads XBL to internal memory. XBL executes and initializes DDR, then snagrecover downloads U-Boot into DDR and transfers control to it. At this point, XBL has left the MMU enabled with its own page tables and has not initialized PSCI firmware or populated the Command DB. U-Boot must handle this non-standard boot environment to enter fastboot mode for device flashing.

This series addresses the specific requirements of the snagboot flow:

Patch 1 changes SYSRESET_PSCI from 'select' to 'imply' so it can be disabled on platforms where PSCI firmware is unavailable.

Patch 2 guards show_psci_version() and qcom_psci_fixup() with CONFIG_ARM_SMCCC to prevent build failures when SMCCC is disabled.

Patch 3 adds CONFIG_QCOM_SNAGBOOT_SUPPORT option to enable snagboot mode support on Qualcomm platforms.

Patch 4 disables the MMU and invalidates TLBs at the earliest entry point to clear stale page tables left by previous bootloader before U-Boot sets up its own MMU.

Patch 5 adds QCOM_COMMAND_DB_OPTIONAL to allow the CMD DB driver to bind successfully when CMD DB data is not populated by XBL, logging a warning instead of failing.

Patch 6 adds qcom_lemans_snagboot_defconfig for Lemans-EVK, based on qcom_defconfig with snagboot-specific settings.

---
Changes in v3:
- Brought the MMU disable logic under CONFIG_QCOM_SNAGBOOT_SUPPORT
ifdef condition
- Moved the MMU disable codes to a new seperate file
- Used "if (IS_ENABLED(CONFIG_QCOM_COMMAND_DB_OPTIONAL))" instead
of #ifdef
- Removed enabling QCOM_COMMAND_DB_OPTIONAL, ENABLE_ARM_SOC_BOOT0_HOOK
and SKIP_RELOCATE as they are now automatically enabled by
QCOM_SNAGBOOT_SUPPORT selection
- Removed updating MAINTAINERS as the defconfig file is picked up by
the "N: qcom" line
- Link to v2: https://lore.kernel.org/u-boot/[email protected]/

Changes in v2:
- Changed SYSRESET_PSCI from 'select' to 'imply'
- Guard show_psci_version() and qcom_psci_fixup() with CONFIG_ARM_SMCCC
- Disables the MMU and invalidates TLBs at the earliest entry point
- Add qcom_lemans_snagboot_defconfig for Lemans-EVK
- Link to v1: https://lore.kernel.org/u-boot/[email protected]/

---
Balaji Selvanathan (6):
arm: snapdragon: Make SYSRESET_PSCI optional
arm: snapdragon: Guard PSCI functions with CONFIG_ARM_SMCCC
arm: snapdragon: Add CONFIG_QCOM_SNAGBOOT_SUPPORT option
arm: snapdragon: Disable MMU early before U-Boot reset vector
soc: qcom: cmd-db: Allow boot without CMD DB data
configs: add qcom_lemans_snagboot_defconfig for Lemans-EVK

 arch/arm/Kconfig                                   |  2 +-
 arch/arm/mach-snapdragon/Kconfig                   | 13 ++++++
 arch/arm/mach-snapdragon/board.c                   |  6 +++
 arch/arm/mach-snapdragon/include/mach/boot0.h      |  2 +
 .../mach-snapdragon/include/mach/snagboot_boot0.h  | 53 ++++++++++++++++++++++
 configs/qcom_lemans_snagboot_defconfig             | 45 ++++++++++++++++++
 drivers/soc/qcom/Kconfig                           | 18 ++++++++
 drivers/soc/qcom/cmd-db.c                          | 14 +++++-
 8 files changed, 150 insertions(+), 3 deletions(-)

---
base-commit: e1c3db1f788ed8106840e81b795e030cbe0020b7
change-id: 20260616-sngboot-760714938d18

Best regards,

Signature · 1 line
// Casey (she/her)
#13 lore raw

Hi,

Quoted 16 lines · Casey Connolly via groups.io

Hi Balaji,

Quoted 2 lines · Balaji Selvanathan

This series adds support for running U-Boot in snagboot mode on Qualcomm Snapdragon platforms, targeting the Lemans-EVK board.

You didn't respond to my reply on v2 of this series.

Quoted 8 lines

Snagboot is an open-source, scriptable flashing framework that provides an alternative to the proprietary Firehose protocol for device provisioning. Like the traditional EDL+Firehose flow, Snagboot uses the Qualcomm boot ROM recovery mode (EDL) and Sahara protocol to download and execute bootloaders. However, instead of using the proprietary Firehose programmer, Snagboot loads U-Boot into DDR and uses the standard fastboot protocol for device flashing.

Quoted 3 lines

Glad to have some more info here. Please also add a doc page with this information as well as a list of supported platforms.

I suppose they are talking about this snagboot: https://github.com/bootlin/snagboot

But what's confusing me is there is no mention of any Qualcomm board, nor any PR to add support for it. Is that in some downstream tree somewhere? (to be clear I'm just someone interested in understanding this better, snagboot is a very cool project that already supports plenty of SoCs and it's great if it has or will have qcom support)

Best regards,
Ferass

#14 lore raw
Quoted 24 lines · Ferass El Hafidi via groups.io

Hi,

Quoted 16 lines · Casey Connolly via groups.io

Hi Balaji,

Quoted 2 lines · Balaji Selvanathan

This series adds support for running U-Boot in snagboot mode on Qualcomm Snapdragon platforms, targeting the Lemans-EVK board.

You didn't respond to my reply on v2 of this series.

Quoted 8 lines

Snagboot is an open-source, scriptable flashing framework that provides an alternative to the proprietary Firehose protocol for device provisioning. Like the traditional EDL+Firehose flow, Snagboot uses the Qualcomm boot ROM recovery mode (EDL) and Sahara protocol to download and execute bootloaders. However, instead of using the proprietary Firehose programmer, Snagboot loads U-Boot into DDR and uses the standard fastboot protocol for device flashing.

Quoted 3 lines

Glad to have some more info here. Please also add a doc page with this information as well as a list of supported platforms.

Quoted 8 lines

I suppose they are talking about this snagboot: https://github.com/
bootlin/snagboot

But what's confusing me is there is no mention of any Qualcomm board, nor any PR to add support for it. Is that in some downstream tree somewhere? (to be clear I'm just someone interested in understanding this better, snagboot is a very cool project that already supports plenty of SoCs and it's great if it has or will have qcom support)

ah yep, there's a fork here
https://github.com/qualcomm-linux/snagboot/tree/qcom-next

Balaji: it would be great if you would include context like this in the cover letter.

Kind regards,

Quoted 15 lines

Best regards,
Ferass

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group. View/Reply Online (#3922): https://groups.io/g/u-boot-qcom/message/3922
Mute This Topic: https://groups.io/mt/119832159/8413174
Group Owner: [email protected]
Unsubscribe: https://groups.io/g/u-boot-qcom/
leave/13197796/8413174/1557304080/xyzzy [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 1 line
// Casey (she/her)
#15 lore raw

Hi Casey,

Quoted 30 lines · Casey Connolly
Quoted 20 lines · Ferass El Hafidi via groups.io

Hi,

Quoted 13 lines · Casey Connolly via groups.io

Hi Balaji,

Quoted 2 lines · Balaji Selvanathan

This series adds support for running U-Boot in snagboot mode on Qualcomm Snapdragon platforms, targeting the Lemans-EVK board.

You didn't respond to my reply on v2 of this series.

Quoted 7 lines

Snagboot is an open-source, scriptable flashing framework that provides an alternative to the proprietary Firehose protocol for device provisioning. Like the traditional EDL+Firehose flow, Snagboot uses the Qualcomm boot ROM recovery mode (EDL) and Sahara protocol to download and execute bootloaders. However, instead of using the proprietary Firehose programmer, Snagboot loads U-Boot into DDR and uses the standard fastboot protocol for device flashing.

Quoted 3 lines

Glad to have some more info here. Please also add a doc page with this information as well as a list of supported platforms.

Quoted 8 lines

I suppose they are talking about this snagboot: https://github.com/
bootlin/snagboot

But what's confusing me is there is no mention of any Qualcomm board, nor any PR to add support for it. Is that in some downstream tree somewhere? (to be clear I'm just someone interested in understanding this better, snagboot is a very cool project that already supports plenty of SoCs and it's great if it has or will have qcom support)

Quoted 5 lines

ah yep, there's a fork here
https://github.com/qualcomm-linux/snagboot/tree/qcom-next

Balaji: it would be great if you would include context like this in the cover letter.

Yes, the mentioned repo is where we are doing changes to bring Qualcomm (for Lemans EVK) support to Snagboot.

Sure, will include these details in the cover letter and also address other feedback comments in v4 respin, which I will send shortly.

Regards,

Balaji

Quoted 17 lines

Kind regards,

Quoted 14 lines

Best regards,
Ferass

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group. View/Reply Online (#3922): https://groups.io/g/u-boot-qcom/message/3922
Mute This Topic: https://groups.io/mt/119832159/8413174
Group Owner: [email protected]
Unsubscribe: https://groups.io/g/u-boot-qcom/
leave/13197796/8413174/1557304080/xyzzy [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#16 lore raw
In reply to Casey Connolly

Hi Casey,

Quoted 30 lines · Casey Connolly
Quoted 20 lines · Ferass El Hafidi via groups.io

Hi,

Quoted 13 lines · Casey Connolly via groups.io

Hi Balaji,

Quoted 2 lines · Balaji Selvanathan

This series adds support for running U-Boot in snagboot mode on Qualcomm Snapdragon platforms, targeting the Lemans-EVK board.

You didn't respond to my reply on v2 of this series.

Quoted 7 lines

Snagboot is an open-source, scriptable flashing framework that provides an alternative to the proprietary Firehose protocol for device provisioning. Like the traditional EDL+Firehose flow, Snagboot uses the Qualcomm boot ROM recovery mode (EDL) and Sahara protocol to download and execute bootloaders. However, instead of using the proprietary Firehose programmer, Snagboot loads U-Boot into DDR and uses the standard fastboot protocol for device flashing.

Quoted 3 lines

Glad to have some more info here. Please also add a doc page with this information as well as a list of supported platforms.

Quoted 8 lines

I suppose they are talking about this snagboot: https://github.com/
bootlin/snagboot

But what's confusing me is there is no mention of any Qualcomm board, nor any PR to add support for it. Is that in some downstream tree somewhere? (to be clear I'm just someone interested in understanding this better, snagboot is a very cool project that already supports plenty of SoCs and it's great if it has or will have qcom support)

Quoted 5 lines

ah yep, there's a fork here
https://github.com/qualcomm-linux/snagboot/tree/qcom-next

Balaji: it would be great if you would include context like this in the cover letter.

Please find v4 here: https://lore.kernel.org/u-boot/[email protected]/

Regards,

Balaji

Quoted 17 lines

Kind regards,

Quoted 14 lines

Best regards,
Ferass

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group. View/Reply Online (#3922): https://groups.io/g/u-boot-qcom/message/3922
Mute This Topic: https://groups.io/mt/119832159/8413174
Group Owner: [email protected]
Unsubscribe: https://groups.io/g/u-boot-qcom/
leave/13197796/8413174/1557304080/xyzzy [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#17 lore raw
In reply to Ferass El Hafidi

Hi Ferass,

Quoted 23 lines · Ferass El Hafidi

Hi,

Quoted 16 lines · Casey Connolly via groups.io

Hi Balaji,

Quoted 2 lines · Balaji Selvanathan

This series adds support for running U-Boot in snagboot mode on Qualcomm Snapdragon platforms, targeting the Lemans-EVK board.

You didn't respond to my reply on v2 of this series.

Quoted 8 lines

Snagboot is an open-source, scriptable flashing framework that provides an alternative to the proprietary Firehose protocol for device provisioning. Like the traditional EDL+Firehose flow, Snagboot uses the Qualcomm boot ROM recovery mode (EDL) and Sahara protocol to download and execute bootloaders. However, instead of using the proprietary Firehose programmer, Snagboot loads U-Boot into DDR and uses the standard fastboot protocol for device flashing.

Quoted 3 lines

Glad to have some more info here. Please also add a doc page with this information as well as a list of supported platforms.

Quoted 7 lines

I suppose they are talking about this snagboot: https://github.com/bootlin/snagboot

But what's confusing me is there is no mention of any Qualcomm board, nor any PR to add support for it. Is that in some downstream tree somewhere? (to be clear I'm just someone interested in understanding this better, snagboot is a very cool project that already supports plenty of SoCs and it's great if it has or will have qcom support)

Sure, will add more information regarding this in v4 respin, which i will send shortly.

Quoted 3 lines

Best regards,
Ferass

#18 lore raw
In reply to Ferass El Hafidi

Hi Ferass,

Quoted 23 lines · Ferass El Hafidi

Hi,

Quoted 16 lines · Casey Connolly via groups.io

Hi Balaji,

Quoted 2 lines · Balaji Selvanathan

This series adds support for running U-Boot in snagboot mode on Qualcomm Snapdragon platforms, targeting the Lemans-EVK board.

You didn't respond to my reply on v2 of this series.

Quoted 8 lines

Snagboot is an open-source, scriptable flashing framework that provides an alternative to the proprietary Firehose protocol for device provisioning. Like the traditional EDL+Firehose flow, Snagboot uses the Qualcomm boot ROM recovery mode (EDL) and Sahara protocol to download and execute bootloaders. However, instead of using the proprietary Firehose programmer, Snagboot loads U-Boot into DDR and uses the standard fastboot protocol for device flashing.

Quoted 3 lines

Glad to have some more info here. Please also add a doc page with this information as well as a list of supported platforms.

Quoted 7 lines

I suppose they are talking about this snagboot: https://github.com/bootlin/snagboot

But what's confusing me is there is no mention of any Qualcomm board, nor any PR to add support for it. Is that in some downstream tree somewhere? (to be clear I'm just someone interested in understanding this better, snagboot is a very cool project that already supports plenty of SoCs and it's great if it has or will have qcom support)

Please find v4 here: https://lore.kernel.org/u-boot/[email protected]/ whose cover letter has more info on Snagboot Qcom.

Regards,

Balaji

Quoted 3 lines

Best regards,
Ferass

#19 lore raw
In reply to Casey Connolly

Hi Casey,

Quoted 6 lines · Casey Connolly

Hi Balaji,

Quoted 2 lines · Balaji Selvanathan

This series adds support for running U-Boot in snagboot mode on Qualcomm Snapdragon platforms, targeting the Lemans-EVK board.

You didn't respond to my reply on v2 of this series.

Sorry, missed replying to you regarding v3 series.

Quoted 9 lines
Quoted 7 lines

Snagboot is an open-source, scriptable flashing framework that provides an alternative to the proprietary Firehose protocol for device provisioning. Like the traditional EDL+Firehose flow, Snagboot uses the Qualcomm boot ROM recovery mode (EDL) and Sahara protocol to download and execute bootloaders. However, instead of using the proprietary Firehose programmer, Snagboot loads U-Boot into DDR and uses the standard fastboot protocol for device flashing.

Glad to have some more info here. Please also add a doc page with this information as well as a list of supported platforms.

Sure, will include a patch having documentation in v4 respin.

Quoted 3 lines

I would hope that this support will be expanded to other platforms, and I'll make that assumption with my feedback.

Yes, currently we are supporting for Lemans EVK. The plan is to to support other platforms in future.

Quoted 9 lines
Quoted 8 lines

The framework consists of three modular components: snagrecover (downloads XBL/QCLib to initialize DDR and load U-Boot into RAM), snagflash (communicates with U-Boot over USB using fastboot to flash system images), and snagfactory (orchestrates parallel factory flashing tasks).

In the snagboot execution flow, ROM code in recovery mode loads

recovery mode?? Please be consistent and just say EDL or boot ROM.

Sure.

Thanks,

Balaji

Quoted 75 lines
Quoted 75 lines

snagrecover, which downloads XBL to internal memory. XBL executes and initializes DDR, then snagrecover downloads U-Boot into DDR and transfers control to it. At this point, XBL has left the MMU enabled with its own page tables and has not initialized PSCI firmware or populated the Command DB. U-Boot must handle this non-standard boot environment to enter fastboot mode for device flashing.

This series addresses the specific requirements of the snagboot flow:

Patch 1 changes SYSRESET_PSCI from 'select' to 'imply' so it can be disabled on platforms where PSCI firmware is unavailable.

Patch 2 guards show_psci_version() and qcom_psci_fixup() with CONFIG_ARM_SMCCC to prevent build failures when SMCCC is disabled.

Patch 3 adds CONFIG_QCOM_SNAGBOOT_SUPPORT option to enable snagboot mode support on Qualcomm platforms.

Patch 4 disables the MMU and invalidates TLBs at the earliest entry point to clear stale page tables left by previous bootloader before U-Boot sets up its own MMU.

Patch 5 adds QCOM_COMMAND_DB_OPTIONAL to allow the CMD DB driver to bind successfully when CMD DB data is not populated by XBL, logging a warning instead of failing.

Patch 6 adds qcom_lemans_snagboot_defconfig for Lemans-EVK, based on qcom_defconfig with snagboot-specific settings.

---
Changes in v3:
- Brought the MMU disable logic under CONFIG_QCOM_SNAGBOOT_SUPPORT
ifdef condition
- Moved the MMU disable codes to a new seperate file
- Used "if (IS_ENABLED(CONFIG_QCOM_COMMAND_DB_OPTIONAL))" instead
of #ifdef
- Removed enabling QCOM_COMMAND_DB_OPTIONAL, ENABLE_ARM_SOC_BOOT0_HOOK
and SKIP_RELOCATE as they are now automatically enabled by QCOM_SNAGBOOT_SUPPORT selection
- Removed updating MAINTAINERS as the defconfig file is picked up by
the "N: qcom" line
- Link to v2: https://lore.kernel.org/u-boot/[email protected]/

Changes in v2:
- Changed SYSRESET_PSCI from 'select' to 'imply'
- Guard show_psci_version() and qcom_psci_fixup() with CONFIG_ARM_SMCCC
- Disables the MMU and invalidates TLBs at the earliest entry point
- Add qcom_lemans_snagboot_defconfig for Lemans-EVK
- Link to v1: https://lore.kernel.org/u-boot/[email protected]/

---
Balaji Selvanathan (6):
arm: snapdragon: Make SYSRESET_PSCI optional
arm: snapdragon: Guard PSCI functions with CONFIG_ARM_SMCCC
arm: snapdragon: Add CONFIG_QCOM_SNAGBOOT_SUPPORT option
arm: snapdragon: Disable MMU early before U-Boot reset vector
soc: qcom: cmd-db: Allow boot without CMD DB data
configs: add qcom_lemans_snagboot_defconfig for Lemans-EVK

  arch/arm/Kconfig                                   |  2 +-
  arch/arm/mach-snapdragon/Kconfig                   | 13 ++++++
  arch/arm/mach-snapdragon/board.c                   |  6 +++
  arch/arm/mach-snapdragon/include/mach/boot0.h      |  2 +
  .../mach-snapdragon/include/mach/snagboot_boot0.h  | 53 ++++++++++++++++++++++
  configs/qcom_lemans_snagboot_defconfig             | 45 ++++++++++++++++++
  drivers/soc/qcom/Kconfig                           | 18 ++++++++
  drivers/soc/qcom/cmd-db.c                          | 14 +++++-
  8 files changed, 150 insertions(+), 3 deletions(-)

---
base-commit: e1c3db1f788ed8106840e81b795e030cbe0020b7
change-id: 20260616-sngboot-760714938d18

Best regards,

#20 lore raw
In reply to Balaji Selvanathan

Hi Balaji,

Quoted 2 lines · Balaji Selvanathan

This series adds support for running U-Boot in snagboot mode on Qualcomm Snapdragon platforms, targeting the Lemans-EVK board.

It's clear from the patches that this series will not apply, and you haven't indicated any dependencies.

Please list them in the cover letter in the next revision, for now having that list in a reply here would be helpful.

Quoted 90 lines

Snagboot is an open-source, scriptable flashing framework that provides an alternative to the proprietary Firehose protocol for device provisioning. Like the traditional EDL+Firehose flow, Snagboot uses the Qualcomm boot ROM recovery mode (EDL) and Sahara protocol to download and execute bootloaders. However, instead of using the proprietary Firehose programmer, Snagboot loads U-Boot into DDR and uses the standard fastboot protocol for device flashing.

The framework consists of three modular components: snagrecover (downloads XBL/QCLib to initialize DDR and load U-Boot into RAM), snagflash (communicates with U-Boot over USB using fastboot to flash system images), and snagfactory (orchestrates parallel factory flashing tasks).

In the snagboot execution flow, ROM code in recovery mode loads snagrecover, which downloads XBL to internal memory. XBL executes and initializes DDR, then snagrecover downloads U-Boot into DDR and transfers control to it. At this point, XBL has left the MMU enabled with its own page tables and has not initialized PSCI firmware or populated the Command DB. U-Boot must handle this non-standard boot environment to enter fastboot mode for device flashing.

This series addresses the specific requirements of the snagboot flow:

Patch 1 changes SYSRESET_PSCI from 'select' to 'imply' so it can be disabled on platforms where PSCI firmware is unavailable.

Patch 2 guards show_psci_version() and qcom_psci_fixup() with CONFIG_ARM_SMCCC to prevent build failures when SMCCC is disabled.

Patch 3 adds CONFIG_QCOM_SNAGBOOT_SUPPORT option to enable snagboot mode support on Qualcomm platforms.

Patch 4 disables the MMU and invalidates TLBs at the earliest entry point to clear stale page tables left by previous bootloader before U-Boot sets up its own MMU.

Patch 5 adds QCOM_COMMAND_DB_OPTIONAL to allow the CMD DB driver to bind successfully when CMD DB data is not populated by XBL, logging a warning instead of failing.

Patch 6 adds qcom_lemans_snagboot_defconfig for Lemans-EVK, based on qcom_defconfig with snagboot-specific settings.

---
Changes in v3:
- Brought the MMU disable logic under CONFIG_QCOM_SNAGBOOT_SUPPORT
ifdef condition
- Moved the MMU disable codes to a new seperate file
- Used "if (IS_ENABLED(CONFIG_QCOM_COMMAND_DB_OPTIONAL))" instead
of #ifdef
- Removed enabling QCOM_COMMAND_DB_OPTIONAL, ENABLE_ARM_SOC_BOOT0_HOOK
and SKIP_RELOCATE as they are now automatically enabled by
QCOM_SNAGBOOT_SUPPORT selection
- Removed updating MAINTAINERS as the defconfig file is picked up by
the "N: qcom" line
- Link to v2: https://lore.kernel.org/u-boot/[email protected]/

Changes in v2:
- Changed SYSRESET_PSCI from 'select' to 'imply'
- Guard show_psci_version() and qcom_psci_fixup() with CONFIG_ARM_SMCCC
- Disables the MMU and invalidates TLBs at the earliest entry point
- Add qcom_lemans_snagboot_defconfig for Lemans-EVK
- Link to v1: https://lore.kernel.org/u-boot/[email protected]/

---
Balaji Selvanathan (6):
arm: snapdragon: Make SYSRESET_PSCI optional
arm: snapdragon: Guard PSCI functions with CONFIG_ARM_SMCCC
arm: snapdragon: Add CONFIG_QCOM_SNAGBOOT_SUPPORT option
arm: snapdragon: Disable MMU early before U-Boot reset vector
soc: qcom: cmd-db: Allow boot without CMD DB data
configs: add qcom_lemans_snagboot_defconfig for Lemans-EVK

 arch/arm/Kconfig                                   |  2 +-
 arch/arm/mach-snapdragon/Kconfig                   | 13 ++++++
 arch/arm/mach-snapdragon/board.c                   |  6 +++
 arch/arm/mach-snapdragon/include/mach/boot0.h      |  2 +
 .../mach-snapdragon/include/mach/snagboot_boot0.h  | 53 ++++++++++++++++++++++
 configs/qcom_lemans_snagboot_defconfig             | 45 ++++++++++++++++++
 drivers/soc/qcom/Kconfig                           | 18 ++++++++
 drivers/soc/qcom/cmd-db.c                          | 14 +++++-
 8 files changed, 150 insertions(+), 3 deletions(-)

---
base-commit: e1c3db1f788ed8106840e81b795e030cbe0020b7
change-id: 20260616-sngboot-760714938d18

Best regards,

Signature · 1 line
// Casey (she/her)